|
@@ -43,6 +43,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.core.parameters.P;
|
|
import org.springframework.security.core.parameters.P;
|
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -165,14 +166,19 @@ public class UserController {
|
|
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)){
|
|
- // 当不是精确的部门查询时,再添加下面的筛选条件
|
|
|
|
- if (ObjectUtil.isNotEmpty(userDTO.getOfficeDTO()) && ObjectUtil.isEmpty(userDTO.getCompanyDTO())) {
|
|
|
|
- if(StringUtils.isBlank(userDTO.getOfficeDTO().getId())){
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(userDTO.getCompanyDTO()) && ObjectUtil.isNotEmpty(userDTO.getOfficeDTO())) {
|
|
|
|
+ // 当不是精确的部门查询时,再添加下面的筛选条件
|
|
|
|
+ if ((StringUtils.isNotBlank(userDTO.getCompanyDTO().getId()) && StringUtils.isBlank(userDTO.getOfficeDTO().getId()))
|
|
|
|
+ || "true".equals(userDTO.getSelectAll())) {
|
|
|
|
+ // officeDTO.id是空,companyDTO.id不是空的话,说明前端组件点击的集团来进行查询
|
|
|
|
+ // selectAll为‘true’的话,说明前端没有选择集团或者部门查询,这个时候要展示全部人员
|
|
// 根据当前用户的部门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 companyId = null;
|
|
String[] split = ids.split(",");
|
|
String[] split = ids.split(",");
|
|
|
|
+ // split.length大于2,说明当前登录人所属部门是普通部门,展示部分人员信息
|
|
|
|
+ // 否则,当前登录人所属公共类部门(忘了叫什么类部门了,就是总经办那种部门),展示全部人员信息
|
|
if(split.length>2){
|
|
if(split.length>2){
|
|
companyId = split[2];
|
|
companyId = split[2];
|
|
// 根据公司id,找到此公司下的所有部门
|
|
// 根据公司id,找到此公司下的所有部门
|
|
@@ -188,11 +194,10 @@ public class UserController {
|
|
List<String> lastIds = officeIdList.stream().distinct().collect(Collectors.toList());
|
|
List<String> lastIds = officeIdList.stream().distinct().collect(Collectors.toList());
|
|
// 添加筛选条件为这些部门的id
|
|
// 添加筛选条件为这些部门的id
|
|
queryWrapper.in("a.office_id",lastIds);
|
|
queryWrapper.in("a.office_id",lastIds);
|
|
- }else{
|
|
|
|
- companyId = UserUtils.getCurrentUserDTO().getOfficeDTO().getId();
|
|
|
|
- // 添加筛选条件为当前登录人部门的id
|
|
|
|
- queryWrapper.eq("a.office_id",companyId);
|
|
|
|
}
|
|
}
|
|
|
|
+ } else if(StringUtils.isBlank(userDTO.getCompanyDTO().getId()) && StringUtils.isNotBlank(userDTO.getOfficeDTO().getId())) {
|
|
|
|
+ // officeDTO.id不是空,companyDTO.id是空的话,说明前端组件点击的部门查询
|
|
|
|
+ queryWrapper.eq("a.office_id",userDTO.getOfficeDTO().getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|