新增接口 机构用户数据封装

This commit is contained in:
ly19960718 2021-06-10 16:56:30 +08:00
parent cd150f58eb
commit e0c270ceee

View File

@ -10,12 +10,14 @@ import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
import ink.wgink.pojo.dtos.role.RoleDTO; import ink.wgink.pojo.dtos.role.RoleDTO;
import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.pos.DepartmentPO; import ink.wgink.pojo.pos.DepartmentPO;
import ink.wgink.pojo.pos.PositionPO;
import ink.wgink.pojo.pos.RolePO; import ink.wgink.pojo.pos.RolePO;
import ink.wgink.pojo.result.ErrorResult; import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.service.department.service.IDepartmentService; import ink.wgink.service.department.service.IDepartmentService;
import ink.wgink.service.department.service.IDepartmentUserService; import ink.wgink.service.department.service.IDepartmentUserService;
import ink.wgink.service.position.service.IPositionService; 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.IRoleService;
import ink.wgink.service.role.service.IRoleUserService; import ink.wgink.service.role.service.IRoleUserService;
import ink.wgink.service.user.service.IUserService; import ink.wgink.service.user.service.IUserService;
@ -54,7 +56,7 @@ public class departmentBaseController extends DefaultBaseController {
@Autowired @Autowired
private IUserService userService; private IUserService userService;
@Autowired @Autowired
private IPositionService positionService; private IPositionUserService positionUserService;
/** /**
@ -120,7 +122,7 @@ public class departmentBaseController extends DefaultBaseController {
List<String> userIds = departmentUserService.listUserId(departmentId, listUsers); List<String> userIds = departmentUserService.listUserId(departmentId, listUsers);
list = userService.listByUserIds(userIds); list = userService.listByUserIds(userIds);
for (UserDTO userDTO : list) { for (UserDTO userDTO : list) {
this.setUserParams(userDTO);
} }
return list; return list;
} }
@ -134,6 +136,9 @@ public class departmentBaseController extends DefaultBaseController {
List<UserDTO> list = new ArrayList<>(); List<UserDTO> list = new ArrayList<>();
List<String> userIds = departmentUserService.listUserId(departmentId); List<String> userIds = departmentUserService.listUserId(departmentId);
list = userService.listByUserIds(userIds); list = userService.listByUserIds(userIds);
for (UserDTO userDTO : list) {
this.setUserParams(userDTO);
}
return list; return list;
} }
@ -142,11 +147,21 @@ public class departmentBaseController extends DefaultBaseController {
@GetMapping("get-by-user-id/{userId}") @GetMapping("get-by-user-id/{userId}")
public UserDTO getByUserId(@PathVariable("userId") String userId){ public UserDTO getByUserId(@PathVariable("userId") String userId){
UserDTO userDTO = userService.get(userId); UserDTO userDTO = userService.get(userId);
this.setUserParams(userDTO);
return userDTO; return userDTO;
} }
private void setUserParams(UserDTO userDTO){
String positionNames = "";
List<PositionPO> positionPOS = positionUserService.listPositionPOByUserId(userDTO.getUserId());
for (PositionPO positionPO : positionPOS) {
positionNames += positionPO.getPositionName()+",";
}
userDTO.setPositionNames(positionNames);
}