Reconstruct the permission system
This commit is contained in:
@@ -10,7 +10,7 @@ import top.fatweb.api.vo.authentication.UserInfoVo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户 前端控制器
|
* 用户表 前端控制器
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ object UserConverter {
|
|||||||
name = it.name,
|
name = it.name,
|
||||||
code = it.code,
|
code = it.code,
|
||||||
powerId = it.powerId,
|
powerId = it.powerId,
|
||||||
parentId = it.parentId,
|
|
||||||
elementId = it.elementId
|
elementId = it.elementId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 页面元素
|
* 页面元素表
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户组
|
* 用户组表
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 菜单
|
* 菜单表
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
@@ -43,7 +43,13 @@ class Menu : Serializable {
|
|||||||
@TableField("parent_id")
|
@TableField("parent_id")
|
||||||
var parentId: Long? = null
|
var parentId: Long? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块ID
|
||||||
|
*/
|
||||||
|
@TableField("module_id")
|
||||||
|
var moduleId: Long? = null
|
||||||
|
|
||||||
override fun toString(): String {
|
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)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
38
src/main/kotlin/top/fatweb/api/entity/permission/Module.kt
Normal file
38
src/main/kotlin/top/fatweb/api/entity/permission/Module.kt
Normal file
@@ -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
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 模块表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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)"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 功能
|
* 功能表
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
@@ -37,12 +37,6 @@ class Operation : Serializable {
|
|||||||
@TableField("power_id")
|
@TableField("power_id")
|
||||||
var powerId: Long? = null
|
var powerId: Long? = null
|
||||||
|
|
||||||
/**
|
|
||||||
* 父ID
|
|
||||||
*/
|
|
||||||
@TableField("parent_id")
|
|
||||||
var parentId: Long? = null
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面元素ID
|
* 页面元素ID
|
||||||
*/
|
*/
|
||||||
@@ -50,6 +44,6 @@ class Operation : Serializable {
|
|||||||
var elementId: Long? = null
|
var elementId: Long? = null
|
||||||
|
|
||||||
override fun toString(): String {
|
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)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限
|
* 权限表
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
@@ -23,7 +23,7 @@ class Power : Serializable {
|
|||||||
* 权限类型
|
* 权限类型
|
||||||
*/
|
*/
|
||||||
@TableField("type_id")
|
@TableField("type_id")
|
||||||
var typeId: Long? = null
|
var typeId: Int? = null
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Power(id=$id, typeId=$typeId)"
|
return "Power(id=$id, typeId=$typeId)"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限类型
|
* 权限类型表
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 角色
|
* 角色表
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Element
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 页面元素 Mapper 接口
|
* 页面元素表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Group
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户组 Mapper 接口
|
* 用户组表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Menu
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 菜单 Mapper 接口
|
* 菜单表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 模块表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author FatttSnake
|
||||||
|
* @since 2023-10-25
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
interface ModuleMapper : BaseMapper<Module>
|
||||||
@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Operation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 功能 Mapper 接口
|
* 功能表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Power
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限 Mapper 接口
|
* 权限表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.PowerType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限类型 Mapper 接口
|
* 权限类型表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Role
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 角色 Mapper 接口
|
* 角色表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import top.fatweb.api.entity.permission.User
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户 Mapper 接口
|
* 用户表 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Element
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 页面元素 服务类
|
* 页面元素表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Group
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户组 服务类
|
* 用户组表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Menu
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 菜单 服务类
|
* 菜单表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package top.fatweb.api.service.permission
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService
|
||||||
|
import top.fatweb.api.entity.permission.Module
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 模块表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author FatttSnake
|
||||||
|
* @since 2023-10-25
|
||||||
|
*/
|
||||||
|
interface IModuleService : IService<Module>
|
||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Operation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 功能 服务类
|
* 功能表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Power
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限 服务类
|
* 权限表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.PowerType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限类型 服务类
|
* 权限类型表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Role
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 角色 服务类
|
* 角色表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.User
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户 服务类
|
* 用户表 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IElementService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 页面元素 服务实现类
|
* 页面元素表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IGroupService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户组 服务实现类
|
* 用户组表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IMenuService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 菜单 服务实现类
|
* 菜单表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 模块表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author FatttSnake
|
||||||
|
* @since 2023-10-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
class ModuleServiceImpl : ServiceImpl<ModuleMapper, Module>(), IModuleService
|
||||||
@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IOperationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 功能 服务实现类
|
* 功能表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IPowerService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限 服务实现类
|
* 权限表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IPowerTypeService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 权限类型 服务实现类
|
* 权限类型表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IRoleService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 角色 服务实现类
|
* 角色表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import top.fatweb.api.util.WebUtil
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户 服务实现类
|
* 用户表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author FatttSnake
|
* @author FatttSnake
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ data class OperationVo(
|
|||||||
@Schema(description = "权限 ID")
|
@Schema(description = "权限 ID")
|
||||||
val powerId: Long?,
|
val powerId: Long?,
|
||||||
|
|
||||||
@Schema(description = "父 ID")
|
|
||||||
val parentId: Long?,
|
|
||||||
|
|
||||||
@Schema(description = "页面元素 ID")
|
@Schema(description = "页面元素 ID")
|
||||||
val elementId: Long?
|
val elementId: Long?
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,73 +1,57 @@
|
|||||||
insert into t_power_type (id, name)
|
insert into t_power_type (id, name)
|
||||||
values (1, 'menu'),
|
values (1, 'module'),
|
||||||
(2, 'element'),
|
(2, 'menu'),
|
||||||
(3, 'operation')
|
(3, 'element'),
|
||||||
|
(4, 'operation')
|
||||||
on duplicate key update name = values(name);
|
on duplicate key update name = values(name);
|
||||||
|
|
||||||
insert into t_power (id, type_id)
|
insert into t_power (id, type_id)
|
||||||
values (1010000, 1),
|
values (1000000, 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)
|
|
||||||
on duplicate key update type_id = values(type_id);
|
on duplicate key update type_id = values(type_id);
|
||||||
|
|
||||||
insert into t_menu (id, name, url, power_id, parent_id)
|
insert into t_module (id, name, power_id)
|
||||||
values (001010000, '公用', '/', id, null),
|
values (1000000, '系统', id);
|
||||||
(100010000, '系统管理', '/system', id, null),
|
|
||||||
(101010000, '角色管理(权限相关)', '/power/role', id, 100010000),
|
insert into t_menu (id, name, url, power_id, parent_id, module_id)
|
||||||
(102010000, '用户组管理(权限相关)', '/power/group', id, 100010000),
|
values (1010000, '用户管理', '/system/user', id, null, 1000000),
|
||||||
(103010000, '用户管理(权限相关)', '/power/user', id, 100010000)
|
(1020000, '角色管理', '/system/role', id, null, 1000000),
|
||||||
on duplicate key update name = values(name),
|
(1030000, '用户组管理', '/system/group', id, null, 1000000)
|
||||||
url = values(url),
|
on duplicate key update name =values(name),
|
||||||
power_id = values(power_id),
|
url =values(url),
|
||||||
parent_id = values(parent_id);
|
power_id =values(power_id),
|
||||||
|
parent_id =values(parent_id);
|
||||||
|
|
||||||
insert into t_element(id, name, power_id, menu_id, parent_id)
|
insert into t_element(id, name, power_id, menu_id, parent_id)
|
||||||
values (1010100, '公用', id, 1010000, null),
|
values (1010100, '查询', id, 1010000, null),
|
||||||
(101010100, '角色基础', id, 101010000, null),
|
(1010200, '增加', id, 1010000, 1010100),
|
||||||
(102010100, '用户组基础', id, 102010000, null),
|
(1010300, '修改', id, 1010000, 1010100),
|
||||||
(103010100, '用户基础', id, 103010000, null)
|
(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),
|
on duplicate key update name = values(name),
|
||||||
power_id=values(power_id),
|
power_id=values(power_id),
|
||||||
menu_id = values(menu_id),
|
menu_id = values(menu_id),
|
||||||
parent_id = values(parent_id);
|
parent_id = values(parent_id);
|
||||||
|
|
||||||
insert into t_operation(id, name, code, power_id, element_id, parent_id)
|
insert into t_operation(id, name, code, power_id, element_id)
|
||||||
values (1010101, '查询当前用户信息', 'common:user:self', id, 1010100, null),
|
values (1010101, '全部', 'system:user:query:all', id, 1010100),
|
||||||
(101010101, '查询所有角色', 'system:role:get', id, 101010100, null),
|
(1010102, '单个', 'system:user:query:one', id, 1010100),
|
||||||
(101010102, '添加角色', 'system:role:add', id, 101010100, null),
|
(1010201, '全部', 'system:user:add:all', id, 1010200),
|
||||||
(101010103, '删除角色', 'system:role:delete', id, 101010100, null),
|
(1010301, '全部', 'system:user:modify:all', id, 1010300),
|
||||||
(101010104, '修改角色', 'system:role:modify', id, 101010100, null),
|
(1020101, '全部', 'system:role:query:all', id, 1020100),
|
||||||
(102010101, '查询所有用户组', 'system:group:get', id, 102010100, null),
|
(1020201, '全部', 'system:role:add:all', id, 1020200),
|
||||||
(102010102, '添加用户组', 'system:group:add', id, 102010100, null),
|
(1020301, '全部', 'system:role:modify:all', id, 1020300),
|
||||||
(102010103, '删除用户组', 'system:group:delete', id, 102010100, null),
|
(1020401, '全部', 'system:role:delete:all', id, 1020400),
|
||||||
(102010104, '修改用户组', 'system:group:modify', id, 102010100, null),
|
(1030101, '全部', 'system:group:query:all', id, 1030100),
|
||||||
(103010101, '查看所有用户', 'system:user:get', id, 103010100, null),
|
(1030201, '全部', 'system:group:add:all', id, 1030200),
|
||||||
(103010102, '查看单个用户', 'system:user:one', id, 103010100, null),
|
(1030301, '全部', 'system:group:modify:all', id, 1030300),
|
||||||
(103010103, '添加用户', 'system:user:add', id, 103010100, null),
|
(1030401, '全部', 'system:group:delete:all', id, 1030400)
|
||||||
(103010104, '删除用户', 'system:user:delete', id, 103010100, null),
|
|
||||||
(103010105, '修改用户', 'system:user:modify', id, 103010100, null)
|
|
||||||
on duplicate key update name=values(name),
|
on duplicate key update name=values(name),
|
||||||
code=values(code),
|
code=values(code),
|
||||||
power_id=values(power_id),
|
power_id=values(power_id),
|
||||||
element_id=values(element_id),
|
element_id=values(element_id);
|
||||||
parent_id=values(parent_id);
|
|
||||||
@@ -4,4 +4,4 @@ create table if not exists t_power_type
|
|||||||
(
|
(
|
||||||
id bigint not null primary key,
|
id bigint not null primary key,
|
||||||
name varchar(50) not null comment '权限类型名'
|
name varchar(50) not null comment '权限类型名'
|
||||||
) comment '权限类型';
|
) comment '权限类型表';
|
||||||
@@ -3,5 +3,5 @@ drop table if exists t_power;
|
|||||||
create table if not exists t_power
|
create table if not exists t_power
|
||||||
(
|
(
|
||||||
id bigint not null primary key,
|
id bigint not null primary key,
|
||||||
type_id bigint not null comment '权限类型'
|
type_id int not null comment '权限类型'
|
||||||
) comment '权限';
|
) comment '权限表';
|
||||||
@@ -6,5 +6,6 @@ create table if not exists t_menu
|
|||||||
name varchar(30) not null comment ' 菜单名',
|
name varchar(30) not null comment ' 菜单名',
|
||||||
url varchar(100) null comment 'URL',
|
url varchar(100) null comment 'URL',
|
||||||
power_id bigint not null comment '权限ID',
|
power_id bigint not null comment '权限ID',
|
||||||
parent_id bigint null comment '父ID'
|
parent_id bigint null comment '父ID',
|
||||||
) comment '菜单';
|
module_id bigint not null comment '模块ID'
|
||||||
|
) comment '菜单表';
|
||||||
@@ -7,4 +7,4 @@ create table if not exists t_element
|
|||||||
power_id bigint not null comment '权限ID',
|
power_id bigint not null comment '权限ID',
|
||||||
parent_id bigint null comment '父ID',
|
parent_id bigint null comment '父ID',
|
||||||
menu_id bigint not null comment '菜单ID'
|
menu_id bigint not null comment '菜单ID'
|
||||||
) comment '页面元素';
|
) comment '页面元素表';
|
||||||
@@ -6,6 +6,5 @@ create table if not exists t_operation
|
|||||||
name varchar(50) not null comment '功能名',
|
name varchar(50) not null comment '功能名',
|
||||||
code varchar(50) null comment '功能编码',
|
code varchar(50) null comment '功能编码',
|
||||||
power_id bigint not null comment '权限ID',
|
power_id bigint not null comment '权限ID',
|
||||||
parent_id bigint null comment '父ID',
|
|
||||||
element_id bigint not null comment '页面元素ID'
|
element_id bigint not null comment '页面元素ID'
|
||||||
) comment '功能';
|
) comment '功能表';
|
||||||
@@ -8,4 +8,4 @@ create table if not exists t_group
|
|||||||
deleted bigint not null default 0,
|
deleted bigint not null default 0,
|
||||||
version int not null default 0,
|
version int not null default 0,
|
||||||
constraint t_group_unique unique (name, deleted)
|
constraint t_group_unique unique (name, deleted)
|
||||||
) comment '用户组';
|
) comment '用户组表';
|
||||||
@@ -8,4 +8,4 @@ create table if not exists t_role
|
|||||||
deleted bigint not null default 0,
|
deleted bigint not null default 0,
|
||||||
version int not null default 0,
|
version int not null default 0,
|
||||||
constraint t_role_unique unique (name, deleted)
|
constraint t_role_unique unique (name, deleted)
|
||||||
) comment '角色';
|
) comment '角色表';
|
||||||
@@ -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 '模块表';
|
||||||
5
src/main/resources/mapper/permission/ModuleMapper.xml
Normal file
5
src/main/resources/mapper/permission/ModuleMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.ModuleMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user