feat: (feature/REQ-2595) 角色权限缓存增加tags,
This commit is contained in:
parent
3e80c801c9
commit
1494412969
@ -5,6 +5,8 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@ -25,4 +27,11 @@ public class SaasPermissionRelationRes {
|
||||
* 菜单资源树节点类型
|
||||
*/
|
||||
private Integer featureType;
|
||||
|
||||
/**
|
||||
* 权限点标签:
|
||||
* 在职:JOINED
|
||||
* 离场:LEAVE
|
||||
*/
|
||||
private Set<String> tags;
|
||||
}
|
||||
|
||||
@ -38,12 +38,6 @@ public class CacheRolePermissionHandler implements InitializingBean {
|
||||
log.info("begin cached role permission handler rocketmq event: {}", event);
|
||||
RolePermissionCreatedPayload payload = event.normalizedData(RolePermissionCreatedPayload.class);
|
||||
|
||||
// 影响角色权限入口的代码没法简单重构,导致发送的roleIds可能不准确,所以一旦有角色权限的更新事件后,全量更新角色权限,角色权限数量不多
|
||||
// 后续收口了代码就准确根据角色去更新缓存
|
||||
// if (CollectionUtils.isEmpty(payload.getRoleIds())) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
RoleService.ListSaasRoleParam listSaasRoleParam = RoleService.ListSaasRoleParam.builder()
|
||||
.roleIds(Optional.ofNullable(payload.getRoleIds())
|
||||
.map(Lists::newArrayList)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package cn.axzo.tyr.server.repository.entity;
|
||||
|
||||
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
|
||||
@ -12,6 +11,7 @@ import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 权限集功能中间表(SaasPgroupPermissionRelation)表实体类
|
||||
@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
@Setter
|
||||
@ToString
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("saas_pgroup_permission_relation")
|
||||
@TableName(value = "saas_pgroup_permission_relation", autoResultMap = true)
|
||||
public class SaasPgroupPermissionRelation extends BaseEntity<SaasPgroupPermissionRelation> {
|
||||
|
||||
public static final Integer OLD_FEATURE = 0;
|
||||
@ -70,6 +70,12 @@ public class SaasPgroupPermissionRelation extends BaseEntity<SaasPgroupPermissio
|
||||
*/
|
||||
private String terminal;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
@TableField(value = "tags", typeHandler = FastjsonTypeHandler.class)
|
||||
private Set<String> tags;
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
|
||||
@ -70,5 +70,12 @@ public interface RolePermissionCacheService {
|
||||
private String terminal;
|
||||
|
||||
private Integer featureType;
|
||||
|
||||
/**
|
||||
* 权限点标签:
|
||||
* 在职:JOINED
|
||||
* 离场:LEAVE
|
||||
*/
|
||||
private Set<String> tags;
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,6 +182,7 @@ public class RolePermissionCacheServiceImpl implements RolePermissionCacheServic
|
||||
.featureCode(saasFeature.getFeatureCode())
|
||||
.featureType(saasFeature.getFeatureType())
|
||||
.terminal(saasFeature.getTerminal())
|
||||
.tags(permissionRelation.getTags())
|
||||
.build());
|
||||
|
||||
List<RolePermissionCacheService.PermissionDTO> parentPermissions = saasFeature.splitPath().stream()
|
||||
@ -192,6 +193,7 @@ public class RolePermissionCacheServiceImpl implements RolePermissionCacheServic
|
||||
.featureCode(f.getFeatureCode())
|
||||
.featureType(f.getFeatureType())
|
||||
.terminal(f.getTerminal())
|
||||
.tags(permissionRelation.getTags())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -216,6 +218,7 @@ public class RolePermissionCacheServiceImpl implements RolePermissionCacheServic
|
||||
.featureCode(pageElement.getCode())
|
||||
.featureType(featureResource.getFeatureType())
|
||||
.terminal(featureResource.getTerminal())
|
||||
.tags(permissionRelation.getTags())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -234,6 +237,7 @@ public class RolePermissionCacheServiceImpl implements RolePermissionCacheServic
|
||||
.featureCode(pageElement.getCode())
|
||||
.featureType(f.getFeatureType())
|
||||
.terminal(f.getTerminal())
|
||||
.tags(permissionRelation.getTags())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
})
|
||||
|
||||
@ -1741,6 +1741,7 @@ public class RoleServiceImpl extends ServiceImpl<SaasRoleMapper, SaasRole>
|
||||
.featureId(e.getFeatureId())
|
||||
.type(e.getType())
|
||||
.featureType(e.getFeatureType())
|
||||
.tags(e.getTags())
|
||||
.build(),
|
||||
Collectors.toList())));
|
||||
}
|
||||
@ -1851,6 +1852,13 @@ public class RoleServiceImpl extends ServiceImpl<SaasRoleMapper, SaasRole>
|
||||
*/
|
||||
private Integer featureType;
|
||||
|
||||
/**
|
||||
* 权限点标签:
|
||||
* 在职:JOINED
|
||||
* 离场:LEAVE
|
||||
*/
|
||||
private Set<String> tags;
|
||||
|
||||
public static SaasPermissionRelationWrapper from(SaasPgroupRoleRelation saasPgroupRoleRelation,
|
||||
SaasPgroupPermissionRelation permissionRelation) {
|
||||
if (permissionRelation == null) {
|
||||
@ -1861,6 +1869,7 @@ public class RoleServiceImpl extends ServiceImpl<SaasRoleMapper, SaasRole>
|
||||
.featureId(permissionRelation.getFeatureId())
|
||||
.type(permissionRelation.getType())
|
||||
.featureType(permissionRelation.getFeatureType())
|
||||
.tags(permissionRelation.getTags())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user