perf:权限增加一个source字段,用于标记权限来源
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package com.tiesheng.role.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.util.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 角色-权限
|
||||
@@ -81,6 +84,12 @@ public class CoreRoleAuthority extends DaoBase {
|
||||
@TableField(value = "version")
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 权限来源:auto-自动生成,input-添加
|
||||
*/
|
||||
@TableField(value = "`source`")
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 扩展1
|
||||
*/
|
||||
@@ -315,6 +324,24 @@ public class CoreRoleAuthority extends DaoBase {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限来源:auto-自动生成,input-添加
|
||||
*
|
||||
* @return source - 权限来源:auto-自动生成,input-添加
|
||||
*/
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置权限来源:auto-自动生成,input-添加
|
||||
*
|
||||
* @param source 权限来源:auto-自动生成,input-添加
|
||||
*/
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取扩展1
|
||||
*
|
||||
@@ -368,4 +395,4 @@ public class CoreRoleAuthority extends DaoBase {
|
||||
public void setExt3(String ext3) {
|
||||
this.ext3 = ext3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -263,6 +263,7 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
|
||||
coreRoleAuthorityMapper.delete(new QueryWrapper<CoreRoleAuthority>()
|
||||
.ne("version", version)
|
||||
.ne("source", "auto")
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
groupAuthority.setPlatform(menuPlatform);
|
||||
groupAuthority.setParent(parentId);
|
||||
groupAuthority.setVersion(version);
|
||||
groupAuthority.setSource("auto");
|
||||
groupAuthority.setId(StrUtil.join("_", groupAuthority.getService(), groupAuthority.getNo()));
|
||||
list.add(groupAuthority);
|
||||
}
|
||||
@@ -72,6 +73,7 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
menuAuthority.setParent(groupAuthority.getId());
|
||||
menuAuthority.setPlatform(menuPlatform);
|
||||
menuAuthority.setVersion(version);
|
||||
menuAuthority.setSource("auto");
|
||||
menuAuthority.setId(StrUtil.join("_", menuAuthority.getService(), menuAuthority.getNo()));
|
||||
list.add(menuAuthority);
|
||||
|
||||
@@ -85,6 +87,7 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
point.setLevel(menuAuthority.getLevel() + 1);
|
||||
point.setParent(menuAuthority.getId());
|
||||
point.setVersion(version);
|
||||
point.setSource("auto");
|
||||
point.setPlatform(StrUtil.emptyToDefault(authority.platform(), menuPlatform));
|
||||
point.setId(StrUtil.join("_", point.getService(), point.getNo()));
|
||||
list.add(point);
|
||||
|
||||
@@ -99,4 +99,8 @@ create table core_role_user
|
||||
alter table core_role_authority
|
||||
add version varchar(50) null comment '版本号' after platform;
|
||||
|
||||
alter table core_role_authority
|
||||
add source varchar(10) null comment '权限来源:auto-自动生成,input-添加' after version;
|
||||
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<result column="link" jdbcType="LONGVARCHAR" property="link" />
|
||||
<result column="platform" jdbcType="VARCHAR" property="platform" />
|
||||
<result column="version" jdbcType="VARCHAR" property="version" />
|
||||
<result column="source" jdbcType="VARCHAR" property="source" />
|
||||
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
|
||||
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
|
||||
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
|
||||
@@ -27,12 +28,12 @@
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, service, `no`, `name`, sort, `level`, parent,
|
||||
remark, is_open, `type`, link, platform, version, ext1, ext2, ext3
|
||||
remark, is_open, `type`, link, platform, version, `source`, ext1, ext2, ext3
|
||||
</sql>
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into core_role_authority(id, create_time, update_time, is_deleted, service, no, name, level, parent,
|
||||
type, platform, is_open, version)
|
||||
type, platform, is_open, version, source)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, now(), now(), 0,
|
||||
@@ -42,7 +43,7 @@
|
||||
#{item.level},
|
||||
#{item.parent},
|
||||
#{item.type},
|
||||
#{item.platform}, 1, #{item.version})
|
||||
#{item.platform}, 1, #{item.version}, #{item.source})
|
||||
</foreach>
|
||||
|
||||
on duplicate key update update_time=now(),
|
||||
@@ -51,6 +52,7 @@
|
||||
parent=values(parent),
|
||||
type=values(type),
|
||||
platform=values(platform),
|
||||
source=values(source),
|
||||
version=values(version)
|
||||
</insert>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user