|
@@ -153,8 +153,9 @@ public class UserController {
|
|
@GetMapping("list")
|
|
@GetMapping("list")
|
|
public ResponseEntity list(UserDTO userDTO, Page <UserDTO> page) throws Exception {
|
|
public ResponseEntity list(UserDTO userDTO, Page <UserDTO> page) throws Exception {
|
|
QueryWrapper <UserDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( userDTO, UserDTO.class );
|
|
QueryWrapper <UserDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( userDTO, UserDTO.class );
|
|
|
|
+ OfficeDTO officeDTO1 = UserUtils.getCurrentUserDTO().getOfficeDTO();
|
|
// 管理员查询不限制
|
|
// 管理员查询不限制
|
|
- /*if (!UserUtils.getCurrentUserDTO().isAdmin()) {
|
|
|
|
|
|
+ if (!UserUtils.getCurrentUserDTO().isAdmin()) {
|
|
queryWrapper.isNull("a.is_admin");
|
|
queryWrapper.isNull("a.is_admin");
|
|
if (ObjectUtil.isNotEmpty(userDTO)){
|
|
if (ObjectUtil.isNotEmpty(userDTO)){
|
|
// 当不是精确的部门查询时,再添加下面的筛选条件
|
|
// 当不是精确的部门查询时,再添加下面的筛选条件
|
|
@@ -163,18 +164,26 @@ public class UserController {
|
|
// 根据当前用户的部门id找到此部门的ids
|
|
// 根据当前用户的部门id找到此部门的ids
|
|
String ids = officeService.getById(UserUtils.getCurrentUserDTO().getOfficeDTO().getId()).getParentIds();
|
|
String ids = officeService.getById(UserUtils.getCurrentUserDTO().getOfficeDTO().getId()).getParentIds();
|
|
// 根据ids分隔后的index[2],找到当前用户的所属公司id
|
|
// 根据ids分隔后的index[2],找到当前用户的所属公司id
|
|
|
|
+ String companyId = null;
|
|
String[] split = ids.split(",");
|
|
String[] split = ids.split(",");
|
|
- String companyId = split[2];
|
|
|
|
- // 根据公司id,找到此公司下的所有部门
|
|
|
|
- List<Office> officeList = officeService.list(new QueryWrapper<Office>().lambda().eq(Office::getParentId, companyId));
|
|
|
|
- // 拿到这些部门的id
|
|
|
|
- List<String> officeIdList = officeList.stream().distinct().map(Office::getId).collect(Collectors.toList());
|
|
|
|
- // 添加筛选条件为这些部门的id
|
|
|
|
- queryWrapper.in("a.office_id",officeIdList);
|
|
|
|
|
|
+ if(split.length>2){
|
|
|
|
+ companyId = split[2];
|
|
|
|
+
|
|
|
|
+ // 根据公司id,找到此公司下的所有部门
|
|
|
|
+ List<Office> officeList = officeService.list(new QueryWrapper<Office>().lambda().eq(Office::getParentId, companyId));
|
|
|
|
+ // 拿到这些部门的id
|
|
|
|
+ List<String> officeIdList = officeList.stream().distinct().map(Office::getId).collect(Collectors.toList());
|
|
|
|
+ // 添加筛选条件为这些部门的id
|
|
|
|
+ queryWrapper.in("a.office_id",officeIdList);
|
|
|
|
+ }else{
|
|
|
|
+ companyId = officeDTO1.getId();
|
|
|
|
+ // 添加筛选条件为这些部门的id
|
|
|
|
+ queryWrapper.in("a.office_id",companyId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
if (ObjectUtil.isNotEmpty(userDTO)) {
|
|
if (ObjectUtil.isNotEmpty(userDTO)) {
|
|
// 当certType传值时,获取拥有此资格证类型的人员
|
|
// 当certType传值时,获取拥有此资格证类型的人员
|
|
if (StringUtils.isNotBlank(userDTO.getCertType())) {
|
|
if (StringUtils.isNotBlank(userDTO.getCertType())) {
|