feat: REQ-1650 角色ID查询人员列表
This commit is contained in:
parent
d9d582b117
commit
9aeb17c480
@ -1,7 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS plat_user_role_job_change
|
||||
(
|
||||
id bigint auto_increment comment '主键',
|
||||
axzo_user_id bigint default 0 not null comment '安心筑id',
|
||||
person_id bigint default 0 not null comment '安心筑personId',
|
||||
request_id varchar(64) default 0 not null comment '请求ID',
|
||||
change_type varchar(20) default '' not null comment '变更类型',
|
||||
change_detail varchar(256) default '' not null comment '变更详情',
|
||||
@ -14,4 +14,4 @@ CREATE TABLE IF NOT EXISTS plat_user_role_job_change
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8 comment '平台账户角色岗位变动记录';
|
||||
create index idx_plat_user_role_job_change
|
||||
on plat_user_role_job_change (axzo_user_id, operator_time);
|
||||
on plat_user_role_job_change (person_id, operator_time);
|
||||
|
||||
@ -20,10 +20,10 @@ import java.util.Date;
|
||||
public class PlatAccountChangeQuery extends PageRequest {
|
||||
|
||||
/**
|
||||
* 安心筑id
|
||||
* 安心筑personId
|
||||
*/
|
||||
@NotNull(message = "axzoUserId is required")
|
||||
private Long axzoUserId;
|
||||
@NotNull(message = "personId is required")
|
||||
private Long personId;
|
||||
|
||||
|
||||
}
|
||||
@ -15,15 +15,29 @@ import java.util.List;
|
||||
@Data
|
||||
public class RoleWithUserQueryReq extends PageRequest {
|
||||
|
||||
/** 查询关键字 **/
|
||||
/**
|
||||
* 查询关键字
|
||||
**/
|
||||
private String keyword;
|
||||
|
||||
/** 企业组织ID **/
|
||||
/**
|
||||
* 企业组织ID
|
||||
**/
|
||||
private Long ouId;
|
||||
|
||||
/** 工作台ID **/
|
||||
/**
|
||||
* 工作台ID
|
||||
**/
|
||||
private Long workspaceId;
|
||||
|
||||
/** 企业工作台参建类型 **/
|
||||
/**
|
||||
* 企业工作台参建类型
|
||||
**/
|
||||
private Integer workspaceJoinType;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
**/
|
||||
private Long roleId;
|
||||
|
||||
}
|
||||
|
||||
@ -22,9 +22,9 @@ import java.util.Date;
|
||||
public class PlatAccountChangeLogResp {
|
||||
|
||||
/**
|
||||
* 安心筑id
|
||||
* 安心筑用户personId
|
||||
*/
|
||||
private Long axzoUserId;
|
||||
private Long personId;
|
||||
|
||||
/**
|
||||
* requestId
|
||||
|
||||
@ -29,10 +29,10 @@ import java.util.Map;
|
||||
public class PlatUserAccountChangeLog extends BaseEntity<PlatUserAccountChangeLog> {
|
||||
|
||||
/**
|
||||
* 安心筑id
|
||||
* 安心筑personId
|
||||
*/
|
||||
@TableField(value = "axzo_user_id")
|
||||
private Long axzoUserId;
|
||||
@TableField(value = "person_id")
|
||||
private Long personId;
|
||||
|
||||
/**
|
||||
* 请求Id
|
||||
|
||||
@ -51,11 +51,11 @@ public class PlatUserRoleChangeService {
|
||||
}
|
||||
|
||||
public ApiPageResult<PlatAccountChangeLogResp> queryPlatUserAccountChangeLog(PlatAccountChangeQuery platAccountChangeQuery) {
|
||||
if (platAccountChangeQuery.getAxzoUserId() == null) {
|
||||
if (platAccountChangeQuery.getPersonId() == null) {
|
||||
throw new ServiceException("axzoUserId不能为空!");
|
||||
}
|
||||
IPage<PlatUserAccountChangeLog> page = userRoleChangeDao.lambdaQuery()
|
||||
.eq(PlatUserAccountChangeLog::getAxzoUserId, platAccountChangeQuery.getAxzoUserId())
|
||||
.eq(PlatUserAccountChangeLog::getPersonId, platAccountChangeQuery.getPersonId())
|
||||
.page(platAccountChangeQuery.toPage());
|
||||
List<PlatAccountChangeLogResp> list = BeanMapper.copyList(page.getRecords(), PlatAccountChangeLogResp.class);
|
||||
PageResp<PlatAccountChangeLogResp> data = PageResp.list(page.getCurrent(), page.getSize(), page.getTotal(), list);
|
||||
|
||||
@ -85,7 +85,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
if (CollectionUtils.isEmpty(roleIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return getByIds(roleIds, null, null,null, includePermissionGroup);
|
||||
return getByIds(roleIds, null, null, null, includePermissionGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,7 +107,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
Map<Long, List<SaasPgroupRoleRelation>> pgrouRelationMap = null;
|
||||
Map<Long, List<SaasPermissionGroupVO>> pGroupMap = null;
|
||||
// 如果不包含则跳过
|
||||
if(includePermissionGroup) {
|
||||
if (includePermissionGroup) {
|
||||
// 查询权限集关联关系
|
||||
List<SaasPgroupRoleRelation> saasPgroupRoleRelations = queryPermissionGroupRelation(roleIds);
|
||||
if (CollectionUtils.isNotEmpty(saasPgroupRoleRelations)) {
|
||||
@ -188,11 +188,11 @@ public class RoleServiceImpl implements RoleService {
|
||||
.in(CollectionUtils.isNotEmpty(req.getIds()), BaseEntity::getId, req.getIds())
|
||||
.in(CollectionUtils.isNotEmpty(groupRelation), BaseEntity::getId, groupRelation.stream().map(SaasRoleGroupRelation::getRoleId).collect(Collectors.toList()))
|
||||
.in(CollectionUtils.isNotEmpty(req.getRoleType()), SaasRole::getRoleType, req.getRoleType())
|
||||
.in(CollectionUtils.isEmpty(req.getIds()) && CollectionUtils.isNotEmpty(req.getWorkspaceId()),SaasRole::getWorkspaceId,req.getWorkspaceId())
|
||||
.in(CollectionUtils.isEmpty(req.getIds()) && CollectionUtils.isNotEmpty(req.getOuId()),SaasRole::getOwnerOuId,req.getOuId())
|
||||
.in(CollectionUtils.isEmpty(req.getIds()) && CollectionUtils.isNotEmpty(req.getWorkspaceId()), SaasRole::getWorkspaceId, req.getWorkspaceId())
|
||||
.in(CollectionUtils.isEmpty(req.getIds()) && CollectionUtils.isNotEmpty(req.getOuId()), SaasRole::getOwnerOuId, req.getOuId())
|
||||
.orderByDesc(BaseEntity::getId)
|
||||
.list();
|
||||
return getByIds(list.stream().map(BaseEntity::getId).collect(Collectors.toList()), req.getIsCommon(),req.getWorkspaceId(),req.getOuId(),req.getIncludePermissionGroup());
|
||||
return getByIds(list.stream().map(BaseEntity::getId).collect(Collectors.toList()), req.getIsCommon(), req.getWorkspaceId(), req.getOuId(), req.getIncludePermissionGroup());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -204,7 +204,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
.identityType(e.getIdentityType())
|
||||
.workspaceId(e.getWorkspaceId())
|
||||
.ouId(e.getOuId())
|
||||
.role(queryByIdentityIdType(e.getIdentityId(),e.getIdentityType(),e.getWorkspaceId(),e.getOuId(),false))
|
||||
.role(queryByIdentityIdType(e.getIdentityId(), e.getIdentityType(), e.getWorkspaceId(), e.getOuId(), false))
|
||||
.build());
|
||||
});
|
||||
return result;
|
||||
@ -276,7 +276,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
.identityType(e.getIdentityType())
|
||||
.workspaceId(e.getWorkspaceId())
|
||||
.ouId(e.getOuId())
|
||||
.isSuperAdmin(CollectionUtils.isNotEmpty(list)?true:false)
|
||||
.isSuperAdmin(CollectionUtils.isNotEmpty(list) ? true : false)
|
||||
.build());
|
||||
});
|
||||
return result;
|
||||
@ -455,7 +455,12 @@ public class RoleServiceImpl implements RoleService {
|
||||
}
|
||||
|
||||
//反查relation
|
||||
List<Long> roleIds = rolePage.getRecords().stream().map(SaasRole::getId).collect(Collectors.toList());
|
||||
List<Long> roleIds = Lists.newArrayList();
|
||||
if (req.getRoleId() == null) {
|
||||
roleIds = rolePage.getRecords().stream().map(SaasRole::getId).collect(Collectors.toList());
|
||||
} else {
|
||||
roleIds.add(req.getRoleId());
|
||||
}
|
||||
List<SaasRoleUserRelation> relationList = saasRoleUserRelationDao.list(new LambdaQueryWrapper<SaasRoleUserRelation>().
|
||||
in(SaasRoleUserRelation::getRoleId, roleIds)
|
||||
.eq(SaasRoleUserRelation::getOuId, req.getOuId())
|
||||
@ -565,7 +570,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
|
||||
ArrayList<SaasRoleAndGroupVO> result = new ArrayList<>();
|
||||
|
||||
query.forEach(e->{
|
||||
query.forEach(e -> {
|
||||
List<SaasRoleGroupRelation> saasRoleGroupRelations = groupIdMap.get(e.getId());
|
||||
if (CollectionUtils.isEmpty(saasRoleGroupRelations)) {
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user