Commit b33302791198d4d29a5784e5e1605aa7dc6345e9
1 parent
26f0664e
增加接口
Showing
5 changed files
with
168 additions
and
13 deletions
itcast-auth/itcast-auth-server/src/main/java/com/itheima/authority/biz/service/auth/UserService.java
| @@ -2,6 +2,7 @@ package com.itheima.authority.biz.service.auth; | @@ -2,6 +2,7 @@ package com.itheima.authority.biz.service.auth; | ||
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.core.metadata.IPage; | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 4 | import com.baomidou.mybatisplus.extension.service.IService; | 4 | import com.baomidou.mybatisplus.extension.service.IService; |
| 5 | +import com.itheima.authority.dto.auth.HierarchyDTO; | ||
| 5 | import com.itheima.authority.dto.auth.LoginDTO; | 6 | import com.itheima.authority.dto.auth.LoginDTO; |
| 6 | import com.itheima.authority.dto.auth.UserUpdatePasswordDTO; | 7 | import com.itheima.authority.dto.auth.UserUpdatePasswordDTO; |
| 7 | import com.itheima.authority.entity.auth.User; | 8 | import com.itheima.authority.entity.auth.User; |
| @@ -50,4 +51,6 @@ public interface UserService extends IService<User> { | @@ -50,4 +51,6 @@ public interface UserService extends IService<User> { | ||
| 50 | void updateUserRole(User user); | 51 | void updateUserRole(User user); |
| 51 | 52 | ||
| 52 | R<LoginDTO> current(); | 53 | R<LoginDTO> current(); |
| 54 | + | ||
| 55 | + HierarchyDTO findHierarchy(Long id); | ||
| 53 | } | 56 | } |
itcast-auth/itcast-auth-server/src/main/java/com/itheima/authority/biz/service/auth/impl/UserServiceImpl.java
| @@ -15,10 +15,7 @@ import com.itheima.authority.biz.service.auth.UserRoleService; | @@ -15,10 +15,7 @@ import com.itheima.authority.biz.service.auth.UserRoleService; | ||
| 15 | import com.itheima.authority.biz.service.auth.UserService; | 15 | import com.itheima.authority.biz.service.auth.UserService; |
| 16 | import com.itheima.authority.biz.service.core.OrgService; | 16 | import com.itheima.authority.biz.service.core.OrgService; |
| 17 | import com.itheima.authority.biz.service.core.StationService; | 17 | import com.itheima.authority.biz.service.core.StationService; |
| 18 | -import com.itheima.authority.dto.auth.LoginDTO; | ||
| 19 | -import com.itheima.authority.dto.auth.ResourceQueryDTO; | ||
| 20 | -import com.itheima.authority.dto.auth.UserDTO; | ||
| 21 | -import com.itheima.authority.dto.auth.UserUpdatePasswordDTO; | 18 | +import com.itheima.authority.dto.auth.*; |
| 22 | import com.itheima.authority.entity.auth.*; | 19 | import com.itheima.authority.entity.auth.*; |
| 23 | import com.itheima.authority.entity.core.Org; | 20 | import com.itheima.authority.entity.core.Org; |
| 24 | import com.itheima.authority.entity.core.Station; | 21 | import com.itheima.authority.entity.core.Station; |
| @@ -31,11 +28,14 @@ import com.itheima.tools.database.mybatis.auth.DataScopeType; | @@ -31,11 +28,14 @@ import com.itheima.tools.database.mybatis.auth.DataScopeType; | ||
| 31 | import com.itheima.tools.database.mybatis.conditions.Wraps; | 28 | import com.itheima.tools.database.mybatis.conditions.Wraps; |
| 32 | import com.itheima.tools.database.mybatis.conditions.query.LbqWrapper; | 29 | import com.itheima.tools.database.mybatis.conditions.query.LbqWrapper; |
| 33 | import com.itheima.tools.dozer.DozerUtils; | 30 | import com.itheima.tools.dozer.DozerUtils; |
| 31 | +import com.itheima.tools.exception.BizException; | ||
| 32 | +import com.itheima.tools.exception.code.ExceptionCode; | ||
| 34 | import com.itheima.tools.utils.BizAssert; | 33 | import com.itheima.tools.utils.BizAssert; |
| 35 | import lombok.SneakyThrows; | 34 | import lombok.SneakyThrows; |
| 36 | import lombok.extern.slf4j.Slf4j; | 35 | import lombok.extern.slf4j.Slf4j; |
| 37 | import org.apache.commons.codec.digest.DigestUtils; | 36 | import org.apache.commons.codec.digest.DigestUtils; |
| 38 | import org.apache.commons.lang3.StringUtils; | 37 | import org.apache.commons.lang3.StringUtils; |
| 38 | +import org.springframework.beans.BeanUtils; | ||
| 39 | import org.springframework.beans.factory.annotation.Autowired; | 39 | import org.springframework.beans.factory.annotation.Autowired; |
| 40 | import org.springframework.stereotype.Service; | 40 | import org.springframework.stereotype.Service; |
| 41 | import org.springframework.util.CollectionUtils; | 41 | import org.springframework.util.CollectionUtils; |
| @@ -237,6 +237,98 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | @@ -237,6 +237,98 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | ||
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | /** | 239 | /** |
| 240 | + * 获取人员关系结构 | ||
| 241 | + * | ||
| 242 | + * @param id | ||
| 243 | + * @return | ||
| 244 | + */ | ||
| 245 | + @Override | ||
| 246 | + public HierarchyDTO findHierarchy(Long id) { | ||
| 247 | + HierarchyDTO hierarchyDTO = new HierarchyDTO(); | ||
| 248 | + User user = this.getById(id); | ||
| 249 | + Station station = stationService.getById(user.getStationId()); | ||
| 250 | + if (station != null) { | ||
| 251 | + user.setStationName(station.getName()); | ||
| 252 | + } | ||
| 253 | + log.info("当前用户:{}", user); | ||
| 254 | + Stack<User> stack = new Stack<>(); | ||
| 255 | + getSuperiorStack(stack, user, 1); | ||
| 256 | + | ||
| 257 | + List<User> list = new ArrayList<>(); | ||
| 258 | + getDownwardList(list, user); | ||
| 259 | + | ||
| 260 | + buildTree(stack, list, hierarchyDTO); | ||
| 261 | + return hierarchyDTO; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + private void buildTree(Stack<User> stack, List<User> list, HierarchyDTO hierarchyDTO) { | ||
| 265 | + if (stack == null || stack.size() == 0) { | ||
| 266 | + return; | ||
| 267 | + } | ||
| 268 | + User user = stack.pop(); | ||
| 269 | + if (stack.size() == 0) { | ||
| 270 | + BeanUtils.copyProperties(user, hierarchyDTO); | ||
| 271 | + hierarchyDTO.setSelf(true); | ||
| 272 | + hierarchyDTO.setChildren(list.stream().map(item -> { | ||
| 273 | + HierarchyDTO hierarchy = new HierarchyDTO(); | ||
| 274 | + BeanUtils.copyProperties(item, hierarchy); | ||
| 275 | + return hierarchy; | ||
| 276 | + }).collect(Collectors.toList())); | ||
| 277 | + } else { | ||
| 278 | + BeanUtils.copyProperties(user, hierarchyDTO); | ||
| 279 | + | ||
| 280 | + HierarchyDTO hierarchy = new HierarchyDTO(); | ||
| 281 | + hierarchyDTO.setChildren(Arrays.asList(new HierarchyDTO[]{hierarchy})); | ||
| 282 | + | ||
| 283 | + buildTree(stack, list, hierarchy); | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + /** | ||
| 289 | + * 获取下级的员工集合 | ||
| 290 | + * | ||
| 291 | + * @param list | ||
| 292 | + * @param user | ||
| 293 | + */ | ||
| 294 | + private void getDownwardList(List<User> list, User user) { | ||
| 295 | + LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>(); | ||
| 296 | + wrapper.eq(User::getSuperior, user.getId()); | ||
| 297 | + List<User> users = this.list(wrapper); | ||
| 298 | + list.addAll(users.stream().map(item -> { | ||
| 299 | + Station station = stationService.getById(item.getStationId()); | ||
| 300 | + if (station != null) { | ||
| 301 | + item.setStationName(station.getName()); | ||
| 302 | + } | ||
| 303 | + return item; | ||
| 304 | + }).collect(Collectors.toList())); | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + /** | ||
| 308 | + * 获取上级关系,默认最多20级,防止内存泄露 | ||
| 309 | + * | ||
| 310 | + * @param stack | ||
| 311 | + * @param user | ||
| 312 | + * @param depth | ||
| 313 | + */ | ||
| 314 | + private void getSuperiorStack(Stack stack, User user, int depth) { | ||
| 315 | + stack.add(user); | ||
| 316 | + if (depth > 20) { | ||
| 317 | + return; | ||
| 318 | + } | ||
| 319 | + Long superior = user.getSuperior(); | ||
| 320 | + if (null == superior || superior < 0L) { | ||
| 321 | + return; | ||
| 322 | + } | ||
| 323 | + User userSuperior = this.getById(superior); | ||
| 324 | + Station station = stationService.getById(userSuperior.getStationId()); | ||
| 325 | + if (station != null) { | ||
| 326 | + userSuperior.setStationName(station.getName()); | ||
| 327 | + } | ||
| 328 | + getSuperiorStack(stack, userSuperior, ++depth); | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + /** | ||
| 240 | * 修改密码 | 332 | * 修改密码 |
| 241 | * | 333 | * |
| 242 | * @param data | 334 | * @param data |
| @@ -356,6 +448,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | @@ -356,6 +448,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | ||
| 356 | 448 | ||
| 357 | user.setPassword(DigestUtils.md5Hex(user.getPassword())); | 449 | user.setPassword(DigestUtils.md5Hex(user.getPassword())); |
| 358 | user.setPasswordErrorNum(0); | 450 | user.setPasswordErrorNum(0); |
| 451 | + | ||
| 452 | + if (user.getSuperior() == null) { | ||
| 453 | + user.setSuperior(-1L); | ||
| 454 | + } | ||
| 455 | + | ||
| 359 | super.save(user); | 456 | super.save(user); |
| 360 | 457 | ||
| 361 | List<Long> roles = user.getRoles(); | 458 | List<Long> roles = user.getRoles(); |
| @@ -405,6 +502,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | @@ -405,6 +502,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | ||
| 405 | if (StrUtil.isNotEmpty(user.getPassword())) { | 502 | if (StrUtil.isNotEmpty(user.getPassword())) { |
| 406 | user.setPassword(DigestUtils.md5Hex(user.getPassword())); | 503 | user.setPassword(DigestUtils.md5Hex(user.getPassword())); |
| 407 | } | 504 | } |
| 505 | + User userDb = this.getById(user); | ||
| 506 | + if (user.getSuperior() != null) { | ||
| 507 | + if (!user.getSuperior().equals(userDb.getSuperior())) { | ||
| 508 | + boolean flag = checkSuperior(user.getSuperior(), user.getId()); | ||
| 509 | + if (!flag) { | ||
| 510 | + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(), "直属上级已经是当前用户的下属!"); | ||
| 511 | + } | ||
| 512 | + } | ||
| 513 | + } else { | ||
| 514 | + user.setSuperior(-1L); | ||
| 515 | + } | ||
| 408 | super.updateById(user); | 516 | super.updateById(user); |
| 409 | 517 | ||
| 410 | updateUserRole(user); | 518 | updateUserRole(user); |
| @@ -425,4 +533,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | @@ -425,4 +533,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us | ||
| 425 | ); | 533 | ); |
| 426 | return super.removeByIds(ids); | 534 | return super.removeByIds(ids); |
| 427 | } | 535 | } |
| 536 | + | ||
| 537 | + private boolean checkSuperior(Long superiorId, Long userId) { | ||
| 538 | + if (userId.equals(superiorId)) { | ||
| 539 | + return false; | ||
| 540 | + } | ||
| 541 | + LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>(); | ||
| 542 | + wrapper.eq(User::getSuperior, userId); | ||
| 543 | + List<User> users = this.list(wrapper); | ||
| 544 | + for (User user : users) { | ||
| 545 | + if (user.getId().equals(superiorId)) { | ||
| 546 | + return false; | ||
| 547 | + } else { | ||
| 548 | + boolean flag = checkSuperior(superiorId, user.getId()); | ||
| 549 | + if (!flag) { | ||
| 550 | + return false; | ||
| 551 | + } | ||
| 552 | + } | ||
| 553 | + } | ||
| 554 | + return true; | ||
| 555 | + } | ||
| 428 | } | 556 | } |
itcast-auth/itcast-auth-server/src/main/java/com/itheima/authority/biz/strategy/impl/CustomizeDataScope.java
| @@ -24,7 +24,7 @@ public class CustomizeDataScope implements AbstractDataScopeHandler { | @@ -24,7 +24,7 @@ public class CustomizeDataScope implements AbstractDataScopeHandler { | ||
| 24 | @Override | 24 | @Override |
| 25 | public List<Long> getOrgIds(List<Long> orgList, Long userId) { | 25 | public List<Long> getOrgIds(List<Long> orgList, Long userId) { |
| 26 | if (orgList == null || orgList.isEmpty()) { | 26 | if (orgList == null || orgList.isEmpty()) { |
| 27 | - throw new BizException(ExceptionCode.BASE_VALID_PARAM.getCode(), "自定义数据权限类型时,组织不能为空"); | 27 | + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(), "自定义数据权限类型时,组织不能为空"); |
| 28 | } | 28 | } |
| 29 | for (Long org : orgList) { | 29 | for (Long org : orgList) { |
| 30 | List<Org> children = orgService.findChildren(org); | 30 | List<Org> children = orgService.findChildren(org); |
itcast-auth/itcast-auth-server/src/main/java/com/itheima/authority/controller/auth/RoleController.java
| @@ -173,7 +173,7 @@ public class RoleController extends BaseController { | @@ -173,7 +173,7 @@ public class RoleController extends BaseController { | ||
| 173 | 173 | ||
| 174 | 174 | ||
| 175 | @ApiOperation(value = "给角色配置权限", notes = "给角色配置权限") | 175 | @ApiOperation(value = "给角色配置权限", notes = "给角色配置权限") |
| 176 | - @PostMapping("/authority") | 176 | + @PutMapping("/authority") |
| 177 | @SysLog("给角色配置权限") | 177 | @SysLog("给角色配置权限") |
| 178 | public R<Boolean> saveRoleAuthority(@RequestBody RoleAuthoritySaveDTO roleAuthoritySaveDTO) { | 178 | public R<Boolean> saveRoleAuthority(@RequestBody RoleAuthoritySaveDTO roleAuthoritySaveDTO) { |
| 179 | return success(roleAuthorityService.saveRoleAuthority(roleAuthoritySaveDTO)); | 179 | return success(roleAuthorityService.saveRoleAuthority(roleAuthoritySaveDTO)); |
itcast-auth/itcast-auth-server/src/main/java/com/itheima/authority/controller/auth/UserController.java
| @@ -2,12 +2,16 @@ package com.itheima.authority.controller.auth; | @@ -2,12 +2,16 @@ package com.itheima.authority.controller.auth; | ||
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 4 | import com.itheima.authority.biz.service.auth.RoleService; | 4 | import com.itheima.authority.biz.service.auth.RoleService; |
| 5 | +import com.itheima.authority.biz.service.auth.UserGroupService; | ||
| 6 | +import com.itheima.authority.biz.service.auth.UserGroupUserService; | ||
| 5 | import com.itheima.authority.biz.service.auth.UserService; | 7 | import com.itheima.authority.biz.service.auth.UserService; |
| 6 | import com.itheima.authority.biz.service.core.OrgService; | 8 | import com.itheima.authority.biz.service.core.OrgService; |
| 7 | import com.itheima.authority.biz.service.core.StationService; | 9 | import com.itheima.authority.biz.service.core.StationService; |
| 8 | import com.itheima.authority.dto.auth.*; | 10 | import com.itheima.authority.dto.auth.*; |
| 9 | import com.itheima.authority.entity.auth.Role; | 11 | import com.itheima.authority.entity.auth.Role; |
| 10 | import com.itheima.authority.entity.auth.User; | 12 | import com.itheima.authority.entity.auth.User; |
| 13 | +import com.itheima.authority.entity.auth.UserGroup; | ||
| 14 | +import com.itheima.authority.entity.auth.UserGroupUser; | ||
| 11 | import com.itheima.authority.entity.core.Org; | 15 | import com.itheima.authority.entity.core.Org; |
| 12 | import com.itheima.authority.entity.core.Station; | 16 | import com.itheima.authority.entity.core.Station; |
| 13 | import com.itheima.authority.vo.ImportResultVO; | 17 | import com.itheima.authority.vo.ImportResultVO; |
| @@ -18,11 +22,6 @@ import com.itheima.tools.database.mybatis.conditions.Wraps; | @@ -18,11 +22,6 @@ import com.itheima.tools.database.mybatis.conditions.Wraps; | ||
| 18 | import com.itheima.tools.database.mybatis.conditions.query.LbqWrapper; | 22 | import com.itheima.tools.database.mybatis.conditions.query.LbqWrapper; |
| 19 | import com.itheima.tools.dozer.DozerUtils; | 23 | import com.itheima.tools.dozer.DozerUtils; |
| 20 | import com.itheima.tools.log.annotation.SysLog; | 24 | import com.itheima.tools.log.annotation.SysLog; |
| 21 | -import com.itheima.tools.user.feign.UserQuery; | ||
| 22 | -import com.itheima.tools.user.model.SysOrg; | ||
| 23 | -import com.itheima.tools.user.model.SysRole; | ||
| 24 | -import com.itheima.tools.user.model.SysStation; | ||
| 25 | -import com.itheima.tools.user.model.SysUser; | ||
| 26 | import io.swagger.annotations.Api; | 25 | import io.swagger.annotations.Api; |
| 27 | import io.swagger.annotations.ApiImplicitParam; | 26 | import io.swagger.annotations.ApiImplicitParam; |
| 28 | import io.swagger.annotations.ApiImplicitParams; | 27 | import io.swagger.annotations.ApiImplicitParams; |
| @@ -35,12 +34,13 @@ import org.springframework.validation.annotation.Validated; | @@ -35,12 +34,13 @@ import org.springframework.validation.annotation.Validated; | ||
| 35 | import org.springframework.web.bind.annotation.*; | 34 | import org.springframework.web.bind.annotation.*; |
| 36 | import org.springframework.web.multipart.MultipartFile; | 35 | import org.springframework.web.multipart.MultipartFile; |
| 37 | 36 | ||
| 37 | +import java.util.Collection; | ||
| 38 | import java.util.HashMap; | 38 | import java.util.HashMap; |
| 39 | import java.util.List; | 39 | import java.util.List; |
| 40 | import java.util.Map; | 40 | import java.util.Map; |
| 41 | import java.util.stream.Collectors; | 41 | import java.util.stream.Collectors; |
| 42 | 42 | ||
| 43 | -import static com.itheima.tools.exception.code.ExceptionCode.BASE_VALID_PARAM; | 43 | +import static com.itheima.tools.exception.code.ExceptionCode.BAD_REQUEST; |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | * <p> | 46 | * <p> |
| @@ -58,6 +58,10 @@ public class UserController extends BaseController { | @@ -58,6 +58,10 @@ public class UserController extends BaseController { | ||
| 58 | @Autowired | 58 | @Autowired |
| 59 | private UserService userService; | 59 | private UserService userService; |
| 60 | @Autowired | 60 | @Autowired |
| 61 | + private UserGroupService userGroupService; | ||
| 62 | + @Autowired | ||
| 63 | + private UserGroupUserService userGroupUserService; | ||
| 64 | + @Autowired | ||
| 61 | private OrgService orgService; | 65 | private OrgService orgService; |
| 62 | @Autowired | 66 | @Autowired |
| 63 | private RoleService roleService; | 67 | private RoleService roleService; |
| @@ -182,6 +186,9 @@ public class UserController extends BaseController { | @@ -182,6 +186,9 @@ public class UserController extends BaseController { | ||
| 182 | @SysLog("查询用户") | 186 | @SysLog("查询用户") |
| 183 | public R<User> get(@PathVariable Long id) { | 187 | public R<User> get(@PathVariable Long id) { |
| 184 | User item = userService.getById(id); | 188 | User item = userService.getById(id); |
| 189 | + if (null == item) { | ||
| 190 | + return success(null); | ||
| 191 | + } | ||
| 185 | List<Role> role = roleService.findRoleByUserId(item.getId()); | 192 | List<Role> role = roleService.findRoleByUserId(item.getId()); |
| 186 | if (!CollectionUtils.isEmpty(role)) { | 193 | if (!CollectionUtils.isEmpty(role)) { |
| 187 | List<String> roleNames = role.stream().map(roleItem -> roleItem.getName()).collect(Collectors.toList()); | 194 | List<String> roleNames = role.stream().map(roleItem -> roleItem.getName()).collect(Collectors.toList()); |
| @@ -197,6 +204,15 @@ public class UserController extends BaseController { | @@ -197,6 +204,15 @@ public class UserController extends BaseController { | ||
| 197 | if (org != null) { | 204 | if (org != null) { |
| 198 | item.setOrgName(org.getName()); | 205 | item.setOrgName(org.getName()); |
| 199 | } | 206 | } |
| 207 | + List<UserGroupUser> userGroupUsers = userGroupUserService.getGroupByUserId(item.getId()); | ||
| 208 | + if (!CollectionUtils.isEmpty(userGroupUsers)) { | ||
| 209 | + List<Long> groupIds = userGroupUsers.stream().map(UserGroupUser::getGroupId).collect(Collectors.toList()); | ||
| 210 | + Collection<UserGroup> userGroups = userGroupService.listByIds(groupIds); | ||
| 211 | + if (!CollectionUtils.isEmpty(userGroups)) { | ||
| 212 | + List<String> userGroupsNames = userGroups.stream().map(UserGroup::getName).collect(Collectors.toList()); | ||
| 213 | + item.setUserGroupsNames(userGroupsNames); | ||
| 214 | + } | ||
| 215 | + } | ||
| 200 | log.info("getById({}) result:{}", id, item); | 216 | log.info("getById({}) result:{}", id, item); |
| 201 | return success(item); | 217 | return success(item); |
| 202 | } | 218 | } |
| @@ -289,7 +305,7 @@ public class UserController extends BaseController { | @@ -289,7 +305,7 @@ public class UserController extends BaseController { | ||
| 289 | @ApiOperation("导入") | 305 | @ApiOperation("导入") |
| 290 | public R<? extends Object> importExcel(@RequestParam(value = "file") MultipartFile file) { | 306 | public R<? extends Object> importExcel(@RequestParam(value = "file") MultipartFile file) { |
| 291 | if (file.isEmpty()) { | 307 | if (file.isEmpty()) { |
| 292 | - return fail(BASE_VALID_PARAM.build("导入内容为空")); | 308 | + return fail(BAD_REQUEST.build("导入内容为空")); |
| 293 | } | 309 | } |
| 294 | Long begin = System.currentTimeMillis(); | 310 | Long begin = System.currentTimeMillis(); |
| 295 | ImportResultVO importResultVO = userService.importExcel(file); | 311 | ImportResultVO importResultVO = userService.importExcel(file); |
| @@ -300,6 +316,14 @@ public class UserController extends BaseController { | @@ -300,6 +316,14 @@ public class UserController extends BaseController { | ||
| 300 | return R.success(importResultVO); | 316 | return R.success(importResultVO); |
| 301 | } | 317 | } |
| 302 | 318 | ||
| 319 | + @ApiOperation(value = "查询用户上下级结构", notes = "查询用户上下级结构") | ||
| 320 | + @GetMapping("hierarchy/{id}") | ||
| 321 | + @SysLog("查询用户上下级结构") | ||
| 322 | + public R<HierarchyDTO> hierarchy(@PathVariable Long id) { | ||
| 323 | + HierarchyDTO hierarchyDTO = userService.findHierarchy(id); | ||
| 324 | + return success(hierarchyDTO); | ||
| 325 | + } | ||
| 326 | + | ||
| 303 | /** | 327 | /** |
| 304 | * 获取当前登录信息 | 328 | * 获取当前登录信息 |
| 305 | * | 329 | * |