Complete core functions #9

Merged
FatttSnake merged 171 commits from FatttSnake into dev 2024-02-23 11:56:35 +08:00
48 changed files with 191 additions and 112 deletions
Showing only changes of commit 69680dd4ad - Show all commits

View File

@@ -10,7 +10,7 @@ import top.fatweb.api.vo.authentication.UserInfoVo
/**
* <p>
* 用户 前端控制器
* 用户 前端控制器
* </p>
*
* @author FatttSnake

View File

@@ -54,7 +54,6 @@ object UserConverter {
name = it.name,
code = it.code,
powerId = it.powerId,
parentId = it.parentId,
elementId = it.elementId
)
}

View File

@@ -7,7 +7,7 @@ import java.io.Serializable
/**
* <p>
* 页面元素
* 页面元素
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import java.io.Serializable
/**
* <p>
* 用户组
* 用户组
* </p>
*
* @author FatttSnake

View File

@@ -7,7 +7,7 @@ import java.io.Serializable
/**
* <p>
* 菜单
* 菜单
* </p>
*
* @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)"
}
}

View 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)"
}
}

View File

@@ -7,7 +7,7 @@ import java.io.Serializable
/**
* <p>
* 功能
* 功能
* </p>
*
* @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)"
}
}

View File

@@ -7,7 +7,7 @@ import java.io.Serializable
/**
* <p>
* 权限
* 权限
* </p>
*
* @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)"

View File

@@ -7,7 +7,7 @@ import java.io.Serializable
/**
* <p>
* 权限类型
* 权限类型
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import java.io.Serializable
/**
* <p>
* 角色
* 角色
* </p>
*
* @author FatttSnake

View File

@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Element
/**
* <p>
* 页面元素 Mapper 接口
* 页面元素 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Group
/**
* <p>
* 用户组 Mapper 接口
* 用户组 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Menu
/**
* <p>
* 菜单 Mapper 接口
* 菜单 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -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>

View File

@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Operation
/**
* <p>
* 功能 Mapper 接口
* 功能 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Power
/**
* <p>
* 权限 Mapper 接口
* 权限 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.PowerType
/**
* <p>
* 权限类型 Mapper 接口
* 权限类型 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -6,7 +6,7 @@ import top.fatweb.api.entity.permission.Role
/**
* <p>
* 角色 Mapper 接口
* 角色 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -7,7 +7,7 @@ import top.fatweb.api.entity.permission.User
/**
* <p>
* 用户 Mapper 接口
* 用户 Mapper 接口
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Element
/**
* <p>
* 页面元素 服务类
* 页面元素 服务类
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Group
/**
* <p>
* 用户组 服务类
* 用户组 服务类
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Menu
/**
* <p>
* 菜单 服务类
* 菜单 服务类
* </p>
*
* @author FatttSnake

View File

@@ -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>

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Operation
/**
* <p>
* 功能 服务类
* 功能 服务类
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Power
/**
* <p>
* 权限 服务类
* 权限 服务类
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.PowerType
/**
* <p>
* 权限类型 服务类
* 权限类型 服务类
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.Role
/**
* <p>
* 角色 服务类
* 角色 服务类
* </p>
*
* @author FatttSnake

View File

@@ -5,7 +5,7 @@ import top.fatweb.api.entity.permission.User
/**
* <p>
* 用户 服务类
* 用户 服务类
* </p>
*
* @author FatttSnake

View File

@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IElementService
/**
* <p>
* 页面元素 服务实现类
* 页面元素 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IGroupService
/**
* <p>
* 用户组 服务实现类
* 用户组 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IMenuService
/**
* <p>
* 菜单 服务实现类
* 菜单 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -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

View File

@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IOperationService
/**
* <p>
* 功能 服务实现类
* 功能 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IPowerService
/**
* <p>
* 权限 服务实现类
* 权限 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IPowerTypeService
/**
* <p>
* 权限类型 服务实现类
* 权限类型 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -8,7 +8,7 @@ import top.fatweb.api.service.permission.IRoleService
/**
* <p>
* 角色 服务实现类
* 角色 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -12,7 +12,7 @@ import top.fatweb.api.util.WebUtil
/**
* <p>
* 用户 服务实现类
* 用户 服务实现类
* </p>
*
* @author FatttSnake

View File

@@ -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?
)

View File

@@ -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)
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);
element_id=values(element_id);

View File

@@ -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 '权限类型';
) comment '权限类型';

View File

@@ -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 '权限';
type_id int not null comment '权限类型'
) comment '权限';

View File

@@ -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 '菜单';
parent_id bigint null comment '父ID',
module_id bigint not null comment '模块ID'
) comment '菜单表';

View File

@@ -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 '页面元素';
) comment '页面元素';

View File

@@ -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 '功能';
) comment '功能';

View File

@@ -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 '用户组';
) comment '用户组';

View File

@@ -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 '角色';
) comment '角色';

View File

@@ -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 '模块表';

View 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>