use of vip.mate.system.entity.SysDepart in project matecloud by matevip.
the class SysDepartServiceImpl method export.
@Override
public List<SysDepartPOI> export() {
LambdaQueryWrapper<SysDepart> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysDepart::getIsDeleted, 0);
List<SysDepart> sysDeparts = this.baseMapper.selectList(queryWrapper);
return sysDeparts.stream().map(sysDepart -> {
SysDepartPOI sysDepartPOI = new SysDepartPOI();
BeanUtils.copyProperties(sysDepart, sysDepartPOI);
return sysDepartPOI;
}).collect(Collectors.toList());
}
use of vip.mate.system.entity.SysDepart in project matecloud by matevip.
the class SysDepartServiceImpl method getDepart.
private DepartDTO getDepart(Long id) {
List<SysDepart> departs = this.list(Wrappers.<SysDepart>query().lambda().select(SysDepart::getId, SysDepart::getName, SysDepart::getParentId, SysDepart::getSort, SysDepart::getCreateTime));
List<DepartDTO> sysDeparts = departs.stream().map(sysDepart -> {
DepartDTO departDTO = new DepartDTO();
BeanUtils.copyProperties(sysDepart, departDTO);
return departDTO;
}).collect(Collectors.toList());
Map<Long, DepartDTO> map = sysDeparts.stream().collect(Collectors.toMap(SysDepart::getId, department -> department));
for (DepartDTO dept : map.values()) {
DepartDTO parent = map.get(dept.getParentId());
if (parent != null) {
List<DepartDTO> children = parent.getChildren() == null ? new ArrayList<>() : parent.getChildren();
children.add(dept);
parent.setChildren(children);
}
}
return map.get(id);
}
use of vip.mate.system.entity.SysDepart 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);
}
Aggregations