Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
a905a134b2
|
@ -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<RoleUserDto> roleUserDtos;
|
||||
List<StaffRank> staffRanks;
|
||||
List<UserDepartmentInfoBasic> departments;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public class UserController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation("用户角色分页查询")
|
||||
@ApiOperation("用户信息分页查询")
|
||||
@PostMapping("/role/pageQuery")
|
||||
public Result<PageResult<?>> rolePageQuery(@RequestBody RolePageQuery rolePageQuery) {
|
||||
return Result.Success(SUCCESS, userDomainService.userPageQuery(rolePageQuery));
|
||||
|
|
|
@ -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<RolePageDto> userPageQuery(RolePageQuery rolePageQuery) {
|
||||
Page<User> page=jdbcUserRepository.findAllByNameContainsAndEmployeeNoContains(rolePageQuery.getName(),rolePageQuery.getEmployeeNo(),rolePageQuery.getPageResult());
|
||||
|
@ -54,8 +57,12 @@ public class UserDomainService {
|
|||
}
|
||||
List<Long> roleIds=roleUsers.stream().map(RoleUser::getRoleId).toList();
|
||||
List<Role> roles=jdbcRoleRepository.findAllByIdIn(roleIds);
|
||||
//职级
|
||||
List<StaffRank> staffRanks=jdbcStaffRankRepository.findByEmployeeNoIn(users.stream().map(User::getEmployeeNo).toList());
|
||||
Map<String, List<StaffRank>> collect= staffRanks.stream().collect(Collectors.groupingBy(StaffRank::getEmployeeNo));
|
||||
//公司
|
||||
List<UserDepartmentInfoBasic> departments=jdbcUserDepartmentInfoBasicRepository.findByUserIdIn(users.stream().map(User::getUserId).toList());
|
||||
Map<Long, List<UserDepartmentInfoBasic>> departmentCollect= departments.stream().collect(Collectors.groupingBy(UserDepartmentInfoBasic::getUserId));
|
||||
|
||||
List<RolePageDto> 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> roleUser = roleUsers.stream()
|
||||
.filter(s -> s.getUserId().equals(temp.getUserId()))
|
||||
.toList();
|
||||
|
|
|
@ -15,4 +15,6 @@ import java.util.List;
|
|||
public interface JdbcUserDepartmentInfoBasicRepository extends CrudRepository<UserDepartmentInfoBasic,Long> {
|
||||
|
||||
List<UserDepartmentInfoBasic> findByUserId(Long userId);
|
||||
|
||||
List<UserDepartmentInfoBasic> findByUserIdIn(List<Long> userIds);
|
||||
}
|
Loading…
Reference in New Issue