Search in sources :

Example 1 with SysDepartVO

use of vip.mate.system.vo.SysDepartVO in project matecloud by matevip.

the class SysDepartServiceImpl method searchList.

@Override
public List<SysDepartVO> searchList(Map<String, Object> search) {
    String keyword = String.valueOf(search.get("keyword"));
    String startDate = String.valueOf(search.get("startDate"));
    String endDate = String.valueOf(search.get("endDate"));
    LambdaQueryWrapper<SysDepart> lambdaQueryWrapper = new LambdaQueryWrapper<>();
    if (StrUtil.isNotBlank(startDate) && !startDate.equals(NULL)) {
        lambdaQueryWrapper.between(SysDepart::getCreateTime, startDate, endDate);
    }
    if (StrUtil.isNotBlank(keyword) && !keyword.equals(NULL)) {
        lambdaQueryWrapper.and(i -> i.or().like(SysDepart::getName, keyword).or().like(SysDepart::getId, keyword));
    }
    List<SysDepart> sysDeparts = this.baseMapper.selectList(lambdaQueryWrapper);
    List<SysDepartVO> sysDepartVOS = sysDeparts.stream().map(sysDepart -> {
        SysDepartVO sysDepartVO = new SysDepartVO();
        BeanUtils.copyProperties(sysDepart, sysDepartVO);
        return sysDepartVO;
    }).collect(Collectors.toList());
    return ForestNodeMerger.merge(sysDepartVOS);
}
Also used : SysDepartVO(vip.mate.system.vo.SysDepartVO) ServiceImpl(com.baomidou.mybatisplus.extension.service.impl.ServiceImpl) Wrappers(com.baomidou.mybatisplus.core.toolkit.Wrappers) SysDepart(vip.mate.system.entity.SysDepart) SysDepartMapper(vip.mate.system.mapper.SysDepartMapper) SysDepartVO(vip.mate.system.vo.SysDepartVO) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) StrUtil(cn.hutool.core.util.StrUtil) ISysDepartService(vip.mate.system.service.ISysDepartService) List(java.util.List) Service(org.springframework.stereotype.Service) Map(java.util.Map) DepartDTO(vip.mate.system.dto.DepartDTO) ForestNodeMerger(vip.mate.core.web.tree.ForestNodeMerger) SysDepartPOI(vip.mate.system.poi.SysDepartPOI) BeanUtils(org.springframework.beans.BeanUtils) SysDepart(vip.mate.system.entity.SysDepart) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Aggregations

StrUtil (cn.hutool.core.util.StrUtil)1 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 Wrappers (com.baomidou.mybatisplus.core.toolkit.Wrappers)1 ServiceImpl (com.baomidou.mybatisplus.extension.service.impl.ServiceImpl)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 BeanUtils (org.springframework.beans.BeanUtils)1 Service (org.springframework.stereotype.Service)1 ForestNodeMerger (vip.mate.core.web.tree.ForestNodeMerger)1 DepartDTO (vip.mate.system.dto.DepartDTO)1 SysDepart (vip.mate.system.entity.SysDepart)1 SysDepartMapper (vip.mate.system.mapper.SysDepartMapper)1 SysDepartPOI (vip.mate.system.poi.SysDepartPOI)1 ISysDepartService (vip.mate.system.service.ISysDepartService)1 SysDepartVO (vip.mate.system.vo.SysDepartVO)1