|
@@ -1,5 +1,7 @@
|
|
|
package com.fdkankan.fusion.service.impl;
|
|
|
|
|
|
+import cn.dev33.satoken.context.SaHolder;
|
|
|
+import cn.dev33.satoken.stp.StpInterface;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
@@ -125,29 +127,29 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
|
|
|
@Override
|
|
|
public List<TmDepartment> getDeptList() {
|
|
|
- if(StpUtil.isLogin()){
|
|
|
- String userId =(String) StpUtil.getLoginId();
|
|
|
- TmUser tmUser = tmUserService.getById(userId);
|
|
|
- if(tmUser == null){
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
- List<TmUserRole> tmUserRoles = tmUserRoleService.getByUserId(tmUser.getId());
|
|
|
- if(tmUserRoles.size() >0){
|
|
|
- TmUserRole tmUserRole = tmUserRoles.get(0);
|
|
|
- TmRole tmRole = tmRoleService.getById(tmUserRole.getRoleId());
|
|
|
- if(tmRole != null && tmRole.getRoleKey().equals("admin-ordinary")){
|
|
|
- TmDepartment tmDepartment = this.getById(tmUser.getDeptId());
|
|
|
- TmDepartment parentDept = this.getById(tmDepartment.getParentId());
|
|
|
- if(parentDept !=null){
|
|
|
- tmDepartment.setParentName(parentDept.getName());
|
|
|
- }
|
|
|
- return Arrays.asList(tmDepartment);
|
|
|
+ String share = SaHolder.getRequest().getHeader("share");
|
|
|
+ if(StringUtils.isNotBlank(share) && "1".equals(share)){ //分享请求头
|
|
|
+ return getDeptList("0");
|
|
|
+ }
|
|
|
+ String userId =(String) StpUtil.getLoginId();
|
|
|
+ TmUser tmUser = tmUserService.getById(userId);
|
|
|
+ if(tmUser == null){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<TmUserRole> tmUserRoles = tmUserRoleService.getByUserId(tmUser.getId());
|
|
|
+ if(tmUserRoles.size() >0){
|
|
|
+ TmUserRole tmUserRole = tmUserRoles.get(0);
|
|
|
+ TmRole tmRole = tmRoleService.getById(tmUserRole.getRoleId());
|
|
|
+ if(tmRole != null && tmRole.getRoleKey().equals("admin-ordinary")){
|
|
|
+ TmDepartment tmDepartment = this.getById(tmUser.getDeptId());
|
|
|
+ TmDepartment parentDept = this.getById(tmDepartment.getParentId());
|
|
|
+ if(parentDept !=null){
|
|
|
+ tmDepartment.setParentName(parentDept.getName());
|
|
|
}
|
|
|
+ return Arrays.asList(tmDepartment);
|
|
|
}
|
|
|
- return getDeptList(tmUser.getDeptId());
|
|
|
- }else {
|
|
|
- return getDeptList("0");
|
|
|
}
|
|
|
+ return getDeptList(tmUser.getDeptId());
|
|
|
}
|
|
|
|
|
|
public List<TmDepartment> getDeptList(String deptId) {
|