From e0c270ceeead43aa002196b1b14398730242345c Mon Sep 17 00:00:00 2001 From: ly19960718 <1622779752@qq.com> Date: Thu, 10 Jun 2021 16:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE=E5=B0=81?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../departmentBaseController.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java index 9dc3d8a..09f9f25 100644 --- a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java +++ b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java @@ -10,12 +10,14 @@ import ink.wgink.pojo.dtos.department.DepartmentUserDTO; import ink.wgink.pojo.dtos.role.RoleDTO; import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.pos.DepartmentPO; +import ink.wgink.pojo.pos.PositionPO; import ink.wgink.pojo.pos.RolePO; import ink.wgink.pojo.result.ErrorResult; import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.service.department.service.IDepartmentService; import ink.wgink.service.department.service.IDepartmentUserService; import ink.wgink.service.position.service.IPositionService; +import ink.wgink.service.position.service.IPositionUserService; import ink.wgink.service.role.service.IRoleService; import ink.wgink.service.role.service.IRoleUserService; import ink.wgink.service.user.service.IUserService; @@ -54,7 +56,7 @@ public class departmentBaseController extends DefaultBaseController { @Autowired private IUserService userService; @Autowired - private IPositionService positionService; + private IPositionUserService positionUserService; /** @@ -120,7 +122,7 @@ public class departmentBaseController extends DefaultBaseController { List userIds = departmentUserService.listUserId(departmentId, listUsers); list = userService.listByUserIds(userIds); for (UserDTO userDTO : list) { - + this.setUserParams(userDTO); } return list; } @@ -134,6 +136,9 @@ public class departmentBaseController extends DefaultBaseController { List list = new ArrayList<>(); List userIds = departmentUserService.listUserId(departmentId); list = userService.listByUserIds(userIds); + for (UserDTO userDTO : list) { + this.setUserParams(userDTO); + } return list; } @@ -142,11 +147,21 @@ public class departmentBaseController extends DefaultBaseController { @GetMapping("get-by-user-id/{userId}") public UserDTO getByUserId(@PathVariable("userId") String userId){ UserDTO userDTO = userService.get(userId); + this.setUserParams(userDTO); return userDTO; } + private void setUserParams(UserDTO userDTO){ + String positionNames = ""; + List positionPOS = positionUserService.listPositionPOByUserId(userDTO.getUserId()); + for (PositionPO positionPO : positionPOS) { + positionNames += positionPO.getPositionName()+","; + } + userDTO.setPositionNames(positionNames); + } +