diff --git a/src/main/kotlin/top/fatweb/api/converter/permission/ElementConverter.kt b/src/main/kotlin/top/fatweb/api/converter/permission/ElementConverter.kt index 8b3df59..3ab25e1 100644 --- a/src/main/kotlin/top/fatweb/api/converter/permission/ElementConverter.kt +++ b/src/main/kotlin/top/fatweb/api/converter/permission/ElementConverter.kt @@ -7,7 +7,6 @@ object ElementConverter { fun elementToElementVo(element: Element) = ElementVo( id = element.id, name = element.name, - powerId = element.powerId, parentId = element.parentId, menuId = element.menuId ) diff --git a/src/main/kotlin/top/fatweb/api/converter/permission/MenuConverter.kt b/src/main/kotlin/top/fatweb/api/converter/permission/MenuConverter.kt index c7863c7..3f03508 100644 --- a/src/main/kotlin/top/fatweb/api/converter/permission/MenuConverter.kt +++ b/src/main/kotlin/top/fatweb/api/converter/permission/MenuConverter.kt @@ -8,7 +8,6 @@ object MenuConverter { id = menu.id, name = menu.name, url = menu.url, - powerId = menu.powerId, parentId = menu.parentId, moduleId = menu.moduleId ) diff --git a/src/main/kotlin/top/fatweb/api/converter/permission/ModuleConverter.kt b/src/main/kotlin/top/fatweb/api/converter/permission/ModuleConverter.kt index 712d8cd..c7bd76b 100644 --- a/src/main/kotlin/top/fatweb/api/converter/permission/ModuleConverter.kt +++ b/src/main/kotlin/top/fatweb/api/converter/permission/ModuleConverter.kt @@ -6,7 +6,6 @@ import top.fatweb.api.vo.permission.ModuleVo object ModuleConverter { fun moduleToModuleVo(module: Module) = ModuleVo( id = module.id, - name = module.name, - powerId = module.powerId + name = module.name ) } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/converter/permission/OperationConverter.kt b/src/main/kotlin/top/fatweb/api/converter/permission/OperationConverter.kt index 6efadbb..0c3cd5d 100644 --- a/src/main/kotlin/top/fatweb/api/converter/permission/OperationConverter.kt +++ b/src/main/kotlin/top/fatweb/api/converter/permission/OperationConverter.kt @@ -8,7 +8,6 @@ object OperationConverter { id = operation.id, name = operation.name, code = operation.code, - powerId = operation.powerId, elementId = operation.elementId ) } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Element.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Element.kt index 534ce0e..533b762 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Element.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Element.kt @@ -25,12 +25,6 @@ class Element : Serializable { @TableField("name") var name: String? = null - /** - * 权限ID - */ - @TableField("power_id") - var powerId: Long? = null - /** * 父ID */ @@ -44,6 +38,6 @@ class Element : Serializable { var menuId: Long? = null override fun toString(): String { - return "Element(id=$id, name=$name, powerId=$powerId, menuId=$menuId)" + return "Element(id=$id, name=$name, parentId=$parentId, menuId=$menuId)" } } diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt index 7ad88ef..79964d4 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt @@ -31,12 +31,6 @@ class Menu : Serializable { @TableField("url") var url: String? = null - /** - * 权限ID - */ - @TableField("power_id") - var powerId: Long? = null - /** * 父ID */ @@ -50,6 +44,6 @@ class Menu : Serializable { var moduleId: Long? = null override fun toString(): String { - return "Menu(id=$id, name=$name, url=$url, powerId=$powerId, parentId=$parentId, moduleId=$moduleId)" + return "Menu(id=$id, name=$name, url=$url, parentId=$parentId, moduleId=$moduleId)" } } diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt index 779ab51..088cd86 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt @@ -25,14 +25,7 @@ class Module : Serializable { @TableField("name") var name: String? = null - /** - * 权限ID - */ - @TableField("power_id") - var powerId: Long? = null - override fun toString(): String { - return "Module(id=$id, name=$name, powerId=$powerId)" + return "Module(id=$id, name=$name)" } - } diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt index 64e1703..9970982 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt @@ -31,12 +31,6 @@ class Operation : Serializable { @TableField("code") var code: String? = null - /** - * 权限ID - */ - @TableField("power_id") - var powerId: Long? = null - /** * 页面元素ID */ @@ -44,6 +38,6 @@ class Operation : Serializable { var elementId: Long? = null override fun toString(): String { - return "Operation(id=$id, name=$name, code=$code, powerId=$powerId, elementId=$elementId)" + return "Operation(id=$id, name=$name, code=$code, elementId=$elementId)" } } diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/ElementVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/ElementVo.kt index fd56286..6b963f7 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/ElementVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/ElementVo.kt @@ -9,9 +9,6 @@ data class ElementVo( @Schema(description = "元素名", example = "AddButton") val name: String?, - @Schema(description = "权限 ID") - val powerId: Long?, - @Schema(description = "父 ID") val parentId: Long?, diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/MenuVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/MenuVo.kt index 32f61ef..c101f50 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/MenuVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/MenuVo.kt @@ -12,9 +12,6 @@ data class MenuVo( @Schema(description = "URL", example = "/system") val url: String?, - @Schema(description = "权限 ID") - val powerId: Long?, - @Schema(description = "父 ID") val parentId: Long?, diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/ModuleVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/ModuleVo.kt index 921d807..28d8848 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/ModuleVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/ModuleVo.kt @@ -7,8 +7,5 @@ data class ModuleVo( val id: Long?, @Schema(description = "模块名", example = "系统") - val name: String?, - - @Schema(description = "权限 ID") - val powerId: Long? + val name: String? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/OperationVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/OperationVo.kt index 45c07c2..c42e8e1 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/OperationVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/OperationVo.kt @@ -12,9 +12,6 @@ data class OperationVo( @Schema(description = "功能编码", example = "system:user:add") val code: String?, - @Schema(description = "权限 ID") - val powerId: Long?, - @Schema(description = "页面元素 ID") val elementId: Long? ) diff --git a/src/main/resources/db/migration/R__Basic_data.sql b/src/main/resources/db/migration/R__Basic_data.sql index 4a12727..a7e5fe9 100644 --- a/src/main/resources/db/migration/R__Basic_data.sql +++ b/src/main/resources/db/migration/R__Basic_data.sql @@ -37,52 +37,48 @@ insert into t_power (id, type_id) as new_value on duplicate key update type_id = new_value.type_id; -insert into t_module (id, name, power_id) - values (1000000, '系统', id) as new_value -on duplicate key update name = new_value.name, - power_id = new_value.power_id; +insert into t_module (id, name) + values (1000000, '系统') as new_value +on duplicate key update name = new_value.name; -insert into t_menu (id, name, url, power_id, parent_id, module_id) - values (1990000, '系统管理', '/system', id, null, 1000000), - (1010000, '用户管理', '/system/user', id, 1990000, 1000000), - (1020000, '角色管理', '/system/role', id, 1990000, 1000000), - (1030000, '用户组管理', '/system/group', id, 1990000, 1000000) as new_value +insert into t_menu (id, name, url, parent_id, module_id) + values (1990000, '系统管理', '/system', null, 1000000), + (1010000, '用户管理', '/system/user', 1990000, 1000000), + (1020000, '角色管理', '/system/role', 1990000, 1000000), + (1030000, '用户组管理', '/system/group', 1990000, 1000000) as new_value on duplicate key update name =new_value.name, url =new_value.url, - power_id =new_value.power_id, parent_id =new_value.parent_id; -insert into t_element(id, name, power_id, menu_id, parent_id) - values (1010100, '查询', id, 1010000, null), - (1010200, '增加', id, 1010000, 1010100), - (1010300, '修改', id, 1010000, 1010100), - (1020100, '查询', id, 1020000, null), - (1020200, '增加', id, 1020000, 1020100), - (1020300, '修改', id, 1020000, 1020100), - (1020400, '删除', id, 1020000, 1020100), - (1030100, '查询', id, 1030000, null), - (1030200, '增加', id, 1030000, 1030100), - (1030300, '修改', id, 1030000, 1030100), - (1030400, '删除', id, 1030000, 1030100) as new_value +insert into t_element(id, name, menu_id, parent_id) + values (1010100, '查询', 1010000, null), + (1010200, '增加', 1010000, 1010100), + (1010300, '修改', 1010000, 1010100), + (1020100, '查询', 1020000, null), + (1020200, '增加', 1020000, 1020100), + (1020300, '修改', 1020000, 1020100), + (1020400, '删除', 1020000, 1020100), + (1030100, '查询', 1030000, null), + (1030200, '增加', 1030000, 1030100), + (1030300, '修改', 1030000, 1030100), + (1030400, '删除', 1030000, 1030100) as new_value on duplicate key update name = new_value.name, - power_id=new_value.power_id, menu_id = new_value.menu_id, parent_id = new_value.parent_id; -insert into t_operation(id, name, code, power_id, element_id) - values (1010101, '全部', 'system:user:query:all', id, 1010100), - (1010102, '单个', 'system:user:query:one', id, 1010100), - (1010201, '全部', 'system:user:add:all', id, 1010200), - (1010301, '全部', 'system:user:modify:all', id, 1010300), - (1020101, '全部', 'system:role:query:all', id, 1020100), - (1020201, '全部', 'system:role:add:all', id, 1020200), - (1020301, '全部', 'system:role:modify:all', id, 1020300), - (1020401, '全部', 'system:role:delete:all', id, 1020400), - (1030101, '全部', 'system:group:query:all', id, 1030100), - (1030201, '全部', 'system:group:add:all', id, 1030200), - (1030301, '全部', 'system:group:modify:all', id, 1030300), - (1030401, '全部', 'system:group:delete:all', id, 1030400) as new_value +insert into t_operation(id, name, code, element_id) + values (1010101, '全部', 'system:user:query:all', 1010100), + (1010102, '单个', 'system:user:query:one', 1010100), + (1010201, '全部', 'system:user:add:all', 1010200), + (1010301, '全部', 'system:user:modify:all', 1010300), + (1020101, '全部', 'system:role:query:all', 1020100), + (1020201, '全部', 'system:role:add:all', 1020200), + (1020301, '全部', 'system:role:modify:all', 1020300), + (1020401, '全部', 'system:role:delete:all', 1020400), + (1030101, '全部', 'system:group:query:all', 1030100), + (1030201, '全部', 'system:group:add:all', 1030200), + (1030301, '全部', 'system:group:modify:all', 1030300), + (1030401, '全部', 'system:group:delete:all', 1030400) as new_value on duplicate key update name=new_value.name, code=new_value.code, - power_id=new_value.power_id, element_id=new_value.element_id; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231025__Add_table_'t_menu'.sql b/src/main/resources/db/migration/V1_0_0_231025__Add_table_'t_menu'.sql index a385605..42135de 100644 --- a/src/main/resources/db/migration/V1_0_0_231025__Add_table_'t_menu'.sql +++ b/src/main/resources/db/migration/V1_0_0_231025__Add_table_'t_menu'.sql @@ -5,7 +5,6 @@ create table if not exists t_menu id bigint not null primary key, name varchar(30) not null comment ' 菜单名', url varchar(100) null comment 'URL', - power_id bigint not null comment '权限ID', parent_id bigint null comment '父ID', module_id bigint not null comment '模块ID' ) comment '菜单表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231026__Add_table_'t_element'.sql b/src/main/resources/db/migration/V1_0_0_231026__Add_table_'t_element'.sql index d371437..18e52d8 100644 --- a/src/main/resources/db/migration/V1_0_0_231026__Add_table_'t_element'.sql +++ b/src/main/resources/db/migration/V1_0_0_231026__Add_table_'t_element'.sql @@ -4,7 +4,6 @@ create table if not exists t_element ( id bigint not null primary key, name varchar(100) not null comment '元素名', - power_id bigint not null comment '权限ID', parent_id bigint null comment '父ID', menu_id bigint not null comment '菜单ID' ) comment '页面元素表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231027__Add_table_'t_operation'.sql b/src/main/resources/db/migration/V1_0_0_231027__Add_table_'t_operation'.sql index fbe9c61..94838be 100644 --- a/src/main/resources/db/migration/V1_0_0_231027__Add_table_'t_operation'.sql +++ b/src/main/resources/db/migration/V1_0_0_231027__Add_table_'t_operation'.sql @@ -5,6 +5,5 @@ create table if not exists t_operation id bigint not null primary key, name varchar(50) not null comment '功能名', code varchar(50) null comment '功能编码', - power_id bigint not null comment '权限ID', element_id bigint not null comment '页面元素ID' ) comment '功能表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231103__Add_table_'t_module'.sql b/src/main/resources/db/migration/V1_0_0_231103__Add_table_'t_module'.sql index 6af7c67..a2e36b9 100644 --- a/src/main/resources/db/migration/V1_0_0_231103__Add_table_'t_module'.sql +++ b/src/main/resources/db/migration/V1_0_0_231103__Add_table_'t_module'.sql @@ -3,6 +3,5 @@ drop table if exists t_module; create table if not exists t_module ( id bigint not null primary key, - name varchar(100) not null comment '模块名', - power_id bigint not null comment '权限ID' + name varchar(100) not null comment '模块名' ) comment '模块表'; \ No newline at end of file diff --git a/src/main/resources/mapper/permission/ElementMapper.xml b/src/main/resources/mapper/permission/ElementMapper.xml index f0ee1c0..6711e5c 100644 --- a/src/main/resources/mapper/permission/ElementMapper.xml +++ b/src/main/resources/mapper/permission/ElementMapper.xml @@ -4,7 +4,6 @@ - diff --git a/src/main/resources/mapper/permission/MenuMapper.xml b/src/main/resources/mapper/permission/MenuMapper.xml index 22b998f..d0dd3f0 100644 --- a/src/main/resources/mapper/permission/MenuMapper.xml +++ b/src/main/resources/mapper/permission/MenuMapper.xml @@ -5,7 +5,6 @@ - diff --git a/src/main/resources/mapper/permission/ModuleMapper.xml b/src/main/resources/mapper/permission/ModuleMapper.xml index 36764b2..fa2c27a 100644 --- a/src/main/resources/mapper/permission/ModuleMapper.xml +++ b/src/main/resources/mapper/permission/ModuleMapper.xml @@ -4,6 +4,5 @@ - diff --git a/src/main/resources/mapper/permission/OperationMapper.xml b/src/main/resources/mapper/permission/OperationMapper.xml index 50e1e15..5f354c9 100644 --- a/src/main/resources/mapper/permission/OperationMapper.xml +++ b/src/main/resources/mapper/permission/OperationMapper.xml @@ -5,7 +5,6 @@ - diff --git a/src/main/resources/mapper/permission/RoleMapper.xml b/src/main/resources/mapper/permission/RoleMapper.xml index 02cf5f4..18f82bb 100644 --- a/src/main/resources/mapper/permission/RoleMapper.xml +++ b/src/main/resources/mapper/permission/RoleMapper.xml @@ -29,30 +29,26 @@ t_role.version as role_version, tm.id as module_id, tm.name as module_name, - tm.power_id as module_power_id, tmn.id as menu_id, tmn.name as menu_name, tmn.url as menu_url, - tmn.power_id as menu_power_id, tmn.parent_id as menu_parent_id, tmn.module_id as menu_module_id, te.id as element_id, te.name as element_name, - te.power_id as element_power_id, te.parent_id as element_parent_id, te.menu_id as element_menu_id, t.id as operation_id, t.name as operation_name, t.code as operation_code, - t.power_id as operation_power_id, t.element_id as operation_element_id from (select * from t_role where deleted = 0) as t_role left join (select * from t_power_role where deleted = 0) as tpr on t_role.id = tpr.role_id left join t_power tp on tp.id = tpr.power_id - left join t_module tm on tp.id = tm.power_id - left join t_menu tmn on tp.id = tmn.power_id - left join t_element te on tp.id = te.power_id - left join t_operation t on tp.id = t.power_id + left join t_module tm on tp.id = tm.id + left join t_menu tmn on tp.id = tmn.id + left join t_element te on tp.id = te.id + left join t_operation t on tp.id = t.id @@ -71,30 +67,26 @@ t_role.version as role_version, tm.id as module_id, tm.name as module_name, - tm.power_id as module_power_id, tmn.id as menu_id, tmn.name as menu_name, tmn.url as menu_url, - tmn.power_id as menu_power_id, tmn.parent_id as menu_parent_id, tmn.module_id as menu_module_id, te.id as element_id, te.name as element_name, - te.power_id as element_power_id, te.parent_id as element_parent_id, te.menu_id as element_menu_id, t.id as operation_id, t.name as operation_name, t.code as operation_code, - t.power_id as operation_power_id, t.element_id as operation_element_id from (select * from t_role where deleted = 0) as t_role left join (select * from t_power_role where deleted = 0) as tpr on t_role.id = tpr.role_id left join t_power tp on tp.id = tpr.power_id - left join t_module tm on tp.id = tm.power_id - left join t_menu tmn on tp.id = tmn.power_id - left join t_element te on tp.id = te.power_id - left join t_operation t on tp.id = t.power_id + left join t_module tm on tp.id = tm.id + left join t_menu tmn on tp.id = tmn.id + left join t_element te on tp.id = te.id + left join t_operation t on tp.id = t.id where t_role.id = #{id} diff --git a/src/main/resources/mapper/permission/UserMapper.xml b/src/main/resources/mapper/permission/UserMapper.xml index 248568e..1639122 100644 --- a/src/main/resources/mapper/permission/UserMapper.xml +++ b/src/main/resources/mapper/permission/UserMapper.xml @@ -28,21 +28,17 @@ tui.version as user_info_version, tmo.id as module_id, tmo.name as module_name, - tmo.power_id as module_power_id, tm.id as menu_id, tm.name as menu_name, tm.url as menu_url, - tm.power_id as menu_power_id, tm.parent_id as menu_parent_id, te.id as element_id, te.name as element_name, - te.power_id as element_power_id, te.parent_id as element_parent_id, te.menu_id as element_menu_id, t.id as operation_id, t.name as operation_name, t.code as operation_code, - t.power_id as operation_power_id, t.element_id as operation_element_id from t_user left join (select * from t_user_info where deleted = 0) as tui on t_user.id = tui.user_id @@ -54,10 +50,10 @@ on tr.id = trg.role_id or tr.id = tur.role_id left join (select * from t_power_role where deleted = 0) as tpr on tr.id = tpr.role_id left join t_power as tp on tp.id = tpr.power_id - left join t_module as tmo on tp.id = tmo.power_id - left join t_menu as tm on tp.id = tm.power_id - left join t_element as te on tp.id = te.power_id - left join t_operation as t on tp.id = t.power_id + left join t_module as tmo on tp.id = tmo.id + left join t_menu as tm on tp.id = tm.id + left join t_element as te on tp.id = te.id + left join t_operation as t on tp.id = t.id where t_user.deleted = 0 and t_user.username = #{username};