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.setWhereIndex(dataScopeAnnotation.whereIndex());
|
||||||
configDTO.setDataScopeWhereInType(dataScopeAnnotation.whereInType());
|
configDTO.setDataScopeWhereInType(dataScopeAnnotation.whereInType());
|
||||||
configDTO.setParamName(dataScopeAnnotation.paramName());
|
configDTO.setParamName(dataScopeAnnotation.paramName());
|
||||||
|
configDTO.setJoinSqlImplClazz(dataScopeAnnotation.joinSqlImplClazz());
|
||||||
dataScopeMethodMap.put(method.getDeclaringClass().getSimpleName() + "." + method.getName(), configDTO);
|
dataScopeMethodMap.put(method.getDeclaringClass().getSimpleName() + "." + method.getName(), configDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,10 +59,14 @@ public class RoleEmployeeService {
|
|||||||
public ResponseDTO<PageResultDTO<EmployeeVO>> listEmployeeByName(RoleQueryForm queryDTO) {
|
public ResponseDTO<PageResultDTO<EmployeeVO>> listEmployeeByName(RoleQueryForm queryDTO) {
|
||||||
Page page = SmartPageUtil.convert2PageQuery(queryDTO);
|
Page page = SmartPageUtil.convert2PageQuery(queryDTO);
|
||||||
List<EmployeeDTO> employeeDTOS = roleEmployeeDao.selectEmployeeByNamePage(page, queryDTO);
|
List<EmployeeDTO> employeeDTOS = roleEmployeeDao.selectEmployeeByNamePage(page, queryDTO);
|
||||||
employeeDTOS.stream().filter(e -> e.getDepartmentId() != null).forEach(employeeDTO -> {
|
List<Long> departmentIdList = employeeDTOS.stream().filter(e -> e.getDepartmentId() != null).map(EmployeeDTO::getDepartmentId).collect(Collectors.toList());
|
||||||
DepartmentEntity departmentEntity = departmentDao.selectById(employeeDTO.getDepartmentId());
|
if(CollectionUtils.isNotEmpty(departmentIdList)){
|
||||||
employeeDTO.setDepartmentName(departmentEntity.getName());
|
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);
|
PageResultDTO<EmployeeVO> pageResultDTO = SmartPageUtil.convert2PageResult(page, employeeDTOS, EmployeeVO.class);
|
||||||
return ResponseDTO.ok(pageResultDTO);
|
return ResponseDTO.ok(pageResultDTO);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user