diff --git a/springboot-role/src/main/java/com/tiesheng/role/pojos/dao/CoreRoleAuthority.java b/springboot-role/src/main/java/com/tiesheng/role/pojos/dao/CoreRoleAuthority.java index 40ca8ed..539606e 100644 --- a/springboot-role/src/main/java/com/tiesheng/role/pojos/dao/CoreRoleAuthority.java +++ b/springboot-role/src/main/java/com/tiesheng/role/pojos/dao/CoreRoleAuthority.java @@ -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; } -} +} \ No newline at end of file diff --git a/springboot-role/src/main/java/com/tiesheng/role/service/CoreRoleService.java b/springboot-role/src/main/java/com/tiesheng/role/service/CoreRoleService.java index f0fa406..57d30e7 100644 --- a/springboot-role/src/main/java/com/tiesheng/role/service/CoreRoleService.java +++ b/springboot-role/src/main/java/com/tiesheng/role/service/CoreRoleService.java @@ -263,6 +263,7 @@ public class CoreRoleService extends TsServiceBase() .ne("version", version) + .ne("source", "auto") ); } diff --git a/springboot-role/src/main/java/com/tiesheng/role/service/RoleAuthorityHandler.java b/springboot-role/src/main/java/com/tiesheng/role/service/RoleAuthorityHandler.java index b4c8d18..cbfe10c 100644 --- a/springboot-role/src/main/java/com/tiesheng/role/service/RoleAuthorityHandler.java +++ b/springboot-role/src/main/java/com/tiesheng/role/service/RoleAuthorityHandler.java @@ -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); diff --git a/springboot-role/src/main/resources/db/migration/tiesheng_init_role.sql b/springboot-role/src/main/resources/db/migration/tiesheng_init_role.sql index 6063669..fd32d5e 100644 --- a/springboot-role/src/main/resources/db/migration/tiesheng_init_role.sql +++ b/springboot-role/src/main/resources/db/migration/tiesheng_init_role.sql @@ -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; diff --git a/springboot-role/src/main/resources/mapper/CoreRoleAuthorityMapper.xml b/springboot-role/src/main/resources/mapper/CoreRoleAuthorityMapper.xml index 2fe38b7..bf20664 100644 --- a/springboot-role/src/main/resources/mapper/CoreRoleAuthorityMapper.xml +++ b/springboot-role/src/main/resources/mapper/CoreRoleAuthorityMapper.xml @@ -20,6 +20,7 @@ + @@ -27,12 +28,12 @@ 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 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 (#{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}) 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)