Rename table t_element to t_func
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
insert into t_power_type (id, name)
|
||||
values (1, 'module'),
|
||||
(2, 'menu'),
|
||||
(3, 'element'),
|
||||
(3, 'func'),
|
||||
(4, 'operation') as new_value
|
||||
on duplicate key update name = new_value.name;
|
||||
|
||||
@@ -68,7 +68,7 @@ on duplicate key update name =new_value.name,
|
||||
url =new_value.url,
|
||||
parent_id =new_value.parent_id;
|
||||
|
||||
insert into t_element(id, name, menu_id, parent_id)
|
||||
insert into t_func(id, name, menu_id, parent_id)
|
||||
values (1010100, '查询', 1010000, null),
|
||||
(1010200, '增加', 1010000, null),
|
||||
(1010300, '修改', 1010000, null),
|
||||
@@ -87,7 +87,7 @@ on duplicate key update name = new_value.name,
|
||||
menu_id = new_value.menu_id,
|
||||
parent_id = new_value.parent_id;
|
||||
|
||||
insert into t_operation(id, name, code, element_id)
|
||||
insert into t_operation(id, name, code, func_id)
|
||||
values (1010101, '单个', 'system:user:query:one', 1010100),
|
||||
(1010102, '全部', 'system:user:query:all', 1010100),
|
||||
(1010103, '列表', 'system:user:query:list', 1010100),
|
||||
@@ -116,4 +116,4 @@ insert into t_operation(id, name, code, element_id)
|
||||
(1510101, '列表', 'system:log:query:all', 1510100) as new_value
|
||||
on duplicate key update name=new_value.name,
|
||||
code=new_value.code,
|
||||
element_id=new_value.element_id;
|
||||
func_id=new_value.func_id;
|
||||
@@ -1,9 +1,9 @@
|
||||
drop table if exists t_element;
|
||||
drop table if exists t_func;
|
||||
|
||||
create table if not exists t_element
|
||||
create table if not exists t_func
|
||||
(
|
||||
id bigint not null primary key,
|
||||
name varchar(100) not null comment '元素名',
|
||||
name varchar(100) not null comment '功能名',
|
||||
parent_id bigint null comment '父ID',
|
||||
menu_id bigint not null comment '菜单ID'
|
||||
) comment '页面元素表';
|
||||
) comment '功能表';
|
||||
@@ -3,7 +3,7 @@ drop table if exists t_operation;
|
||||
create table if not exists t_operation
|
||||
(
|
||||
id bigint not null primary key,
|
||||
name varchar(50) not null comment '功能名',
|
||||
code varchar(50) null comment '功能编码',
|
||||
element_id bigint not null comment '页面元素ID'
|
||||
) comment '功能表';
|
||||
name varchar(50) not null comment '操作名',
|
||||
code varchar(50) null comment '操作编码',
|
||||
func_id bigint not null comment '功能ID'
|
||||
) comment '操作表';
|
||||
@@ -1,10 +0,0 @@
|
||||
<?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.ElementMapper">
|
||||
<resultMap id="elementMap" type="element">
|
||||
<id property="id" column="element_id"/>
|
||||
<result property="name" column="element_name"/>
|
||||
<result property="parentId" column="element_parent_id"/>
|
||||
<result property="menuId" column="element_menu_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
10
src/main/resources/mapper/permission/FuncMapper.xml
Normal file
10
src/main/resources/mapper/permission/FuncMapper.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?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.FuncMapper">
|
||||
<resultMap id="funcMap" type="func">
|
||||
<id property="id" column="func_id"/>
|
||||
<result property="name" column="func_name"/>
|
||||
<result property="parentId" column="func_parent_id"/>
|
||||
<result property="menuId" column="func_menu_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -5,6 +5,6 @@
|
||||
<id property="id" column="operation_id"/>
|
||||
<result property="name" column="operation_name"/>
|
||||
<result property="code" column="operation_code"/>
|
||||
<result property="elementId" column="operation_element_id"/>
|
||||
<result property="funcId" column="operation_func_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
|
||||
@@ -34,20 +34,20 @@
|
||||
tmn.url as menu_url,
|
||||
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.parent_id as element_parent_id,
|
||||
te.menu_id as element_menu_id,
|
||||
tf.id as func_id,
|
||||
tf.name as func_name,
|
||||
tf.parent_id as func_parent_id,
|
||||
tf.menu_id as func_menu_id,
|
||||
t.id as operation_id,
|
||||
t.name as operation_name,
|
||||
t.code as operation_code,
|
||||
t.element_id as operation_element_id
|
||||
t.func_id as operation_func_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.id
|
||||
left join t_menu tmn on tp.id = tmn.id
|
||||
left join t_element te on tp.id = te.id
|
||||
left join t_func tf on tp.id = tf.id
|
||||
left join t_operation t on tp.id = t.id
|
||||
<where>
|
||||
<foreach collection="roleIds" item="item" index="index" open="and t_role.id in (" separator="," close=")"
|
||||
@@ -72,20 +72,20 @@
|
||||
tmn.url as menu_url,
|
||||
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.parent_id as element_parent_id,
|
||||
te.menu_id as element_menu_id,
|
||||
tf.id as func_id,
|
||||
tf.name as func_name,
|
||||
tf.parent_id as func_parent_id,
|
||||
tf.menu_id as func_menu_id,
|
||||
t.id as operation_id,
|
||||
t.name as operation_name,
|
||||
t.code as operation_code,
|
||||
t.element_id as operation_element_id
|
||||
t.func_id as operation_func_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.id
|
||||
left join t_menu tmn on tp.id = tmn.id
|
||||
left join t_element te on tp.id = te.id
|
||||
left join t_func tf on tp.id = tf.id
|
||||
left join t_operation t on tp.id = t.id
|
||||
where t_role.id = #{id}
|
||||
</select>
|
||||
@@ -103,7 +103,7 @@
|
||||
<resultMap id="roleWithPowerMap" type="role" extends="roleMap">
|
||||
<collection property="modules" resultMap="top.fatweb.api.mapper.permission.ModuleMapper.moduleMap"/>
|
||||
<collection property="menus" resultMap="top.fatweb.api.mapper.permission.MenuMapper.menuMap"/>
|
||||
<collection property="elements" resultMap="top.fatweb.api.mapper.permission.ElementMapper.elementMap"/>
|
||||
<collection property="funcs" resultMap="top.fatweb.api.mapper.permission.FuncMapper.funcMap"/>
|
||||
<collection property="operations" resultMap="top.fatweb.api.mapper.permission.OperationMapper.operationMap"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
|
||||
@@ -32,14 +32,14 @@
|
||||
tm.name as menu_name,
|
||||
tm.url as menu_url,
|
||||
tm.parent_id as menu_parent_id,
|
||||
te.id as element_id,
|
||||
te.name as element_name,
|
||||
te.parent_id as element_parent_id,
|
||||
te.menu_id as element_menu_id,
|
||||
tf.id as func_id,
|
||||
tf.name as func_name,
|
||||
tf.parent_id as func_parent_id,
|
||||
tf.menu_id as func_menu_id,
|
||||
t.id as operation_id,
|
||||
t.name as operation_name,
|
||||
t.code as operation_code,
|
||||
t.element_id as operation_element_id
|
||||
t.func_id as operation_func_id
|
||||
from t_user
|
||||
left join (select * from t_user_info where deleted = 0) as tui on t_user.id = tui.user_id
|
||||
left join (select * from t_user_group where deleted = 0) as tug on t_user.id = tug.user_id
|
||||
@@ -52,7 +52,7 @@
|
||||
left join t_power as tp on tp.id = tpr.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_func as tf on tp.id = tf.id
|
||||
left join t_operation as t on tp.id = t.id
|
||||
where t_user.deleted = 0
|
||||
and t_user.username = #{username};
|
||||
@@ -276,7 +276,7 @@
|
||||
<result property="password" column="user_password"/>
|
||||
<collection property="modules" resultMap="top.fatweb.api.mapper.permission.ModuleMapper.moduleMap"/>
|
||||
<collection property="menus" resultMap="top.fatweb.api.mapper.permission.MenuMapper.menuMap"/>
|
||||
<collection property="elements" resultMap="top.fatweb.api.mapper.permission.ElementMapper.elementMap"/>
|
||||
<collection property="funcs" resultMap="top.fatweb.api.mapper.permission.FuncMapper.funcMap"/>
|
||||
<collection property="operations" resultMap="top.fatweb.api.mapper.permission.OperationMapper.operationMap"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user