|
@@ -125,25 +125,29 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
|
|
|
@Override
|
|
|
public List<TmDepartment> getDeptList() {
|
|
|
- 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());
|
|
|
+ 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);
|
|
|
}
|
|
|
- return Arrays.asList(tmDepartment);
|
|
|
}
|
|
|
+ return getDeptList(tmUser.getDeptId());
|
|
|
+ }else {
|
|
|
+ return getDeptList("0");
|
|
|
}
|
|
|
- return getDeptList(tmUser.getDeptId());
|
|
|
}
|
|
|
|
|
|
public List<TmDepartment> getDeptList(String deptId) {
|