完善表索引

This commit is contained in:
WenG 2021-02-17 18:53:45 +08:00
parent fdf4dd59b6
commit 57443e5825
10 changed files with 222 additions and 81 deletions

View File

@ -36,8 +36,8 @@
`gmt_modified` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL,
`is_delete` int(2) DEFAULT '0', `is_delete` int(2) DEFAULT '0',
PRIMARY KEY (`id`,`data_id`), PRIMARY KEY (`id`,`data_id`),
KEY `is_delete_index` (`is_delete`) USING BTREE, UNIQUE KEY `data_id` (`data_id`) USING BTREE,
KEY `data_id` (`data_id`) USING BTREE KEY `is_delete_index` (`is_delete`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</update> </update>

View File

@ -57,7 +57,8 @@
`modifier` char(36) DEFAULT NULL COMMENT '修改人', `modifier` char(36) DEFAULT NULL COMMENT '修改人',
`gmt_modified` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL,
`is_delete` int(2) DEFAULT '0', `is_delete` int(2) DEFAULT '0',
PRIMARY KEY (`id`,`file_id`) PRIMARY KEY (`id`,`file_id`),
UNIQUE KEY `file_id` (`file_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</update> </update>

View File

@ -22,14 +22,16 @@
`permission_title` varchar(255) DEFAULT NULL COMMENT '权限标题', `permission_title` varchar(255) DEFAULT NULL COMMENT '权限标题',
`permission_type` varchar(255) DEFAULT NULL COMMENT '权限类型', `permission_type` varchar(255) DEFAULT NULL COMMENT '权限类型',
`permission_url` varchar(255) DEFAULT NULL COMMENT '权限路径', `permission_url` varchar(255) DEFAULT NULL COMMENT '权限路径',
`permission_client_id` varchar(255) DEFAULT NULL COMMENT '客户端', `system_tag` varchar(255) DEFAULT NULL COMMENT '系统标识系统路径NULL表示本系统',
`is_public` int(11) DEFAULT NULL COMMENT '是否公共', `is_public` int(11) DEFAULT NULL COMMENT '是否公共',
`creator` char(36) DEFAULT NULL, `creator` char(36) DEFAULT NULL,
`gmt_create` datetime DEFAULT NULL, `gmt_create` datetime DEFAULT NULL,
`modifier` char(36) DEFAULT NULL, `modifier` char(36) DEFAULT NULL,
`gmt_modified` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL,
`is_delete` int(1) DEFAULT '0', `is_delete` int(1) DEFAULT '0',
PRIMARY KEY (`id`,`permission_id`) PRIMARY KEY (`id`,`permission_id`),
UNIQUE KEY `permission_id` (`permission_id`),
KEY `system_tag` (`system_tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</update> </update>
@ -140,24 +142,15 @@
t1.permission_type, t1.permission_type,
t1.permission_url, t1.permission_url,
t1.permission_client_id, t1.permission_client_id,
jt1.client_name permission_client_name,
t1.is_public, t1.is_public,
t1.permission_id t1.permission_id
FROM FROM
sys_permission t1 sys_permission t1
LEFT JOIN
oauth_client_details jt1
ON
jt1.client_id = t1.permission_client_id
AND
jt1.is_delete = 0
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.permission_title LIKE CONCAT('%', #{keywords}, '%') t1.permission_title LIKE CONCAT('%', #{keywords}, '%')
OR
jt1.client_name LIKE CONCAT('%', #{keywords}, '%')
) )
</if> </if>
<if test="permissionType != null and permissionType != ''"> <if test="permissionType != null and permissionType != ''">

View File

@ -77,61 +77,63 @@
pageName: 'page', pageName: 'page',
limitName: 'rows' limitName: 'rows'
}, },
cols: [[ cols: [
{type:'checkbox', fixed: 'left'}, [
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'}, {type:'checkbox', fixed: 'left'},
{field: 'permissionUrl', width: 300, title: '权限路径', align:'center', {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
templet: function(row) { {field: 'permissionUrl', width: 300, title: '权限路径', align:'center',
var rowData = row[this.field]; templet: function(row) {
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { var rowData = row[this.field];
return '-'; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
} }
return rowData; },
} {field:'permissionTitle', width:200, title: '权限名称', align:'center'},
}, {field: 'permissionType', width: 100, title: '权限类型', align:'center',
{field:'permissionTitle', width:200, title: '权限名称', align:'center'}, templet: function(row) {
{field: 'permissionType', width: 100, title: '权限类型', align:'center', var rowData = row[this.field];
templet: function(row) { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
var rowData = row[this.field]; return '-';
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { }
return '-'; if(rowData == 'permissionInsert') {
return '新增权限';
} else if(rowData == 'permissionDelete') {
return '删除权限';
} else if(rowData == 'permissionUpdate') {
return '更新权限';
} else if(rowData == 'permissionQuery') {
return '查询权限';
}
return '错误';
} }
if(rowData == 'permissionInsert') { },
return '新增权限'; {field: 'permissionClientName', width: 180, title: '客户端名称', align:'center',
} else if(rowData == 'permissionDelete') { templet: function(row) {
return '删除权限'; var rowData = row[this.field];
} else if(rowData == 'permissionUpdate') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '更新权限'; return '-';
} else if(rowData == 'permissionQuery') { }
return '查询权限'; return rowData;
} }
return '错误'; },
} {field: 'isPublic', width: 100, title: '公共接口', align:'center',
}, templet: function(row) {
{field: 'permissionClientName', width: 180, title: '客户端名称', align:'center', var rowData = row[this.field];
templet: function(row) { if(typeof(rowData) === 'undefined' || rowData == null) {
var rowData = row[this.field]; return '-';
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { }
return '-'; if(rowData == '0') {
return '否';
} else if(rowData == '1') {
return '是';
}
return '错误';
} }
return rowData; },
} ]
}, ],
{field: 'isPublic', width: 100, title: '公共接口', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null) {
return '-';
}
if(rowData == '0') {
return '否';
} else if(rowData == '1') {
return '是';
}
return '错误';
}
},
]],
page: true, page: true,
parseData: function(data) { parseData: function(data) {
return { return {

View File

@ -135,7 +135,7 @@
`gmt_modified` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL,
`is_delete` int(2) DEFAULT '0', `is_delete` int(2) DEFAULT '0',
PRIMARY KEY (`id`,`department_id`), PRIMARY KEY (`id`,`department_id`),
KEY `department_id_idx` (`department_id`) USING BTREE UNIQUE KEY `department_id` (`department_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</update> </update>

View File

@ -47,7 +47,8 @@
`modifier` char(36) DEFAULT NULL, `modifier` char(36) DEFAULT NULL,
`gmt_modified` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL,
`is_delete` int(2) DEFAULT '0', `is_delete` int(2) DEFAULT '0',
PRIMARY KEY (`id`,`group_id`) PRIMARY KEY (`id`,`group_id`),
UNIQUE KEY `group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</update> </update>

View File

@ -90,6 +90,7 @@ public class ServiceMenuStartUp implements ApplicationRunner {
} }
initSystemManage(params, menuId); initSystemManage(params, menuId);
initUserPermissionManage(params, menuId); initUserPermissionManage(params, menuId);
initPermissionManager(params, menuId);
} }
private void initSystemManage(Map<String, Object> params, String menuParentId) { private void initSystemManage(Map<String, Object> params, String menuParentId) {
@ -133,8 +134,8 @@ public class ServiceMenuStartUp implements ApplicationRunner {
if (menuDTO == null) { if (menuDTO == null) {
params.put("menuId", UUIDUtil.getUUID()); params.put("menuId", UUIDUtil.getUUID());
params.put("menuParentId", menuParentId); params.put("menuParentId", menuParentId);
params.put("menuName", "菜单管理"); params.put("menuName", "菜单");
params.put("menuSummary", "菜单管理"); params.put("menuSummary", "菜单");
params.put("menuUrl", "/route/menu/list-tree"); params.put("menuUrl", "/route/menu/list-tree");
params.put("menuType", "1"); params.put("menuType", "1");
params.put("menuIcon", "fa-icon-color-white fa fa-list"); params.put("menuIcon", "fa-icon-color-white fa fa-list");
@ -210,7 +211,7 @@ public class ServiceMenuStartUp implements ApplicationRunner {
* @param menuParentId * @param menuParentId
*/ */
private void initUserPermissionManage(Map<String, Object> params, String menuParentId) { private void initUserPermissionManage(Map<String, Object> params, String menuParentId) {
LOG.debug("初始化菜单:用户与权限"); LOG.debug("初始化菜单:用户管理");
params.remove("menuId"); params.remove("menuId");
params.put("menuCode", "00010002"); params.put("menuCode", "00010002");
MenuDTO menuDTO = menuDao.getSimple(params); MenuDTO menuDTO = menuDao.getSimple(params);
@ -219,8 +220,8 @@ public class ServiceMenuStartUp implements ApplicationRunner {
menuId = UUIDUtil.getUUID(); menuId = UUIDUtil.getUUID();
params.put("menuId", menuId); params.put("menuId", menuId);
params.put("menuParentId", menuParentId); params.put("menuParentId", menuParentId);
params.put("menuName", "用户与权限"); params.put("menuName", "用户管理");
params.put("menuSummary", "用户与权限"); params.put("menuSummary", "用户管理");
params.put("menuUrl", "javascript:void(0);"); params.put("menuUrl", "javascript:void(0);");
params.put("menuType", "1"); params.put("menuType", "1");
params.put("menuIcon", "fa-icon-color-white fa fa-users"); params.put("menuIcon", "fa-icon-color-white fa fa-users");
@ -256,7 +257,7 @@ public class ServiceMenuStartUp implements ApplicationRunner {
if (menuDTO == null) { if (menuDTO == null) {
params.put("menuId", menuId); params.put("menuId", menuId);
params.put("menuParentId", menuParentId); params.put("menuParentId", menuParentId);
params.put("menuName", "用户管理"); params.put("menuName", "用户");
params.put("menuSummary", "用户管理"); params.put("menuSummary", "用户管理");
params.put("menuUrl", "/route/user/list"); params.put("menuUrl", "/route/user/list");
params.put("menuType", "1"); params.put("menuType", "1");
@ -287,7 +288,7 @@ public class ServiceMenuStartUp implements ApplicationRunner {
if (menuDTO == null) { if (menuDTO == null) {
params.put("menuId", menuId); params.put("menuId", menuId);
params.put("menuParentId", menuParentId); params.put("menuParentId", menuParentId);
params.put("menuName", "机构管理"); params.put("menuName", "机构");
params.put("menuSummary", "机构管理"); params.put("menuSummary", "机构管理");
params.put("menuUrl", "/route/department/list-tree"); params.put("menuUrl", "/route/department/list-tree");
params.put("menuType", "1"); params.put("menuType", "1");
@ -318,7 +319,7 @@ public class ServiceMenuStartUp implements ApplicationRunner {
if (menuDTO == null) { if (menuDTO == null) {
params.put("menuId", menuId); params.put("menuId", menuId);
params.put("menuParentId", menuParentId); params.put("menuParentId", menuParentId);
params.put("menuName", "用户组管理"); params.put("menuName", "用户组");
params.put("menuSummary", "用户组管理"); params.put("menuSummary", "用户组管理");
params.put("menuUrl", "/route/group/list-tree"); params.put("menuUrl", "/route/group/list-tree");
params.put("menuType", "1"); params.put("menuType", "1");
@ -348,7 +349,7 @@ public class ServiceMenuStartUp implements ApplicationRunner {
if (menuDTO == null) { if (menuDTO == null) {
params.put("menuId", menuId); params.put("menuId", menuId);
params.put("menuParentId", menuParentId); params.put("menuParentId", menuParentId);
params.put("menuName", "职位管理"); params.put("menuName", "职位");
params.put("menuSummary", "职位管理"); params.put("menuSummary", "职位管理");
params.put("menuUrl", "/route/position/list-tree"); params.put("menuUrl", "/route/position/list-tree");
params.put("menuType", "1"); params.put("menuType", "1");
@ -360,12 +361,153 @@ public class ServiceMenuStartUp implements ApplicationRunner {
} }
} }
/**
* 初始化权限管理
*
* @param params
* @param menuParentId
*/
private void initPermissionManager(Map<String, Object> params, String menuParentId) { private void initPermissionManager(Map<String, Object> params, String menuParentId) {
if(permissionCheckService == null) { if (permissionCheckService == null) {
return; return;
} }
LOG.debug("初始化菜单:权限管理"); LOG.debug("初始化菜单:角色与权限管理");
params.remove("menuId");
params.put("menuCode", "00010003");
MenuDTO menuDTO = menuDao.getSimple(params);
String menuId;
if (menuDTO == null) {
menuId = UUIDUtil.getUUID();
params.put("menuId", menuId);
params.put("menuParentId", menuParentId);
params.put("menuName", "角色与权限管理");
params.put("menuSummary", "角色与权限管理");
params.put("menuUrl", "javascript:void(0);");
params.put("menuType", "1");
params.put("menuIcon", "fa-icon-color-white fa fa-users");
params.put("menuOrder", "3");
params.put("menuStatus", "0");
params.put("openType", "1");
menuDao.save(params);
} else {
menuId = menuDTO.getMenuId();
}
initSavePermissionManager(params, menuId);
initDeletePermissionManager(params, menuId);
initUpdatePermissionManager(params, menuId);
initQueryPermissionManager(params, menuId);
}
/**
* 新增权限
*
* @param params
* @param menuParentId
*/
private void initSavePermissionManager(Map<String, Object> params, String menuParentId) {
LOG.debug("初始化菜单:新增权限");
params.remove("menuId");
params.put("menuCode", "000100030001");
MenuDTO menuDTO = menuDao.getSimple(params);
String menuId;
if (menuDTO == null) {
menuId = UUIDUtil.getUUID();
params.put("menuId", menuId);
params.put("menuParentId", menuParentId);
params.put("menuName", "新增权限");
params.put("menuSummary", "新增权限");
params.put("menuUrl", "/route/permission/list?permissionType=permissionInsert");
params.put("menuType", "1");
params.put("menuIcon", "fa-icon-color-white fa fa-users");
params.put("menuOrder", "1");
params.put("menuStatus", "0");
params.put("openType", "1");
menuDao.save(params);
}
}
/**
* 修改权限
*
* @param params
* @param menuParentId
*/
private void initDeletePermissionManager(Map<String, Object> params, String menuParentId) {
LOG.debug("初始化菜单:删除权限");
params.remove("menuId");
params.put("menuCode", "000100030002");
MenuDTO menuDTO = menuDao.getSimple(params);
String menuId;
if (menuDTO == null) {
menuId = UUIDUtil.getUUID();
params.put("menuId", menuId);
params.put("menuParentId", menuParentId);
params.put("menuName", "删除权限");
params.put("menuSummary", "删除权限");
params.put("menuUrl", "/route/permission/list?permissionType=permissionDelete");
params.put("menuType", "1");
params.put("menuIcon", "fa-icon-color-white fa fa-users");
params.put("menuOrder", "2");
params.put("menuStatus", "0");
params.put("openType", "1");
menuDao.save(params);
}
}
/**
* 修改权限
*
* @param params
* @param menuParentId
*/
private void initUpdatePermissionManager(Map<String, Object> params, String menuParentId) {
LOG.debug("初始化菜单:修改权限");
params.remove("menuId");
params.put("menuCode", "000100030003");
MenuDTO menuDTO = menuDao.getSimple(params);
String menuId;
if (menuDTO == null) {
menuId = UUIDUtil.getUUID();
params.put("menuId", menuId);
params.put("menuParentId", menuParentId);
params.put("menuName", "修改权限");
params.put("menuSummary", "修改权限");
params.put("menuUrl", "/route/permission/list?permissionType=permissionUpdate");
params.put("menuType", "1");
params.put("menuIcon", "fa-icon-color-white fa fa-users");
params.put("menuOrder", "3");
params.put("menuStatus", "0");
params.put("openType", "1");
menuDao.save(params);
}
}
/**
* 查询权限
*
* @param params
* @param menuParentId
*/
private void initQueryPermissionManager(Map<String, Object> params, String menuParentId) {
LOG.debug("初始化菜单:查询权限");
params.remove("menuId");
params.put("menuCode", "000100030004");
MenuDTO menuDTO = menuDao.getSimple(params);
String menuId;
if (menuDTO == null) {
menuId = UUIDUtil.getUUID();
params.put("menuId", menuId);
params.put("menuParentId", menuParentId);
params.put("menuName", "修改权限");
params.put("menuSummary", "修改权限");
params.put("menuUrl", "/route/permission/list?permissionType=permissionQuery");
params.put("menuType", "1");
params.put("menuIcon", "fa-icon-color-white fa fa-users");
params.put("menuOrder", "4");
params.put("menuStatus", "0");
params.put("openType", "1");
menuDao.save(params);
}
} }
private void initMenuRole() { private void initMenuRole() {

View File

@ -46,7 +46,8 @@
`gmt_modified` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL,
`modifier` char(36) DEFAULT NULL, `modifier` char(36) DEFAULT NULL,
`is_delete` int(2) DEFAULT '0', `is_delete` int(2) DEFAULT '0',
PRIMARY KEY (`id`,`menu_id`) PRIMARY KEY (`id`,`menu_id`),
UNIQUE KEY `menu_id` (`menu_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</update> </update>

View File

@ -41,7 +41,8 @@
`modifier` char(36) DEFAULT NULL, `modifier` char(36) DEFAULT NULL,
`gmt_modified` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL,
`is_delete` int(2) DEFAULT '0', `is_delete` int(2) DEFAULT '0',
PRIMARY KEY (`id`,`position_id`) PRIMARY KEY (`id`,`position_id`),
UNIQUE KEY `position_id` (`position_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</update> </update>

View File

@ -74,7 +74,7 @@
`is_delete` int(2) DEFAULT '0', `is_delete` int(2) DEFAULT '0',
PRIMARY KEY (`id`,`user_id`,`user_username`), PRIMARY KEY (`id`,`user_id`,`user_username`),
UNIQUE KEY `user_username` (`user_username`) USING BTREE, UNIQUE KEY `user_username` (`user_username`) USING BTREE,
KEY `user_id` (`user_id`) USING BTREE, UNIQUE KEY `user_id` (`user_id`) USING BTREE,
KEY `user_name` (`user_name`) USING BTREE, KEY `user_name` (`user_name`) USING BTREE,
KEY `user_id_2` (`user_id`,`user_username`,`user_name`) USING BTREE, KEY `user_id_2` (`user_id`,`user_username`,`user_name`) USING BTREE,
KEY `user_id_3` (`user_id`,`user_name`) USING BTREE, KEY `user_id_3` (`user_id`,`user_name`) USING BTREE,