权限管理接口完善
This commit is contained in:
parent
7faffe541a
commit
ddbdfbdf79
@ -239,9 +239,9 @@ Linux远程连接工具 | http://www.netsarang.com/download/software.html
|
||||
|
||||
> **权限管理**
|
||||
|
||||
- 角色管理:角色列表、分配菜单权限、添加、编辑、删除角色
|
||||
- 成员管理:成员列表、单独设置权限(+-)、设置角色、添加、编辑、删除成员
|
||||
- 操作日志:成员操作日志记录
|
||||
- 权限管理:添加权限、删除权限、修改权限、以树形结构返回权限
|
||||
- 角色管理:添加角色、删除角色、更新角色、角色列表、获取相应角色权限、修改相应角色权限
|
||||
- 成员管理:添加、编辑、删除成员、成员列表、为成员分配角色、获取成员角色、分配+-权限、获取权限列表
|
||||
|
||||
角色 | 菜单
|
||||
----|----
|
||||
@ -338,6 +338,3 @@ Linux远程连接工具 | http://www.netsarang.com/download/software.html
|
||||
- 获取验证码:后台生成验证码,验证码绑定手机号
|
||||
- 忘记密码:手机号、短信验证码、新密码
|
||||
- 登出功能
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ Target Server Type : MYSQL
|
||||
Target Server Version : 50719
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2018-09-05 17:02:45
|
||||
Date: 2018-10-08 16:49:00
|
||||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
@ -387,7 +387,7 @@ CREATE TABLE `oms_order` (
|
||||
-- Records of oms_order
|
||||
-- ----------------------------
|
||||
INSERT INTO `oms_order` VALUES ('12', '1', '2', null, '2018-09-05 12:24:27', 'test', '18732.00', '16377.75', '0.00', '2344.25', '0.00', '10.00', null, '0', '1', '1', '0', null, null, null, '0', null, '单品促销,打折优惠:满3件,打7.50折,满减优惠:满1000.00元,减120.00元,满减优惠:满1000.00元,减120.00元,无优惠', null, null, null, null, null, '大梨', '18033441849', '518000', '广东省', '深圳市', '福田区', '东晓街道', null, '0', '0', null);
|
||||
INSERT INTO `oms_order` VALUES ('13', '1', '2', null, '2018-09-05 14:24:29', 'test', '18732.00', '16377.75', '0.00', '2344.25', '0.00', '10.00', null, '0', '1', '4', '0', null, null, null, '0', null, '单品促销,打折优惠:满3件,打7.50折,满减优惠:满1000.00元,减120.00元,满减优惠:满1000.00元,减120.00元,无优惠', null, null, null, null, null, '大梨', '18033441849', '518000', '广东省', '深圳市', '福田区', '东晓街道', null, '0', '0', '1000');
|
||||
INSERT INTO `oms_order` VALUES ('13', '1', '2', null, '2018-09-05 14:24:29', 'test', '18732.00', '16377.75', '0.00', '2344.25', '0.00', '10.00', null, '0', '1', '1', '0', null, null, null, '0', null, '单品促销,打折优惠:满3件,打7.50折,满减优惠:满1000.00元,减120.00元,满减优惠:满1000.00元,减120.00元,无优惠', null, null, null, null, null, '大梨', '18033441849', '518000', '广东省', '深圳市', '福田区', '东晓街道', null, '0', '0', '1000');
|
||||
INSERT INTO `oms_order` VALUES ('14', '1', '2', null, '2018-09-03 16:57:40', 'test', '18732.00', '16377.75', '0.00', '2344.25', '0.00', '10.00', null, '0', '1', '4', '0', null, null, null, '18682', '18682', '单品促销,打折优惠:满3件,打7.50折,满减优惠:满1000.00元,减120.00元,满减优惠:满1000.00元,减120.00元,无优惠', null, null, null, null, null, '大梨', '18033441849', '518000', '广东省', '深圳市', '福田区', '东晓街道', null, '0', '0', null);
|
||||
INSERT INTO `oms_order` VALUES ('15', '1', '2', null, '2018-09-03 17:03:00', 'test', '18732.00', '16377.75', '0.00', '2344.25', '0.00', '10.00', null, '0', '1', '4', '0', null, null, null, '18682', '18682', '单品促销,打折优惠:满3件,打7.50折,满减优惠:满1000.00元,减120.00元,满减优惠:满1000.00元,减120.00元,无优惠', null, null, null, null, null, '大梨', '18033441849', '518000', '广东省', '深圳市', '福田区', '东晓街道', null, '0', '0', null);
|
||||
INSERT INTO `oms_order` VALUES ('16', '1', '2', null, '2018-09-04 16:16:16', 'test', '18732.00', '16377.75', '0.00', '2344.25', '0.00', '10.00', null, '0', '1', '4', '0', null, null, null, '18682', '18682', '单品促销,打折优惠:满3件,打7.50折,满减优惠:满1000.00元,减120.00元,满减优惠:满1000.00元,减120.00元,无优惠', null, null, null, null, null, '大梨', '18033441849', '518000', '广东省', '深圳市', '福田区', '东晓街道', null, '0', '0', null);
|
||||
@ -594,7 +594,7 @@ CREATE TABLE `pms_brand` (
|
||||
`big_pic` varchar(255) DEFAULT NULL COMMENT '专区大图',
|
||||
`brand_story` text COMMENT '品牌故事',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 COMMENT='品牌表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8 COMMENT='品牌表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of pms_brand
|
||||
@ -896,7 +896,7 @@ CREATE TABLE `pms_product_attribute_category` (
|
||||
`attribute_count` int(11) DEFAULT '0' COMMENT '属性数量',
|
||||
`param_count` int(11) DEFAULT '0' COMMENT '参数数量',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='产品属性分类表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COMMENT='产品属性分类表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of pms_product_attribute_category
|
||||
@ -1245,19 +1245,19 @@ INSERT INTO `pms_sku_stock` VALUES ('78', '23', '201806070023001', '99.00', '0',
|
||||
INSERT INTO `pms_sku_stock` VALUES ('79', '23', '201806070023002', '99.00', '0', null, '米白色', 'X', null, 'http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/images/20180604/1522738681.jpg', null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('80', '23', '201806070023003', '99.00', '0', null, '浅黄色', 'M', null, 'http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/images/20180604/2017091716493787_20170917164937650 (1).png', null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('81', '23', '201806070023004', '99.00', '0', null, '浅黄色', 'X', null, 'http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/images/20180604/2017091716493787_20170917164937650 (1).png', null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('90', '26', '201806070026001', '3788.00', '499', null, '金色', '16G', null, null, null, '3588.00', '-4');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('90', '26', '201806070026001', '3788.00', '499', null, '金色', '16G', null, null, null, '3588.00', '-6');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('91', '26', '201806070026002', '3999.00', '500', null, '金色', '32G', null, null, null, '3799.00', '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('92', '26', '201806070026003', '3788.00', '500', null, '银色', '16G', null, null, null, '3588.00', '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('93', '26', '201806070026004', '3999.00', '500', null, '银色', '32G', null, null, null, '3799.00', '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('98', '27', '201808270027001', '2699.00', '97', null, '黑色', '32G', null, null, null, null, '-12');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('98', '27', '201808270027001', '2699.00', '97', null, '黑色', '32G', null, null, null, null, '-18');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('99', '27', '201808270027002', '2999.00', '100', null, '黑色', '64G', null, null, null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('100', '27', '201808270027003', '2699.00', '100', null, '蓝色', '32G', null, null, null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('101', '27', '201808270027004', '2999.00', '100', null, '蓝色', '64G', null, null, null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('102', '28', '201808270028001', '649.00', '99', null, '金色', '16G', null, null, null, null, '-4');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('103', '28', '201808270028002', '699.00', '99', null, '金色', '32G', null, null, null, null, '-4');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('102', '28', '201808270028001', '649.00', '99', null, '金色', '16G', null, null, null, null, '-6');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('103', '28', '201808270028002', '699.00', '99', null, '金色', '32G', null, null, null, null, '-6');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('104', '28', '201808270028003', '649.00', '100', null, '银色', '16G', null, null, null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('105', '28', '201808270028004', '699.00', '100', null, '银色', '32G', null, null, null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('106', '29', '201808270029001', '5499.00', '99', null, '金色', '32G', null, null, null, null, '-4');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('106', '29', '201808270029001', '5499.00', '99', null, '金色', '32G', null, null, null, null, '-6');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('107', '29', '201808270029002', '6299.00', '100', null, '金色', '64G', null, null, null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('108', '29', '201808270029003', '5499.00', '100', null, '银色', '32G', null, null, null, null, '0');
|
||||
INSERT INTO `pms_sku_stock` VALUES ('109', '29', '201808270029004', '6299.00', '100', null, '银色', '64G', null, null, null, null, '0');
|
||||
@ -1497,14 +1497,20 @@ CREATE TABLE `ums_admin` (
|
||||
`username` varchar(64) DEFAULT NULL,
|
||||
`password` varchar(64) DEFAULT NULL,
|
||||
`icon` varchar(500) DEFAULT NULL COMMENT '头像',
|
||||
`email` varchar(100) DEFAULT NULL,
|
||||
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
|
||||
`nick_name` varchar(200) DEFAULT NULL COMMENT '昵称',
|
||||
`note` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
|
||||
`status` int(1) DEFAULT '1' COMMENT '帐号启用状态:0->禁用;1->启用',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='后台用户表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='后台用户表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of ums_admin
|
||||
-- ----------------------------
|
||||
INSERT INTO `ums_admin` VALUES ('1', 'test', '202cb962ac59075b964b07152d234b70', 'http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/images/20180607/timg.jpg', null);
|
||||
INSERT INTO `ums_admin` VALUES ('1', 'test', '202cb962ac59075b964b07152d234b70', 'http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/images/20180607/timg.jpg', null, '测试账号', null, '2018-09-29 13:55:30', '2018-09-29 13:55:39', '1');
|
||||
INSERT INTO `ums_admin` VALUES ('3', 'admin', 'e10adc3949ba59abbe56e057f20f883e', 'http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/images/20180607/timg.jpg', 'admin@163.com', '系统管理员', '系统管理员', '2018-10-08 13:32:47', '2018-10-08 13:33:16', '1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ums_admin_login_log
|
||||
@ -1524,6 +1530,40 @@ CREATE TABLE `ums_admin_login_log` (
|
||||
-- Records of ums_admin_login_log
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ums_admin_permission_relation
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `ums_admin_permission_relation`;
|
||||
CREATE TABLE `ums_admin_permission_relation` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`admin_id` bigint(20) DEFAULT NULL,
|
||||
`permission_id` bigint(20) DEFAULT NULL,
|
||||
`type` int(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COMMENT='后台用户和权限关系表(除角色中定义的权限以外的加减权限)';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of ums_admin_permission_relation
|
||||
-- ----------------------------
|
||||
INSERT INTO `ums_admin_permission_relation` VALUES ('24', '3', '9', '1');
|
||||
INSERT INTO `ums_admin_permission_relation` VALUES ('25', '3', '8', '-1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ums_admin_role_relation
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `ums_admin_role_relation`;
|
||||
CREATE TABLE `ums_admin_role_relation` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`admin_id` bigint(20) DEFAULT NULL,
|
||||
`role_id` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='后台用户和角色关系表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of ums_admin_role_relation
|
||||
-- ----------------------------
|
||||
INSERT INTO `ums_admin_role_relation` VALUES ('13', '3', '1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ums_growth_change_history
|
||||
-- ----------------------------
|
||||
@ -1615,7 +1655,7 @@ CREATE TABLE `ums_member` (
|
||||
-- ----------------------------
|
||||
-- Records of ums_member
|
||||
-- ----------------------------
|
||||
INSERT INTO `ums_member` VALUES ('1', '4', 'test', '202cb962ac59075b964b07152d234b70', 'windir', '18061581849', '1', '2018-08-02 10:35:44', null, '1', '2009-06-01', '上海', '学生', 'test', null, '3000', null, null, null);
|
||||
INSERT INTO `ums_member` VALUES ('1', '4', 'test', '202cb962ac59075b964b07152d234b70', 'windir', '18061581849', '1', '2018-08-02 10:35:44', null, '1', '2009-06-01', '上海', '学生', 'test', null, '5000', null, null, null);
|
||||
INSERT INTO `ums_member` VALUES ('3', '4', 'test1', '698d51a19d8a121ce581499d7b701668', null, '18061581848', '1', '2018-08-03 16:46:38', null, null, null, null, null, null, null, null, null, null, null);
|
||||
|
||||
-- ----------------------------
|
||||
@ -1800,3 +1840,98 @@ CREATE TABLE `ums_member_task` (
|
||||
-- ----------------------------
|
||||
-- Records of ums_member_task
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ums_permission
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `ums_permission`;
|
||||
CREATE TABLE `ums_permission` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT '父级权限id',
|
||||
`name` varchar(100) DEFAULT NULL COMMENT '名称',
|
||||
`value` varchar(200) DEFAULT NULL COMMENT '权限值',
|
||||
`icon` varchar(500) DEFAULT NULL COMMENT '图标',
|
||||
`type` int(1) DEFAULT NULL COMMENT '权限类型:0->目录;1->菜单;2->按钮(接口绑定权限)',
|
||||
`uri` varchar(200) DEFAULT NULL COMMENT '前端资源路径',
|
||||
`status` int(1) DEFAULT NULL COMMENT '启用状态;0->禁用;1->启用',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`sort` int(11) DEFAULT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COMMENT='后台用户权限表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of ums_permission
|
||||
-- ----------------------------
|
||||
INSERT INTO `ums_permission` VALUES ('1', '0', '商品', null, null, '0', null, '1', '2018-09-29 16:15:14', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('2', '1', '商品列表', 'pms:product:read', null, '1', '/pms/product/index', '1', '2018-09-29 16:17:01', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('3', '1', '添加商品', 'pms:product:create', null, '1', '/pms/product/add', '1', '2018-09-29 16:18:51', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('4', '1', '商品分类', 'pms:productCategory:read', null, '1', '/pms/productCate/index', '1', '2018-09-29 16:23:07', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('5', '1', '商品类型', 'pms:productAttribute:read', null, '1', '/pms/productAttr/index', '1', '2018-09-29 16:24:43', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('6', '1', '品牌管理', 'pms:brand:read', null, '1', '/pms/brand/index', '1', '2018-09-29 16:25:45', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('7', '2', '编辑商品', 'pms:product:update', null, '2', '/pms/product/updateProduct', '1', '2018-09-29 16:34:23', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('8', '2', '删除商品', 'pms:product:delete', null, '2', '/pms/product/delete', '1', '2018-09-29 16:38:33', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('9', '4', '添加商品分类', 'pms:productCategory:create', null, '2', '/pms/productCate/create', '1', '2018-09-29 16:43:23', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('10', '4', '修改商品分类', 'pms:productCategory:update', null, '2', '/pms/productCate/update', '1', '2018-09-29 16:43:55', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('11', '4', '删除商品分类', 'pms:productCategory:delete', null, '2', '/pms/productAttr/delete', '1', '2018-09-29 16:44:38', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('12', '5', '添加商品类型', 'pms:productAttribute:create', null, '2', '/pms/productAttr/create', '1', '2018-09-29 16:45:25', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('13', '5', '修改商品类型', 'pms:productAttribute:update', null, '2', '/pms/productAttr/update', '1', '2018-09-29 16:48:08', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('14', '5', '删除商品类型', 'pms:productAttribute:delete', null, '2', '/pms/productAttr/delete', '1', '2018-09-29 16:48:44', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('15', '6', '添加品牌', 'pms:brand:create', null, '2', '/pms/brand/add', '1', '2018-09-29 16:49:34', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('16', '6', '修改品牌', 'pms:brand:update', null, '2', '/pms/brand/update', '1', '2018-09-29 16:50:55', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('17', '6', '删除品牌', 'pms:brand:delete', null, '2', '/pms/brand/delete', '1', '2018-09-29 16:50:59', '0');
|
||||
INSERT INTO `ums_permission` VALUES ('18', '0', '首页', null, null, '0', null, '1', '2018-09-29 16:51:57', '0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ums_role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `ums_role`;
|
||||
CREATE TABLE `ums_role` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) DEFAULT NULL COMMENT '名称',
|
||||
`description` varchar(500) DEFAULT NULL COMMENT '描述',
|
||||
`admin_count` int(11) DEFAULT NULL COMMENT '后台用户数量',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`status` int(1) DEFAULT '1' COMMENT '启用状态:0->禁用;1->启用',
|
||||
`sort` int(11) DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='后台用户角色表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of ums_role
|
||||
-- ----------------------------
|
||||
INSERT INTO `ums_role` VALUES ('1', '商品管理员', '商品管理员', '0', '2018-09-30 15:46:11', '1', '0');
|
||||
INSERT INTO `ums_role` VALUES ('2', '商品分类管理员', '商品分类管理员', '0', '2018-09-30 15:53:45', '1', '0');
|
||||
INSERT INTO `ums_role` VALUES ('3', '商品类型管理员', '商品类型管理员', '0', '2018-09-30 15:53:56', '1', '0');
|
||||
INSERT INTO `ums_role` VALUES ('4', '品牌管理员', '品牌管理员', '0', '2018-09-30 15:54:12', '1', '0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ums_role_permission_relation
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `ums_role_permission_relation`;
|
||||
CREATE TABLE `ums_role_permission_relation` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`role_id` bigint(20) DEFAULT NULL,
|
||||
`permission_id` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='后台用户角色和权限关系表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of ums_role_permission_relation
|
||||
-- ----------------------------
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('1', '1', '1');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('2', '1', '2');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('3', '1', '3');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('4', '1', '7');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('5', '1', '8');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('6', '2', '4');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('7', '2', '9');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('8', '2', '10');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('9', '2', '11');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('10', '3', '5');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('11', '3', '12');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('12', '3', '13');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('13', '3', '14');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('14', '4', '6');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('15', '4', '15');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('16', '4', '16');
|
||||
INSERT INTO `ums_role_permission_relation` VALUES ('17', '4', '17');
|
||||
|
@ -4,12 +4,13 @@ import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.dto.UmsAdminLoginParam;
|
||||
import com.macro.mall.dto.UmsAdminParam;
|
||||
import com.macro.mall.model.UmsAdmin;
|
||||
import com.macro.mall.model.UmsPermission;
|
||||
import com.macro.mall.model.UmsRole;
|
||||
import com.macro.mall.service.UmsAdminService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -30,8 +31,6 @@ import java.util.Map;
|
||||
public class UmsAdminController {
|
||||
@Autowired
|
||||
private UmsAdminService adminService;
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
@Value("${jwt.tokenHeader}")
|
||||
private String tokenHeader;
|
||||
@Value("${jwt.tokenHead}")
|
||||
@ -100,7 +99,7 @@ public class UmsAdminController {
|
||||
@ApiOperation("根据用户名或姓名分页获取用户列表")
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(@RequestParam("name") String name,
|
||||
public Object list(@RequestParam(value = "name",required = false) String name,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){
|
||||
List<UmsAdmin> adminList = adminService.list(name,pageSize,pageNum);
|
||||
@ -136,4 +135,44 @@ public class UmsAdminController {
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("给用户分配角色")
|
||||
@RequestMapping(value = "/role/update",method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRole(@RequestParam("adminId") Long adminId,
|
||||
@RequestParam("roleIds") List<Long> roleIds){
|
||||
int count = adminService.updateRole(adminId,roleIds);
|
||||
if(count>=0){
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取指定用户的角色")
|
||||
@RequestMapping(value = "/role/{adminId}",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getRoleList(@PathVariable Long adminId){
|
||||
List<UmsRole> roleList = adminService.getRoleList(adminId);
|
||||
return new CommonResult().success(roleList);
|
||||
}
|
||||
|
||||
@ApiOperation("给用户分配+-权限")
|
||||
@RequestMapping(value = "/permission/update",method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updatePermission(@RequestParam Long adminId,
|
||||
@RequestParam("permissionIds") List<Long> permissionIds){
|
||||
int count = adminService.updatePermission(adminId,permissionIds);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户所有权限(包括+-权限)")
|
||||
@RequestMapping(value = "/permission/{adminId}",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getPermissionList(@PathVariable Long adminId){
|
||||
List<UmsPermission> permissionList = adminService.getPermissionList(adminId);
|
||||
return new CommonResult().success(permissionList);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "UmsPermissionController", description = "后台用户权限管理")
|
||||
@RequestMapping("/admin/permission")
|
||||
@RequestMapping("/permission")
|
||||
public class UmsPermissionController {
|
||||
@Autowired
|
||||
private UmsPermissionService permissionService;
|
||||
@ -62,4 +62,12 @@ public class UmsPermissionController {
|
||||
List<UmsPermissionNode> permissionNodeList = permissionService.treeList();
|
||||
return new CommonResult().success(permissionNodeList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有权限列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list() {
|
||||
List<UmsPermission> permissionList = permissionService.list();
|
||||
return new CommonResult().success(permissionList);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "UmsRoleController", description = "后台用户角色管理")
|
||||
@RequestMapping("/admin/role")
|
||||
@RequestMapping("/role")
|
||||
public class UmsRoleController {
|
||||
@Autowired
|
||||
private UmsRoleService roleService;
|
||||
@ -76,4 +76,12 @@ public class UmsRoleController {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有角色")
|
||||
@RequestMapping(value = "/list",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object list(){
|
||||
List<UmsRole> roleList = roleService.list();
|
||||
return new CommonResult().success(roleList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.macro.mall.dao;
|
||||
|
||||
import com.macro.mall.model.UmsAdminPermissionRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户权限自定义Dao
|
||||
* Created by macro on 2018/10/8.
|
||||
*/
|
||||
public interface UmsAdminPermissionRelationDao {
|
||||
int insertList(@Param("list") List<UmsAdminPermissionRelation> list);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.macro.mall.dao;
|
||||
|
||||
import com.macro.mall.model.UmsAdminRoleRelation;
|
||||
import com.macro.mall.model.UmsPermission;
|
||||
import com.macro.mall.model.UmsRole;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 后台用户与角色管理自定义Dao
|
||||
* Created by macro on 2018/10/8.
|
||||
*/
|
||||
public interface UmsAdminRoleRelationDao {
|
||||
/**
|
||||
* 批量插入用户角色关系
|
||||
*/
|
||||
int insertList(@Param("list") List<UmsAdminRoleRelation> adminRoleRelationList);
|
||||
|
||||
/**
|
||||
* 获取用于所有角色
|
||||
*/
|
||||
List<UmsRole> getRoleList(@Param("adminId") Long adminId);
|
||||
|
||||
/**
|
||||
* 获取用户所有角色权限
|
||||
*/
|
||||
List<UmsPermission> getRolePermissionList(@Param("adminId") Long adminId);
|
||||
|
||||
/**
|
||||
* 获取用户所有权限(包括+-权限)
|
||||
*/
|
||||
List<UmsPermission> getPermissionList(@Param("adminId") Long adminId);
|
||||
}
|
@ -2,6 +2,9 @@ package com.macro.mall.service;
|
||||
|
||||
import com.macro.mall.dto.UmsAdminParam;
|
||||
import com.macro.mall.model.UmsAdmin;
|
||||
import com.macro.mall.model.UmsPermission;
|
||||
import com.macro.mall.model.UmsRole;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -53,4 +56,26 @@ public interface UmsAdminService {
|
||||
* 删除指定用户
|
||||
*/
|
||||
int delete(Long id);
|
||||
|
||||
/**
|
||||
* 修改用户角色关系
|
||||
*/
|
||||
@Transactional
|
||||
int updateRole(Long adminId, List<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 获取用户对于角色
|
||||
*/
|
||||
List<UmsRole> getRoleList(Long adminId);
|
||||
|
||||
/**
|
||||
* 修改用户的+-权限
|
||||
*/
|
||||
@Transactional
|
||||
int updatePermission(Long adminId, List<Long> permissionIds);
|
||||
|
||||
/**
|
||||
* 获取用户所有权限(包括角色权限和+-权限)
|
||||
*/
|
||||
List<UmsPermission> getPermissionList(Long adminId);
|
||||
}
|
||||
|
@ -29,4 +29,9 @@ public interface UmsPermissionService {
|
||||
* 以层级结构返回所有权限
|
||||
*/
|
||||
List<UmsPermissionNode> treeList();
|
||||
|
||||
/**
|
||||
* 获取所有权限
|
||||
*/
|
||||
List<UmsPermission> list();
|
||||
}
|
||||
|
@ -36,4 +36,9 @@ public interface UmsRoleService {
|
||||
*/
|
||||
@Transactional
|
||||
int updatePermission(Long roleId, List<Long> permissionIds);
|
||||
|
||||
/**
|
||||
* 获取角色列表
|
||||
*/
|
||||
List<UmsRole> list();
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.macro.mall.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.macro.mall.dao.UmsAdminPermissionRelationDao;
|
||||
import com.macro.mall.dao.UmsAdminRoleRelationDao;
|
||||
import com.macro.mall.dto.UmsAdminParam;
|
||||
import com.macro.mall.mapper.UmsAdminMapper;
|
||||
import com.macro.mall.model.UmsAdmin;
|
||||
import com.macro.mall.model.UmsAdminExample;
|
||||
import com.macro.mall.mapper.UmsAdminPermissionRelationMapper;
|
||||
import com.macro.mall.mapper.UmsAdminRoleRelationMapper;
|
||||
import com.macro.mall.model.*;
|
||||
import com.macro.mall.service.UmsAdminService;
|
||||
import com.macro.mall.util.JwtTokenUtil;
|
||||
import org.slf4j.Logger;
|
||||
@ -21,9 +24,13 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* UmsAdminService实现类
|
||||
@ -33,8 +40,6 @@ import java.util.List;
|
||||
public class UmsAdminServiceImpl implements UmsAdminService {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(UmsAdminServiceImpl.class);
|
||||
@Autowired
|
||||
private UmsAdminMapper adminMapper;
|
||||
@Autowired
|
||||
private AuthenticationManager authenticationManager;
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
@ -44,6 +49,16 @@ public class UmsAdminServiceImpl implements UmsAdminService{
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Value("${jwt.tokenHead}")
|
||||
private String tokenHead;
|
||||
@Autowired
|
||||
private UmsAdminMapper adminMapper;
|
||||
@Autowired
|
||||
private UmsAdminRoleRelationMapper adminRoleRelationMapper;
|
||||
@Autowired
|
||||
private UmsAdminRoleRelationDao adminRoleRelationDao;
|
||||
@Autowired
|
||||
private UmsAdminPermissionRelationMapper adminPermissionRelationMapper;
|
||||
@Autowired
|
||||
private UmsAdminPermissionRelationDao adminPermissionRelationDao;
|
||||
|
||||
@Override
|
||||
public UmsAdmin getAdminByUsername(String username) {
|
||||
@ -60,6 +75,8 @@ public class UmsAdminServiceImpl implements UmsAdminService{
|
||||
public UmsAdmin register(UmsAdminParam umsAdminParam) {
|
||||
UmsAdmin umsAdmin = new UmsAdmin();
|
||||
BeanUtils.copyProperties(umsAdminParam, umsAdmin);
|
||||
umsAdmin.setCreateTime(new Date());
|
||||
umsAdmin.setStatus(1);
|
||||
//查询是否有相同用户名的用户
|
||||
UmsAdminExample example = new UmsAdminExample();
|
||||
example.createCriteria().andUsernameEqualTo(umsAdmin.getUsername());
|
||||
@ -84,12 +101,24 @@ public class UmsAdminServiceImpl implements UmsAdminService{
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
UserDetails userDetails = userDetailsService.loadUserByUsername(username);
|
||||
token = jwtTokenUtil.generateToken(userDetails);
|
||||
updateLoginTimeByUsername(username);
|
||||
} catch (AuthenticationException e) {
|
||||
LOGGER.warn("登录异常:{}", e.getMessage());
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名修改登录时间
|
||||
*/
|
||||
private void updateLoginTimeByUsername(String username) {
|
||||
UmsAdmin record = new UmsAdmin();
|
||||
record.setLoginTime(new Date());
|
||||
UmsAdminExample example = new UmsAdminExample();
|
||||
example.createCriteria().andUsernameEqualTo(username);
|
||||
adminMapper.updateByExampleSelective(record, example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String refreshToken(String oldToken) {
|
||||
String token = oldToken.substring(tokenHead.length());
|
||||
@ -118,11 +147,80 @@ public class UmsAdminServiceImpl implements UmsAdminService{
|
||||
|
||||
@Override
|
||||
public int update(Long id, UmsAdmin admin) {
|
||||
return 0;
|
||||
admin.setId(id);
|
||||
return adminMapper.updateByPrimaryKey(admin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
return adminMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRole(Long adminId, List<Long> roleIds) {
|
||||
int count = roleIds == null ? 0 : roleIds.size();
|
||||
//先删除原来的关系
|
||||
UmsAdminRoleRelationExample adminRoleRelationExample = new UmsAdminRoleRelationExample();
|
||||
adminRoleRelationExample.createCriteria().andAdminIdEqualTo(adminId);
|
||||
adminRoleRelationMapper.deleteByExample(adminRoleRelationExample);
|
||||
//建立新关系
|
||||
if (!CollectionUtils.isEmpty(roleIds)) {
|
||||
List<UmsAdminRoleRelation> list = new ArrayList<>();
|
||||
for (Long roleId : roleIds) {
|
||||
UmsAdminRoleRelation roleRelation = new UmsAdminRoleRelation();
|
||||
roleRelation.setAdminId(adminId);
|
||||
roleRelation.setRoleId(roleId);
|
||||
list.add(roleRelation);
|
||||
}
|
||||
adminRoleRelationDao.insertList(list);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UmsRole> getRoleList(Long adminId) {
|
||||
return adminRoleRelationDao.getRoleList(adminId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updatePermission(Long adminId, List<Long> permissionIds) {
|
||||
//删除原所有权限关系
|
||||
UmsAdminPermissionRelationExample relationExample = new UmsAdminPermissionRelationExample();
|
||||
relationExample.createCriteria().andAdminIdEqualTo(adminId);
|
||||
adminPermissionRelationMapper.deleteByExample(relationExample);
|
||||
//获取用户所有角色权限
|
||||
List<UmsPermission> permissionList = adminRoleRelationDao.getRolePermissionList(adminId);
|
||||
List<Long> rolePermissionList = permissionList.stream().map(UmsPermission::getId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(permissionIds)) {
|
||||
List<UmsAdminPermissionRelation> relationList = new ArrayList<>();
|
||||
//筛选出+权限
|
||||
List<Long> addPermissionIdList = permissionIds.stream().filter(permissionId -> !rolePermissionList.contains(permissionId)).collect(Collectors.toList());
|
||||
//筛选出-权限
|
||||
List<Long> subPermissionIdList = rolePermissionList.stream().filter(permissionId -> !permissionIds.contains(permissionId)).collect(Collectors.toList());
|
||||
//插入+-权限关系
|
||||
relationList.addAll(convert(adminId,1,addPermissionIdList));
|
||||
relationList.addAll(convert(adminId,-1,subPermissionIdList));
|
||||
return adminPermissionRelationDao.insertList(relationList);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将+-权限关系转化为对象
|
||||
*/
|
||||
private List<UmsAdminPermissionRelation> convert(Long adminId,Integer type,List<Long> permissionIdList) {
|
||||
List<UmsAdminPermissionRelation> relationList = permissionIdList.stream().map(permissionId -> {
|
||||
UmsAdminPermissionRelation relation = new UmsAdminPermissionRelation();
|
||||
relation.setAdminId(adminId);
|
||||
relation.setType(type);
|
||||
relation.setPermissionId(permissionId);
|
||||
return relation;
|
||||
}).collect(Collectors.toList());
|
||||
return relationList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UmsPermission> getPermissionList(Long adminId) {
|
||||
return adminRoleRelationDao.getPermissionList(adminId);
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,11 @@ public class UmsPermissionServiceImpl implements UmsPermissionService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UmsPermission> list() {
|
||||
return permissionMapper.selectByExample(new UmsPermissionExample());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将权限转换为带有子级的权限对象
|
||||
* 当找不到子级权限的时候map操作不会再递归调用covert
|
||||
|
@ -67,4 +67,9 @@ public class UmsRoleServiceImpl implements UmsRoleService {
|
||||
}
|
||||
return rolePermissionRelationDao.insertList(relationList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UmsRole> list() {
|
||||
return roleMapper.selectByExample(new UmsRoleExample());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?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="com.macro.mall.dao.UmsAdminPermissionRelationDao">
|
||||
<!--批量新增回写主键支持-->
|
||||
<insert id="insertList">
|
||||
INSERT INTO ums_admin_permission_relation (admin_id, permission_id, type) VALUES
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.adminId,jdbcType=BIGINT},
|
||||
#{item.permissionId,jdbcType=BIGINT},
|
||||
#{item.type,jdbcType=INTEGER})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
@ -0,0 +1,55 @@
|
||||
<?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="com.macro.mall.dao.UmsAdminRoleRelationDao">
|
||||
<!--批量新增回写主键支持-->
|
||||
<insert id="insertList">
|
||||
INSERT INTO ums_admin_role_relation (admin_id, role_id) VALUES
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.adminId,jdbcType=BIGINT},
|
||||
#{item.roleId,jdbcType=BIGINT})
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="getRoleList" resultMap="com.macro.mall.mapper.UmsRoleMapper.BaseResultMap">
|
||||
select r.*
|
||||
from ums_admin_role_relation ar left join ums_role r on ar.role_id = r.id
|
||||
where ar.admin_id = #{adminId}
|
||||
</select>
|
||||
<select id="getRolePermissionList" resultMap="com.macro.mall.mapper.UmsPermissionMapper.BaseResultMap">
|
||||
select p.*
|
||||
from ums_admin_role_relation ar left join ums_role r on ar.role_id = r.id
|
||||
left join ums_role_permission_relation rp on r.id = rp.role_id
|
||||
left join ums_permission p on rp.permission_id=p.id
|
||||
where ar.admin_id = #{adminId} and p.id is not null
|
||||
</select>
|
||||
<select id="getPermissionList" resultMap="com.macro.mall.mapper.UmsPermissionMapper.BaseResultMap">
|
||||
SELECT
|
||||
p.*
|
||||
FROM
|
||||
ums_admin_role_relation ar
|
||||
LEFT JOIN ums_role r ON ar.role_id = r.id
|
||||
LEFT JOIN ums_role_permission_relation rp ON r.id = rp.role_id
|
||||
LEFT JOIN ums_permission p ON rp.permission_id = p.id
|
||||
WHERE
|
||||
ar.admin_id = #{adminId}
|
||||
AND p.id IS NOT NULL
|
||||
AND p.id NOT IN (
|
||||
SELECT
|
||||
p.id
|
||||
FROM
|
||||
ums_admin_permission_relation pr
|
||||
LEFT JOIN ums_permission p ON pr.permission_id = p.id
|
||||
WHERE
|
||||
pr.type = - 1
|
||||
AND pr.admin_id = #{adminId}
|
||||
)
|
||||
UNION
|
||||
SELECT
|
||||
p.*
|
||||
FROM
|
||||
ums_admin_permission_relation pr
|
||||
LEFT JOIN ums_permission p ON pr.permission_id = p.id
|
||||
WHERE
|
||||
pr.type = 1
|
||||
AND pr.admin_id = #{adminId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user