mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-08 21:26:40 +08:00
数据范围以及角色员工
This commit is contained in:
parent
833082a918
commit
11850a4dd8
@ -72,6 +72,7 @@ public class DataScopeSqlConfigService {
|
||||
configDTO.setWhereIndex(dataScopeAnnotation.whereIndex());
|
||||
configDTO.setDataScopeWhereInType(dataScopeAnnotation.whereInType());
|
||||
configDTO.setParamName(dataScopeAnnotation.paramName());
|
||||
configDTO.setJoinSqlImplClazz(dataScopeAnnotation.joinSqlImplClazz());
|
||||
dataScopeMethodMap.put(method.getDeclaringClass().getSimpleName() + "." + method.getName(), configDTO);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -58,10 +59,14 @@ public class RoleEmployeeService {
|
||||
public ResponseDTO<PageResultDTO<EmployeeVO>> listEmployeeByName(RoleQueryForm queryDTO) {
|
||||
Page page = SmartPageUtil.convert2PageQuery(queryDTO);
|
||||
List<EmployeeDTO> employeeDTOS = roleEmployeeDao.selectEmployeeByNamePage(page, queryDTO);
|
||||
employeeDTOS.stream().filter(e -> e.getDepartmentId() != null).forEach(employeeDTO -> {
|
||||
DepartmentEntity departmentEntity = departmentDao.selectById(employeeDTO.getDepartmentId());
|
||||
employeeDTO.setDepartmentName(departmentEntity.getName());
|
||||
});
|
||||
List<Long> departmentIdList = employeeDTOS.stream().filter(e -> e.getDepartmentId() != null).map(EmployeeDTO::getDepartmentId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(departmentIdList)){
|
||||
List<DepartmentEntity> departmentEntities = departmentDao.selectBatchIds(departmentIdList);
|
||||
Map<Long, String> departmentIdNameMap = departmentEntities.stream().collect(Collectors.toMap(DepartmentEntity::getId, DepartmentEntity::getName));
|
||||
employeeDTOS.forEach(e->{
|
||||
e.setDepartmentName(departmentIdNameMap.getOrDefault(e.getDepartmentId(), ""));
|
||||
});
|
||||
}
|
||||
PageResultDTO<EmployeeVO> pageResultDTO = SmartPageUtil.convert2PageResult(page, employeeDTOS, EmployeeVO.class);
|
||||
return ResponseDTO.ok(pageResultDTO);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user