diff --git a/cutejava/cutejava-system/src/main/java/cn/odboy/application/core/service/impl/UserDetailsServiceImpl.java b/cutejava/cutejava-system/src/main/java/cn/odboy/application/core/service/impl/UserDetailsServiceImpl.java index a57ae4a7..fd40aaaa 100644 --- a/cutejava/cutejava-system/src/main/java/cn/odboy/application/core/service/impl/UserDetailsServiceImpl.java +++ b/cutejava/cutejava-system/src/main/java/cn/odboy/application/core/service/impl/UserDetailsServiceImpl.java @@ -37,7 +37,7 @@ public class UserDetailsServiceImpl implements UserDetailsService { // 获取用户的权限 List authorities = roleService.buildPermissions(user); // 初始化JwtUserDto - userJwtModel = new UserJwtModel(user, dataService.selectDeptIdByUserIdWithDeptId(user), authorities); + userJwtModel = new UserJwtModel(user, dataService.describeDeptIdListByUserIdWithDeptId(user), authorities); // 添加缓存数据 userCacheService.cacheUserJwtModelByUserName(username, userJwtModel); } diff --git a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/DeptController.java b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/DeptController.java index 3dfcba51..bba0ca8c 100644 --- a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/DeptController.java +++ b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/DeptController.java @@ -38,14 +38,14 @@ public class DeptController { @GetMapping(value = "/download") @PreAuthorize("@el.check('dept:list')") public void exportDept(HttpServletResponse response, QueryDeptRequest criteria) throws Exception { - deptService.downloadExcel(deptService.selectDeptByCriteria(criteria, false), response); + deptService.downloadDeptExcel(deptService.describeDeptList(criteria, false), response); } @ApiOperation("查询部门") @GetMapping @PreAuthorize("@el.check('user:list','dept:list')") public ResponseEntity> queryDept(QueryDeptRequest criteria) throws Exception { - List depts = deptService.selectDeptByCriteria(criteria, true); + List depts = deptService.describeDeptList(criteria, true); return new ResponseEntity<>(PageUtil.toPage(depts), HttpStatus.OK); } @@ -55,8 +55,8 @@ public class DeptController { public ResponseEntity getDeptSuperior(@RequestBody List ids, @RequestParam(defaultValue = "false") Boolean exclude) { Set deptSet = new LinkedHashSet<>(); for (Long id : ids) { - Dept dept = deptService.getDeptById(id); - List depts = deptService.selectSuperiorDeptByPid(dept, new ArrayList<>()); + Dept dept = deptService.describeDeptById(id); + List depts = deptService.describeSuperiorDeptListByPid(dept, new ArrayList<>()); if (exclude) { for (Dept data : depts) { if (data.getId().equals(dept.getPid())) { @@ -68,7 +68,7 @@ public class DeptController { } deptSet.addAll(depts); } - return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)), HttpStatus.OK); + return new ResponseEntity<>(deptService.buildDeptTree(new ArrayList<>(deptSet)), HttpStatus.OK); } @ApiOperation("新增部门") @@ -83,7 +83,7 @@ public class DeptController { @PostMapping(value = "/updateDept") @PreAuthorize("@el.check('dept:edit')") public ResponseEntity updateDept(@Validated(Dept.Update.class) @RequestBody Dept resources) { - deptService.updateDept(resources); + deptService.modifyDept(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } diff --git a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/UserController.java b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/UserController.java index ad05f40e..31d94692 100644 --- a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/UserController.java +++ b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/rest/UserController.java @@ -75,12 +75,12 @@ public class UserController { if (!ObjectUtils.isEmpty(criteria.getDeptId())) { criteria.getDeptIds().add(criteria.getDeptId()); // 先查找是否存在子节点 - List data = deptService.selectDeptByPid(criteria.getDeptId()); + List data = deptService.describeDeptListByPid(criteria.getDeptId()); // 然后把子节点的ID都加入到集合中 - criteria.getDeptIds().addAll(deptService.selectChildDeptIdByDeptIds(data)); + criteria.getDeptIds().addAll(deptService.describeChildDeptIdListByDeptIds(data)); } // 数据权限 - List dataScopes = dataService.selectDeptIdByUserIdWithDeptId(userService.getUserByUsername(SecurityHelper.getCurrentUsername())); + List dataScopes = dataService.describeDeptIdListByUserIdWithDeptId(userService.getUserByUsername(SecurityHelper.getCurrentUsername())); // criteria.getDeptIds() 不为空并且数据权限不为空则取交集 if (!CollectionUtils.isEmpty(criteria.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)) { // 取交集 diff --git a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DataService.java b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DataService.java index e36b989c..c2009d90 100644 --- a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DataService.java +++ b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DataService.java @@ -15,5 +15,5 @@ public interface DataService { * @param user / * @return / */ - List selectDeptIdByUserIdWithDeptId(User user); + List describeDeptIdListByUserIdWithDeptId(User user); } diff --git a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DeptService.java b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DeptService.java index 9311fabb..f16a5cd4 100644 --- a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DeptService.java +++ b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/DeptService.java @@ -20,7 +20,7 @@ public interface DeptService extends IService { * @return / * @throws Exception / */ - List selectDeptByCriteria(QueryDeptRequest criteria, Boolean isQuery) throws Exception; + List describeDeptList(QueryDeptRequest criteria, Boolean isQuery) throws Exception; /** * 根据ID查询 @@ -28,7 +28,7 @@ public interface DeptService extends IService { * @param id / * @return / */ - Dept getDeptById(Long id); + Dept describeDeptById(Long id); /** * 创建 @@ -42,7 +42,7 @@ public interface DeptService extends IService { * * @param resources / */ - void updateDept(Dept resources); + void modifyDept(Dept resources); /** * 删除 @@ -57,7 +57,7 @@ public interface DeptService extends IService { * @param pid / * @return / */ - List selectDeptByPid(long pid); + List describeDeptListByPid(long pid); /** * 根据角色ID查询 @@ -65,7 +65,7 @@ public interface DeptService extends IService { * @param id / * @return / */ - Set selectDeptByRoleId(Long id); + Set describeDeptByRoleId(Long id); /** * 导出数据 @@ -74,7 +74,7 @@ public interface DeptService extends IService { * @param response / * @throws IOException / */ - void downloadExcel(List depts, HttpServletResponse response) throws IOException; + void downloadDeptExcel(List depts, HttpServletResponse response) throws IOException; /** * 获取部门下所有关联的部门 @@ -83,7 +83,7 @@ public interface DeptService extends IService { * @param depts / * @return / */ - Set selectRelationDept(List deptList, Set depts); + Set describeRelationDeptSet(List deptList, Set depts); /** * 根据ID获取同级与上级数据 @@ -92,7 +92,7 @@ public interface DeptService extends IService { * @param depts / * @return / */ - List selectSuperiorDeptByPid(Dept dept, List depts); + List describeSuperiorDeptListByPid(Dept dept, List depts); /** * 构建树形数据 @@ -100,7 +100,7 @@ public interface DeptService extends IService { * @param depts / * @return / */ - BaseResult buildTree(List depts); + BaseResult buildDeptTree(List depts); /** * 获取 @@ -108,7 +108,7 @@ public interface DeptService extends IService { * @param deptList 、 * @return 、 */ - List selectChildDeptIdByDeptIds(List deptList); + List describeChildDeptIdListByDeptIds(List deptList); /** * 验证是否被角色或用户关联 diff --git a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DataServiceImpl.java b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DataServiceImpl.java index 88aed0f0..7e69dc0c 100644 --- a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DataServiceImpl.java +++ b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DataServiceImpl.java @@ -36,7 +36,7 @@ public class DataServiceImpl implements DataService { * @return / */ @Override - public List selectDeptIdByUserIdWithDeptId(User user) { + public List describeDeptIdListByUserIdWithDeptId(User user) { String key = SystemRedisKey.DATA_USER + user.getId(); List ids = redisHelper.getList(key, Long.class); if (CollUtil.isEmpty(ids)) { @@ -71,12 +71,12 @@ public class DataServiceImpl implements DataService { * @return 数据权限ID */ public Set getCustomize(Set deptIds, Role role) { - Set deptList = deptService.selectDeptByRoleId(role.getId()); + Set deptList = deptService.describeDeptByRoleId(role.getId()); for (Dept dept : deptList) { deptIds.add(dept.getId()); - List deptChildren = deptService.selectDeptByPid(dept.getId()); + List deptChildren = deptService.describeDeptListByPid(dept.getId()); if (CollUtil.isNotEmpty(deptChildren)) { - deptIds.addAll(deptService.selectChildDeptIdByDeptIds(deptChildren)); + deptIds.addAll(deptService.describeChildDeptIdListByDeptIds(deptChildren)); } } return deptIds; diff --git a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DeptServiceImpl.java b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DeptServiceImpl.java index af94f658..d26689eb 100644 --- a/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DeptServiceImpl.java +++ b/cutejava/cutejava-system/src/main/java/cn/odboy/application/system/service/impl/DeptServiceImpl.java @@ -46,7 +46,7 @@ public class DeptServiceImpl extends ServiceImpl implements De private final RedisHelper redisHelper; @Override - public List selectDeptByCriteria(QueryDeptRequest criteria, Boolean isQuery) throws Exception { + public List describeDeptList(QueryDeptRequest criteria, Boolean isQuery) throws Exception { String dataScopeType = SecurityHelper.getDataScopeType(); if (isQuery) { if (dataScopeType.equals(DataScopeEnum.ALL.getValue())) { @@ -81,7 +81,7 @@ public class DeptServiceImpl extends ServiceImpl implements De } @Override - public Dept getDeptById(Long id) { + public Dept describeDeptById(Long id) { String key = SystemRedisKey.DEPT_ID + id; Dept dept = redisHelper.get(key, Dept.class); if (dept == null) { @@ -92,12 +92,12 @@ public class DeptServiceImpl extends ServiceImpl implements De } @Override - public List selectDeptByPid(long pid) { + public List describeDeptListByPid(long pid) { return deptMapper.queryDeptListByPid(pid); } @Override - public Set selectDeptByRoleId(Long id) { + public Set describeDeptByRoleId(Long id) { return deptMapper.queryDeptSetByRoleId(id); } @@ -113,9 +113,9 @@ public class DeptServiceImpl extends ServiceImpl implements De @Override @Transactional(rollbackFor = Exception.class) - public void updateDept(Dept resources) { + public void modifyDept(Dept resources) { // 旧的部门 - Long oldPid = getDeptById(resources.getId()).getPid(); + Long oldPid = describeDeptById(resources.getId()).getPid(); Long newPid = resources.getPid(); if (resources.getPid() != null && resources.getId().equals(resources.getPid())) { throw new BadRequestException("上级不能为自己"); @@ -142,7 +142,7 @@ public class DeptServiceImpl extends ServiceImpl implements De } @Override - public void downloadExcel(List deptList, HttpServletResponse response) throws IOException { + public void downloadDeptExcel(List deptList, HttpServletResponse response) throws IOException { List> list = new ArrayList<>(); for (Dept dept : deptList) { Map map = new LinkedHashMap<>(); @@ -155,25 +155,25 @@ public class DeptServiceImpl extends ServiceImpl implements De } @Override - public Set selectRelationDept(List menuList, Set deptSet) { + public Set describeRelationDeptSet(List menuList, Set deptSet) { for (Dept dept : menuList) { deptSet.add(dept); List deptList = deptMapper.queryDeptListByPid(dept.getId()); if (CollUtil.isNotEmpty(deptList)) { - selectRelationDept(deptList, deptSet); + describeRelationDeptSet(deptList, deptSet); } } return deptSet; } @Override - public List selectChildDeptIdByDeptIds(List deptList) { + public List describeChildDeptIdListByDeptIds(List deptList) { List list = new ArrayList<>(); deptList.forEach(dept -> { if (dept != null && dept.getEnabled()) { List deptList1 = deptMapper.queryDeptListByPid(dept.getId()); if (CollUtil.isNotEmpty(deptList1)) { - list.addAll(selectChildDeptIdByDeptIds(deptList1)); + list.addAll(describeChildDeptIdListByDeptIds(deptList1)); } list.add(dept.getId()); } @@ -183,17 +183,17 @@ public class DeptServiceImpl extends ServiceImpl implements De } @Override - public List selectSuperiorDeptByPid(Dept dept, List deptList) { + public List describeSuperiorDeptListByPid(Dept dept, List deptList) { if (dept.getPid() == null) { deptList.addAll(deptMapper.queryDeptListByPidIsNull()); return deptList; } deptList.addAll(deptMapper.queryDeptListByPid(dept.getPid())); - return selectSuperiorDeptByPid(getDeptById(dept.getPid()), deptList); + return describeSuperiorDeptListByPid(describeDeptById(dept.getPid()), deptList); } @Override - public BaseResult buildTree(List deptList) { + public BaseResult buildDeptTree(List deptList) { Set trees = new LinkedHashSet<>(); Set deptSet = new LinkedHashSet<>(); List deptNames = deptList.stream().map(Dept::getName).collect(Collectors.toList()); @@ -214,7 +214,7 @@ public class DeptServiceImpl extends ServiceImpl implements De } if (isChild) { deptSet.add(dept); - } else if (dept.getPid() != null && !deptNames.contains(getDeptById(dept.getPid()).getName())) { + } else if (dept.getPid() != null && !deptNames.contains(describeDeptById(dept.getPid()).getName())) { deptSet.add(dept); } } @@ -242,11 +242,11 @@ public class DeptServiceImpl extends ServiceImpl implements De public void traverseDeptByIdWithPids(Set ids, Set depts) { for (Long id : ids) { // 根部门 - depts.add(getDeptById(id)); + depts.add(describeDeptById(id)); // 子部门 - List deptList = selectDeptByPid(id); + List deptList = describeDeptListByPid(id); if (CollectionUtil.isNotEmpty(deptList)) { - depts = selectRelationDept(deptList, depts); + depts = describeRelationDeptSet(deptList, depts); } } }