|
|
@@ -16,10 +16,12 @@ import com.tuoheng.admin.request.user.QueryUserPageListRequest; |
|
|
|
import com.tuoheng.admin.utils.CurrentUserUtil; |
|
|
|
import com.tuoheng.admin.vo.user.UserPageListVo; |
|
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.function.Function; |
|
|
@@ -62,7 +64,7 @@ public class QueryUserPageListService { |
|
|
|
String tenantId = user.getTenantId(); |
|
|
|
request.setTenantId(tenantId); |
|
|
|
|
|
|
|
List<String> deptIdList = this.getDeptIdList(user); |
|
|
|
List<String> deptIdList = this.getDeptIdList(user, request.getDeptId()); |
|
|
|
request.setDeptIdList(deptIdList); |
|
|
|
|
|
|
|
// 查询分页数据 |
|
|
@@ -110,14 +112,20 @@ public class QueryUserPageListService { |
|
|
|
* @param user |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private List<String> getDeptIdList(User user) { |
|
|
|
List<String> deptIdList; |
|
|
|
private List<String> getDeptIdList(User user, String deptId) { |
|
|
|
List<String> deptIdList = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotEmpty(deptId)) { |
|
|
|
deptIdList.add(deptId); |
|
|
|
return deptIdList; |
|
|
|
} |
|
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { |
|
|
|
return null; |
|
|
|
} else { |
|
|
|
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { |
|
|
|
deptIdList = deptMapper.selectAllChildListById(user.getDeptId()); |
|
|
|
return deptIdList; |
|
|
|
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
|
deptIdList.add(user.getDeptId()); |
|
|
|
} |
|
|
|
return deptIdList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |