【add】用户角色分页接口返回格式修改
This commit is contained in:
parent
bb280237d9
commit
9dcbdad7f1
|
@ -2,13 +2,12 @@ package com.chint.application.dtos.system;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class RolePageDto {
|
public class RolePageDto {
|
||||||
private String name;
|
private String name;
|
||||||
private String employeeNo;
|
private String employeeNo;
|
||||||
private String roleName;
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private Long roleId;
|
List<RoleUserDto> roleUserDtos;
|
||||||
private Long roleUserId;
|
|
||||||
private String roleDesc;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.chint.application.dtos.system;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RoleUserDto {
|
||||||
|
private String roleName;
|
||||||
|
private Long roleId;
|
||||||
|
private Long roleUserId;
|
||||||
|
private String roleDesc;
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.chint.domain.service;
|
||||||
|
|
||||||
import com.chint.application.dtos.system.RolePageDto;
|
import com.chint.application.dtos.system.RolePageDto;
|
||||||
import com.chint.application.dtos.system.RolePageQuery;
|
import com.chint.application.dtos.system.RolePageQuery;
|
||||||
|
import com.chint.application.dtos.system.RoleUserDto;
|
||||||
import com.chint.domain.aggregates.user.Role;
|
import com.chint.domain.aggregates.user.Role;
|
||||||
import com.chint.domain.aggregates.user.RoleUser;
|
import com.chint.domain.aggregates.user.RoleUser;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
@ -54,13 +55,19 @@ public class UserDomainService {
|
||||||
.filter(s -> s.getUserId().equals(temp.getUserId()))
|
.filter(s -> s.getUserId().equals(temp.getUserId()))
|
||||||
.toList();
|
.toList();
|
||||||
if(!roleUser.isEmpty()){
|
if(!roleUser.isEmpty()){
|
||||||
obj.setRoleId(roleUser.get(0).getRoleId());
|
List<RoleUserDto> roleUserDtos=new ArrayList<>();
|
||||||
obj.setRoleUserId(roleUser.get(0).getId());
|
for(RoleUser roleUserObj : roleUser){
|
||||||
List<Role> roleList=roles.stream().filter(s->s.getId().equals(obj.getRoleId())).toList();
|
RoleUserDto roleUserDto=new RoleUserDto();
|
||||||
if(!roleList.isEmpty()){
|
roleUserDto.setRoleId(roleUserObj.getRoleId());
|
||||||
obj.setRoleName(roleList.get(0).getRoleName());
|
roleUserDto.setRoleUserId(roleUserObj.getId());
|
||||||
obj.setRoleDesc(roleList.get(0).getRoleDesc());
|
List<Role> roleList=roles.stream().filter(s->s.getId().equals(roleUserDto.getRoleId())).toList();
|
||||||
|
if(!roleList.isEmpty()){
|
||||||
|
roleUserDto.setRoleName(roleList.get(0).getRoleName());
|
||||||
|
roleUserDto.setRoleDesc(roleList.get(0).getRoleDesc());
|
||||||
|
}
|
||||||
|
roleUserDtos.add(roleUserDto);
|
||||||
}
|
}
|
||||||
|
obj.setRoleUserDtos(roleUserDtos);
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
Loading…
Reference in New Issue