diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt index e021d3b..26ad1d3 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt @@ -10,7 +10,7 @@ import top.fatweb.api.vo.authentication.UserInfoVo /** *
- * 用户 前端控制器 + * 用户表 前端控制器 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/converter/UserConverter.kt b/src/main/kotlin/top/fatweb/api/converter/UserConverter.kt index 07b8fe1..0703449 100644 --- a/src/main/kotlin/top/fatweb/api/converter/UserConverter.kt +++ b/src/main/kotlin/top/fatweb/api/converter/UserConverter.kt @@ -54,7 +54,6 @@ object UserConverter { name = it.name, code = it.code, powerId = it.powerId, - parentId = it.parentId, elementId = it.elementId ) } 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 c168075..534ce0e 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Element.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Element.kt @@ -7,7 +7,7 @@ import java.io.Serializable /** *- * 页面元素 + * 页面元素表 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt index 3a1fc11..d3394ac 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt @@ -5,7 +5,7 @@ import java.io.Serializable /** *- * 用户组 + * 用户组表 *
* * @author FatttSnake 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 a2559e7..7ad88ef 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt @@ -7,7 +7,7 @@ import java.io.Serializable /** *- * 菜单 + * 菜单表 *
* * @author FatttSnake @@ -43,7 +43,13 @@ class Menu : Serializable { @TableField("parent_id") var parentId: Long? = null + /** + * 模块ID + */ + @TableField("module_id") + var moduleId: Long? = null + override fun toString(): String { - return "Menu(id=$id, name=$name, url=$url, powerId=$powerId, parentId=$parentId)" + return "Menu(id=$id, name=$name, url=$url, powerId=$powerId, 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 new file mode 100644 index 0000000..779ab51 --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt @@ -0,0 +1,38 @@ +package top.fatweb.api.entity.permission + +import com.baomidou.mybatisplus.annotation.TableField +import com.baomidou.mybatisplus.annotation.TableId +import com.baomidou.mybatisplus.annotation.TableName +import java.io.Serializable + +/** + *+ * 模块表 + *
+ * + * @author FatttSnake + * @since 2023-10-25 + */ +@TableName("t_module") +class Module : Serializable { + + @TableId("id") + var id: Long? = null + + /** + * 模块名 + */ + @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)" + } + +} 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 f9a713a..64e1703 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt @@ -7,7 +7,7 @@ import java.io.Serializable /** *- * 功能 + * 功能表 *
* * @author FatttSnake @@ -37,12 +37,6 @@ class Operation : Serializable { @TableField("power_id") var powerId: Long? = null - /** - * 父ID - */ - @TableField("parent_id") - var parentId: Long? = null - /** * 页面元素ID */ @@ -50,6 +44,6 @@ class Operation : Serializable { var elementId: Long? = null override fun toString(): String { - return "Operation(id=$id, name=$name, code=$code, powerId=$powerId, parentId=$parentId, elementId=$elementId)" + return "Operation(id=$id, name=$name, code=$code, powerId=$powerId, elementId=$elementId)" } } diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt index 4e52fdd..7886707 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt @@ -7,7 +7,7 @@ import java.io.Serializable /** *- * 权限 + * 权限表 *
* * @author FatttSnake @@ -23,7 +23,7 @@ class Power : Serializable { * 权限类型 */ @TableField("type_id") - var typeId: Long? = null + var typeId: Int? = null override fun toString(): String { return "Power(id=$id, typeId=$typeId)" diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt b/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt index 1f69a83..af0056e 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt @@ -7,7 +7,7 @@ import java.io.Serializable /** *- * 权限类型 + * 权限类型表 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt index c55a604..03565e9 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt @@ -5,7 +5,7 @@ import java.io.Serializable /** *- * 角色 + * 角色表 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/ElementMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/ElementMapper.kt index 62d9ac3..b3de56c 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/ElementMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/ElementMapper.kt @@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Element /** *- * 页面元素 Mapper 接口 + * 页面元素表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt index cba8e5f..208f4a9 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt @@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Group /** *- * 用户组 Mapper 接口 + * 用户组表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt index c952d58..f50941a 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt @@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Menu /** *- * 菜单 Mapper 接口 + * 菜单表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/ModuleMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/ModuleMapper.kt new file mode 100644 index 0000000..e52dfe6 --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/ModuleMapper.kt @@ -0,0 +1,16 @@ +package top.fatweb.api.mapper.permission + +import com.baomidou.mybatisplus.core.mapper.BaseMapper +import org.apache.ibatis.annotations.Mapper +import top.fatweb.api.entity.permission.Module + +/** + *+ * 模块表 Mapper 接口 + *
+ * + * @author FatttSnake + * @since 2023-10-25 + */ +@Mapper +interface ModuleMapper : BaseMapper- * 功能 Mapper 接口 + * 功能表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt index fbeb8cd..f0a9e4d 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt @@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Power /** *- * 权限 Mapper 接口 + * 权限表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerTypeMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerTypeMapper.kt index 6616e89..d74ce5b 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerTypeMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerTypeMapper.kt @@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.PowerType /** *- * 权限类型 Mapper 接口 + * 权限类型表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt index 36881ad..a7c8157 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt @@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Role /** *- * 角色 Mapper 接口 + * 角色表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt index 0adc77b..fd2cd6c 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt @@ -7,7 +7,7 @@ import top.fatweb.api.entity.permission.User /** *- * 用户 Mapper 接口 + * 用户表 Mapper 接口 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IElementService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IElementService.kt index eaacea3..64157d9 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IElementService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IElementService.kt @@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Element /** *- * 页面元素 服务类 + * 页面元素表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt index 94f8aa0..7361f63 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt @@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Group /** *- * 用户组 服务类 + * 用户组表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt index 6267758..0bcd1f1 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt @@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Menu /** *- * 菜单 服务类 + * 菜单表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IModuleService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IModuleService.kt new file mode 100644 index 0000000..e7912fd --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/service/permission/IModuleService.kt @@ -0,0 +1,14 @@ +package top.fatweb.api.service.permission + +import com.baomidou.mybatisplus.extension.service.IService +import top.fatweb.api.entity.permission.Module + +/** + *+ * 模块表 服务类 + *
+ * + * @author FatttSnake + * @since 2023-10-25 + */ +interface IModuleService : IService- * 功能 服务类 + * 功能表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt index 03b0d45..c7040ad 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt @@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Power /** *- * 权限 服务类 + * 权限表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IPowerTypeService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IPowerTypeService.kt index ecc0491..8202bb7 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IPowerTypeService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IPowerTypeService.kt @@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.PowerType /** *- * 权限类型 服务类 + * 权限类型表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt index f9c46a0..afe7289 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt @@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Role /** *- * 角色 服务类 + * 角色表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt index b4e9acb..0a7ce40 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt @@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.User /** *- * 用户 服务类 + * 用户表 服务类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/ElementServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/ElementServiceImpl.kt index 70bb88f..6f644f5 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/ElementServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/ElementServiceImpl.kt @@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IElementService /** *- * 页面元素 服务实现类 + * 页面元素表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt index 92c06ae..f7f5694 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt @@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IGroupService /** *- * 用户组 服务实现类 + * 用户组表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt index d431903..cc18cde 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt @@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IMenuService /** *- * 菜单 服务实现类 + * 菜单表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/ModuleServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/ModuleServiceImpl.kt new file mode 100644 index 0000000..fbbe08b --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/ModuleServiceImpl.kt @@ -0,0 +1,18 @@ +package top.fatweb.api.service.permission.impl + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl +import org.springframework.stereotype.Service +import top.fatweb.api.entity.permission.Module +import top.fatweb.api.mapper.permission.ModuleMapper +import top.fatweb.api.service.permission.IModuleService + +/** + *+ * 模块表 服务实现类 + *
+ * + * @author FatttSnake + * @since 2023-10-25 + */ +@Service +class ModuleServiceImpl : ServiceImpl- * 功能 服务实现类 + * 功能表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt index 70fdc17..4c2b243 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt @@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IPowerService /** *- * 权限 服务实现类 + * 权限表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerTypeServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerTypeServiceImpl.kt index 481a0aa..d051131 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerTypeServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerTypeServiceImpl.kt @@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IPowerTypeService /** *- * 权限类型 服务实现类 + * 权限类型表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt index c75703d..34ab16a 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt @@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IRoleService /** *- * 角色 服务实现类 + * 角色表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt index 9537c90..914e421 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt @@ -12,7 +12,7 @@ import top.fatweb.api.util.WebUtil /** *- * 用户 服务实现类 + * 用户表 服务实现类 *
* * @author FatttSnake diff --git a/src/main/kotlin/top/fatweb/api/vo/authentication/OperationVo.kt b/src/main/kotlin/top/fatweb/api/vo/authentication/OperationVo.kt index 1af9f65..2a6fbfb 100644 --- a/src/main/kotlin/top/fatweb/api/vo/authentication/OperationVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/authentication/OperationVo.kt @@ -15,9 +15,6 @@ data class OperationVo( @Schema(description = "权限 ID") val powerId: Long?, - @Schema(description = "父 ID") - val parentId: 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 6b1e2a5..249c45d 100644 --- a/src/main/resources/db/migration/R__Basic_data.sql +++ b/src/main/resources/db/migration/R__Basic_data.sql @@ -1,73 +1,57 @@ insert into t_power_type (id, name) -values (1, 'menu'), - (2, 'element'), - (3, 'operation') +values (1, 'module'), + (2, 'menu'), + (3, 'element'), + (4, 'operation') on duplicate key update name = values(name); insert into t_power (id, type_id) -values (1010000, 1), - (1010100, 2), - (1010101, 3), - (100010000, 1), - (101010000, 1), - (101010100, 2), - (101010101, 3), - (101010102, 3), - (101010103, 3), - (101010104, 3), - (102010000, 1), - (102010100, 2), - (102010101, 3), - (102010102, 3), - (102010103, 3), - (102010104, 3), - (103010000, 1), - (103010100, 2), - (103010101, 3), - (103010102, 3), - (103010103, 3), - (103010104, 3), - (103010105, 3) +values (1000000, 1) on duplicate key update type_id = values(type_id); -insert into t_menu (id, name, url, power_id, parent_id) -values (001010000, '公用', '/', id, null), - (100010000, '系统管理', '/system', id, null), - (101010000, '角色管理(权限相关)', '/power/role', id, 100010000), - (102010000, '用户组管理(权限相关)', '/power/group', id, 100010000), - (103010000, '用户管理(权限相关)', '/power/user', id, 100010000) -on duplicate key update name = values(name), - url = values(url), - power_id = values(power_id), - parent_id = values(parent_id); +insert into t_module (id, name, power_id) +values (1000000, '系统', id); + +insert into t_menu (id, name, url, power_id, parent_id, module_id) +values (1010000, '用户管理', '/system/user', id, null, 1000000), + (1020000, '角色管理', '/system/role', id, null, 1000000), + (1030000, '用户组管理', '/system/group', id, null, 1000000) +on duplicate key update name =values(name), + url =values(url), + power_id =values(power_id), + parent_id =values(parent_id); insert into t_element(id, name, power_id, menu_id, parent_id) -values (1010100, '公用', id, 1010000, null), - (101010100, '角色基础', id, 101010000, null), - (102010100, '用户组基础', id, 102010000, null), - (103010100, '用户基础', id, 103010000, null) +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) on duplicate key update name = values(name), power_id=values(power_id), menu_id = values(menu_id), parent_id = values(parent_id); -insert into t_operation(id, name, code, power_id, element_id, parent_id) -values (1010101, '查询当前用户信息', 'common:user:self', id, 1010100, null), - (101010101, '查询所有角色', 'system:role:get', id, 101010100, null), - (101010102, '添加角色', 'system:role:add', id, 101010100, null), - (101010103, '删除角色', 'system:role:delete', id, 101010100, null), - (101010104, '修改角色', 'system:role:modify', id, 101010100, null), - (102010101, '查询所有用户组', 'system:group:get', id, 102010100, null), - (102010102, '添加用户组', 'system:group:add', id, 102010100, null), - (102010103, '删除用户组', 'system:group:delete', id, 102010100, null), - (102010104, '修改用户组', 'system:group:modify', id, 102010100, null), - (103010101, '查看所有用户', 'system:user:get', id, 103010100, null), - (103010102, '查看单个用户', 'system:user:one', id, 103010100, null), - (103010103, '添加用户', 'system:user:add', id, 103010100, null), - (103010104, '删除用户', 'system:user:delete', id, 103010100, null), - (103010105, '修改用户', 'system:user:modify', id, 103010100, null) +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) on duplicate key update name=values(name), code=values(code), power_id=values(power_id), - element_id=values(element_id), - parent_id=values(parent_id); \ No newline at end of file + element_id=values(element_id); \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231023__Add_table_'t_power_type'.sql b/src/main/resources/db/migration/V1_0_0_231023__Add_table_'t_power_type'.sql index 2096872..0ac9660 100644 --- a/src/main/resources/db/migration/V1_0_0_231023__Add_table_'t_power_type'.sql +++ b/src/main/resources/db/migration/V1_0_0_231023__Add_table_'t_power_type'.sql @@ -4,4 +4,4 @@ create table if not exists t_power_type ( id bigint not null primary key, name varchar(50) not null comment '权限类型名' -) comment '权限类型'; \ No newline at end of file +) comment '权限类型表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231024__Add_table_'t_power'.sql b/src/main/resources/db/migration/V1_0_0_231024__Add_table_'t_power'.sql index b7ba089..c6f1135 100644 --- a/src/main/resources/db/migration/V1_0_0_231024__Add_table_'t_power'.sql +++ b/src/main/resources/db/migration/V1_0_0_231024__Add_table_'t_power'.sql @@ -3,5 +3,5 @@ drop table if exists t_power; create table if not exists t_power ( id bigint not null primary key, - type_id bigint not null comment '权限类型' -) comment '权限'; \ No newline at end of file + type_id int not null comment '权限类型' +) comment '权限表'; \ 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 7d7e26f..a385605 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 @@ -6,5 +6,6 @@ create table if not exists t_menu 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' -) comment '菜单'; \ No newline at end of file + 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 9bbbe94..d371437 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 @@ -7,4 +7,4 @@ create table if not exists t_element 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 +) 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 b239e1b..fbe9c61 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 @@ -6,6 +6,5 @@ create table if not exists t_operation name varchar(50) not null comment '功能名', code varchar(50) null comment '功能编码', power_id bigint not null comment '权限ID', - parent_id bigint null comment '父ID', element_id bigint not null comment '页面元素ID' -) comment '功能'; \ No newline at end of file +) comment '功能表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231028__Add_table_'t_group'.sql b/src/main/resources/db/migration/V1_0_0_231028__Add_table_'t_group'.sql index 9a4d162..322da24 100644 --- a/src/main/resources/db/migration/V1_0_0_231028__Add_table_'t_group'.sql +++ b/src/main/resources/db/migration/V1_0_0_231028__Add_table_'t_group'.sql @@ -8,4 +8,4 @@ create table if not exists t_group deleted bigint not null default 0, version int not null default 0, constraint t_group_unique unique (name, deleted) -) comment '用户组'; \ No newline at end of file +) comment '用户组表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0_231030__Add_table_'t_role'.sql b/src/main/resources/db/migration/V1_0_0_231030__Add_table_'t_role'.sql index 7ace525..08cd98b 100644 --- a/src/main/resources/db/migration/V1_0_0_231030__Add_table_'t_role'.sql +++ b/src/main/resources/db/migration/V1_0_0_231030__Add_table_'t_role'.sql @@ -8,4 +8,4 @@ create table if not exists t_role deleted bigint not null default 0, version int not null default 0, constraint t_role_unique unique (name, deleted) -) comment '角色'; \ No newline at end of file +) 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 new file mode 100644 index 0000000..6af7c67 --- /dev/null +++ b/src/main/resources/db/migration/V1_0_0_231103__Add_table_'t_module'.sql @@ -0,0 +1,8 @@ +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' +) comment '模块表'; \ No newline at end of file diff --git a/src/main/resources/mapper/permission/ModuleMapper.xml b/src/main/resources/mapper/permission/ModuleMapper.xml new file mode 100644 index 0000000..4e9b314 --- /dev/null +++ b/src/main/resources/mapper/permission/ModuleMapper.xml @@ -0,0 +1,5 @@ + + +