diff --git a/src/main/java/com/chint/application/dtos/system/RolePageDto.java b/src/main/java/com/chint/application/dtos/system/RolePageDto.java index 6f95071f..313a3130 100644 --- a/src/main/java/com/chint/application/dtos/system/RolePageDto.java +++ b/src/main/java/com/chint/application/dtos/system/RolePageDto.java @@ -1,6 +1,7 @@ package com.chint.application.dtos.system; import com.chint.domain.aggregates.standards.StaffRank; +import com.chint.route.entity.UserDepartmentInfoBasic; import lombok.Data; import java.util.List; @@ -12,4 +13,5 @@ public class RolePageDto { private Long userId; List roleUserDtos; List staffRanks; + List departments; } diff --git a/src/main/java/com/chint/application/system/UserController.java b/src/main/java/com/chint/application/system/UserController.java index e56e1d43..e426e3a6 100644 --- a/src/main/java/com/chint/application/system/UserController.java +++ b/src/main/java/com/chint/application/system/UserController.java @@ -171,7 +171,7 @@ public class UserController { } - @ApiOperation("用户角色分页查询") + @ApiOperation("用户信息分页查询") @PostMapping("/role/pageQuery") public Result> rolePageQuery(@RequestBody RolePageQuery rolePageQuery) { return Result.Success(SUCCESS, userDomainService.userPageQuery(rolePageQuery)); diff --git a/src/main/java/com/chint/domain/service/UserDomainService.java b/src/main/java/com/chint/domain/service/UserDomainService.java index b68a90f2..d841917a 100644 --- a/src/main/java/com/chint/domain/service/UserDomainService.java +++ b/src/main/java/com/chint/domain/service/UserDomainService.java @@ -7,12 +7,13 @@ import com.chint.domain.aggregates.standards.StaffRank; import com.chint.domain.aggregates.user.Role; import com.chint.domain.aggregates.user.RoleUser; import com.chint.domain.aggregates.user.User; -import com.chint.domain.repository.RoleRepository; import com.chint.infrastructure.repository.jdbc.JdbcRoleRepository; import com.chint.infrastructure.repository.jdbc.JdbcRoleUserRepository; import com.chint.infrastructure.repository.jdbc.JdbcStaffRankRepository; import com.chint.infrastructure.repository.jdbc.JdbcUserRepository; import com.chint.infrastructure.util.PageResult; +import com.chint.route.entity.UserDepartmentInfoBasic; +import com.chint.route.mapper.JdbcUserDepartmentInfoBasicRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.stereotype.Component; @@ -32,6 +33,8 @@ public class UserDomainService { private JdbcRoleUserRepository jdbcRoleUserRepository; @Autowired private JdbcStaffRankRepository jdbcStaffRankRepository; + @Autowired + private JdbcUserDepartmentInfoBasicRepository jdbcUserDepartmentInfoBasicRepository; public PageResult userPageQuery(RolePageQuery rolePageQuery) { Page page=jdbcUserRepository.findAllByNameContainsAndEmployeeNoContains(rolePageQuery.getName(),rolePageQuery.getEmployeeNo(),rolePageQuery.getPageResult()); @@ -54,8 +57,12 @@ public class UserDomainService { } List roleIds=roleUsers.stream().map(RoleUser::getRoleId).toList(); List roles=jdbcRoleRepository.findAllByIdIn(roleIds); + //职级 List staffRanks=jdbcStaffRankRepository.findByEmployeeNoIn(users.stream().map(User::getEmployeeNo).toList()); Map> collect= staffRanks.stream().collect(Collectors.groupingBy(StaffRank::getEmployeeNo)); + //公司 + List departments=jdbcUserDepartmentInfoBasicRepository.findByUserIdIn(users.stream().map(User::getUserId).toList()); + Map> departmentCollect= departments.stream().collect(Collectors.groupingBy(UserDepartmentInfoBasic::getUserId)); List result = users.stream().map(temp -> { RolePageDto obj = new RolePageDto(); @@ -63,6 +70,7 @@ public class UserDomainService { obj.setEmployeeNo(temp.getEmployeeNo()); obj.setUserId(temp.getUserId()); obj.setStaffRanks(collect.get(temp.getEmployeeNo())); + obj.setDepartments(departmentCollect.get(temp.getUserId())); List roleUser = roleUsers.stream() .filter(s -> s.getUserId().equals(temp.getUserId())) .toList(); diff --git a/src/main/java/com/chint/route/mapper/JdbcUserDepartmentInfoBasicRepository.java b/src/main/java/com/chint/route/mapper/JdbcUserDepartmentInfoBasicRepository.java index f1690422..ced879c3 100644 --- a/src/main/java/com/chint/route/mapper/JdbcUserDepartmentInfoBasicRepository.java +++ b/src/main/java/com/chint/route/mapper/JdbcUserDepartmentInfoBasicRepository.java @@ -15,4 +15,6 @@ import java.util.List; public interface JdbcUserDepartmentInfoBasicRepository extends CrudRepository { List findByUserId(Long userId); + + List findByUserIdIn(List userIds); } \ No newline at end of file