合并分支 'ProjectThird' 到 'master'
Project third 查看合并请求 JeroBoot/jero-boot!8
This commit is contained in:
@@ -8,6 +8,6 @@ RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
COPY ./tables_nacos.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY jeroboot-mysql-5.7-20220331.sql /docker-entrypoint-initdb.d
|
||||
COPY jeroboot-mysql-5.7-20220417.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./tables_xxl_job.sql /docker-entrypoint-initdb.d
|
||||
+2
-63
@@ -1166,67 +1166,6 @@ CREATE TABLE `sys_depart_permission` (
|
||||
-- Records of sys_depart_permission
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_depart_role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_depart_role`;
|
||||
CREATE TABLE `sys_depart_role` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`depart_id` varchar(32) DEFAULT NULL COMMENT '部门id',
|
||||
`role_name` varchar(200) DEFAULT NULL COMMENT '部门角色名称',
|
||||
`role_code` varchar(100) DEFAULT NULL COMMENT '部门角色编码',
|
||||
`description` varchar(255) DEFAULT NULL COMMENT '描述',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='部门角色表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_depart_role
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_depart_role_permission
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_depart_role_permission`;
|
||||
CREATE TABLE `sys_depart_role_permission` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`depart_id` varchar(32) DEFAULT NULL COMMENT '部门id',
|
||||
`role_id` varchar(32) DEFAULT NULL COMMENT '角色id',
|
||||
`permission_id` varchar(32) DEFAULT NULL COMMENT '权限id',
|
||||
`data_rule_ids` varchar(1000) DEFAULT NULL COMMENT '数据权限ids',
|
||||
`operate_date` datetime DEFAULT NULL COMMENT '操作时间',
|
||||
`operate_ip` varchar(20) DEFAULT NULL COMMENT '操作ip',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `index_group_role_per_id` (`role_id`,`permission_id`) USING BTREE,
|
||||
KEY `index_group_role_id` (`role_id`) USING BTREE,
|
||||
KEY `index_group_per_id` (`permission_id`) USING BTREE,
|
||||
KEY `idx_sdrp_role_per_id` (`role_id`,`permission_id`) USING BTREE,
|
||||
KEY `idx_sdrp_role_id` (`role_id`) USING BTREE,
|
||||
KEY `idx_sdrp_per_id` (`permission_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门角色权限表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_depart_role_permission
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_depart_role_user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_depart_role_user`;
|
||||
CREATE TABLE `sys_depart_role_user` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键id',
|
||||
`user_id` varchar(32) DEFAULT NULL COMMENT '用户id',
|
||||
`drole_id` varchar(32) DEFAULT NULL COMMENT '角色id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='部门角色用户表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_depart_role_user
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dict
|
||||
-- ----------------------------
|
||||
@@ -1604,7 +1543,7 @@ INSERT INTO `sys_permission` VALUES ('265de841c58907954b8877fb85212622', '2a470f
|
||||
INSERT INTO `sys_permission` VALUES ('277bfabef7d76e89b33062b16a9a5020', 'e3c13679c73a4f829bcff2aba8fd68b1', '基础表单', '/form/base-form', 'demo/form/BasicForm', null, null, '1', null, null, '1.00', '0', null, '1', '0', null, '0', null, null, '2018-12-25 20:34:38', 'admin', '2019-02-26 17:02:08', '0', '0', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('2a470fc0c3954d9dbb61de6d80846549', '', '开发示例Demo', '/jero', 'layouts/RouteView', null, null, '0', null, null, '20.00', '0', 'qrcode', '1', '0', '0', '0', null, null, '2018-12-25 20:34:38', 'admin', '2021-03-16 22:31:20', '0', '0', null, '0');
|
||||
INSERT INTO `sys_permission` VALUES ('2aeddae571695cd6380f6d6d334d6e7d', 'f0675b52d89100ee88472b6800754a08', '布局统计报表', '/report/ArchivesStatisticst', 'demo/report/ArchivesStatisticst', null, null, '1', null, null, '1.00', '0', null, '1', '1', null, '0', null, 'admin', '2019-04-03 18:32:48', null, null, '0', '0', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('2dbbafa22cda07fa5d169d741b81fe12', 'e41b69c57a941a3bbcce45032fe57605', '在线文档', '{{ window._CONFIG[\'domianURL\'] }}/doc.html', 'layouts/IframePageView', null, null, '1', null, null, '8.00', '0', null, '1', '1', '0', '0', null, 'admin', '2019-01-30 10:00:01', 'admin', '2021-03-16 22:33:43', '0', '0', null, '0');
|
||||
INSERT INTO `sys_permission` VALUES ('2dbbafa22cda07fa5d169d741b81fe12', 'e41b69c57a941a3bbcce45032fe57605', '在线文档', '{{ window._CONFIG[\'domianURL\'] }}/doc.html', 'layouts/IframePageView', null, null, '1', null, null, '8.00', '0', null, '1', '1', '0', '0', null, 'admin', '2019-01-30 10:00:01', 'admin', '2021-03-16 22:33:43', '0', '0', null, '1');
|
||||
INSERT INTO `sys_permission` VALUES ('2e42e3835c2b44ec9f7bc26c146ee531', '2a470fc0c3954d9dbb61de6d80846549', '结果页', '/result', 'layouts/PageView', null, null, '1', null, null, '20.00', '0', 'check-circle-o', '1', '0', '0', '0', null, null, '2018-12-25 20:34:38', 'admin', '2021-03-16 22:22:54', '0', '0', null, '0');
|
||||
INSERT INTO `sys_permission` VALUES ('3f915b2769fc80648e92d04e84ca059d', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '用户管理', '/isystem/user', 'system/UserList', null, null, '1', 'sys:user:list', '1', '1.10', '0', null, '1', '0', '0', '0', null, null, '2018-12-25 20:34:38', 'admin', '2019-12-25 09:36:24', '0', '0', '1', '0');
|
||||
INSERT INTO `sys_permission` VALUES ('3fac0d3c9cd40fa53ab70d4c583821f8', '2a470fc0c3954d9dbb61de6d80846549', '分屏', '/demo/splitPanel', 'demo/SplitPanel', null, null, '1', null, null, '6.00', '0', null, '1', '1', null, '0', null, 'admin', '2019-04-25 16:27:06', null, null, '0', '0', null, null);
|
||||
@@ -1643,7 +1582,7 @@ INSERT INTO `sys_permission` VALUES ('9502685863ab87f0ad1134142788a385', '', '
|
||||
INSERT INTO `sys_permission` VALUES ('97c8629abc7848eccdb6d77c24bb3ebb', '700b7f95165c46cc7a78bf227aa8fed3', '磁盘监控', '/monitor/Disk', 'modules/monitor/DiskMonitoring', null, null, '1', null, null, '6.00', '0', null, '1', '1', null, '0', null, 'admin', '2019-04-25 14:30:06', 'admin', '2019-05-05 14:37:14', '0', '0', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('9a90363f216a6a08f32eecb3f0bf12a3', '2a470fc0c3954d9dbb61de6d80846549', 'Jero组件示例', '/demo/SelectDemo', 'demo/SelectDemo', null, null, '1', null, null, '0.00', '0', null, '1', '1', '0', '0', null, 'admin', '2019-03-19 11:19:05', 'admin', '2021-03-16 22:15:28', '0', '0', null, '0');
|
||||
INSERT INTO `sys_permission` VALUES ('ae4fed059f67086fd52a73d913cf473d', '540a2936940846cb98114ffb0d145cb8', '内联编辑表格', '/list/edit-table', 'demo/list/TableInnerEditList', null, null, '1', null, null, '2.00', null, null, '1', '1', null, null, null, null, '2018-12-25 20:34:38', null, null, '0', '0', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('aedbf679b5773c1f25e9f7b10111da73', '08e6b9dc3c04489c8e1ff2ce6f105aa4', 'SQL监控', '{{ window._CONFIG[\'domianURL\'] }}/druid/', 'layouts/IframePageView', null, null, '1', null, null, '3.00', '0', null, '1', '1', '0', '0', null, 'admin', '2019-01-30 09:43:22', 'admin', '2020-09-09 14:48:38', '0', '0', null, '0');
|
||||
INSERT INTO `sys_permission` VALUES ('aedbf679b5773c1f25e9f7b10111da73', '08e6b9dc3c04489c8e1ff2ce6f105aa4', 'SQL监控', '{{ window._CONFIG[\'domianURL\'] }}/druid/', 'layouts/IframePageView', null, null, '1', null, null, '3.00', '0', null, '1', '1', '0', '0', null, 'admin', '2019-01-30 09:43:22', 'admin', '2020-09-09 14:48:38', '0', '0', null, '1');
|
||||
INSERT INTO `sys_permission` VALUES ('b1cb0a3fedf7ed0e4653cb5a229837ee', 'e41b69c57a941a3bbcce45032fe57605', '定时任务', '/isystem/QuartzJobList', 'system/QuartzJobList', null, null, '1', null, null, '10.00', '0', null, '1', '1', '0', '0', null, null, '2019-01-03 09:38:52', 'admin', '2021-03-16 22:42:39', '0', '0', null, '0');
|
||||
INSERT INTO `sys_permission` VALUES ('b3c824fc22bd953e2eb16ae6914ac8f9', '4875ebe289344e14844d8e3ea1edd73f', '高级详情页', '/profile/advanced', 'demo/profile/advanced/Advanced', null, null, '1', null, null, '2.00', null, null, '1', '1', null, null, null, null, '2018-12-25 20:34:38', null, null, '0', '0', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('b4dfc7d5dd9e8d5b6dd6d4579b1aa559', 'c65321e57b7949b7a975313220de0422', '500', '/exception/500', 'exception/500', null, null, '1', null, null, '3.00', null, null, '1', '1', null, null, null, null, '2018-12-25 20:34:38', null, null, '0', '0', null, null);
|
||||
@@ -1605,93 +1605,6 @@ COMMENT ON COLUMN "SYS_DEPART_PERMISSION"."DATA_RULE_IDS" IS '数据规则id';
|
||||
-- Records of SYS_DEPART_PERMISSION
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for SYS_DEPART_ROLE
|
||||
-- ----------------------------
|
||||
DROP TABLE "SYS_DEPART_ROLE";
|
||||
CREATE TABLE "SYS_DEPART_ROLE" (
|
||||
"ID" NVARCHAR2(32) NOT NULL ,
|
||||
"DEPART_ID" NVARCHAR2(32) NULL ,
|
||||
"ROLE_NAME" NVARCHAR2(200) NULL ,
|
||||
"ROLE_CODE" NVARCHAR2(100) NULL ,
|
||||
"DESCRIPTION" NVARCHAR2(255) NULL ,
|
||||
"CREATE_BY" NVARCHAR2(32) NULL ,
|
||||
"CREATE_TIME" DATE NULL ,
|
||||
"UPDATE_BY" NVARCHAR2(32) NULL ,
|
||||
"UPDATE_TIME" DATE NULL
|
||||
)
|
||||
LOGGING
|
||||
NOCOMPRESS
|
||||
NOCACHE
|
||||
|
||||
;
|
||||
COMMENT ON TABLE "SYS_DEPART_ROLE" IS '部门角色表';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."DEPART_ID" IS '部门id';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."ROLE_NAME" IS '部门角色名称';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."ROLE_CODE" IS '部门角色编码';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."DESCRIPTION" IS '描述';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."CREATE_BY" IS '创建人';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."CREATE_TIME" IS '创建时间';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."UPDATE_BY" IS '更新人';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE"."UPDATE_TIME" IS '更新时间';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of SYS_DEPART_ROLE
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for SYS_DEPART_ROLE_PERMISSION
|
||||
-- ----------------------------
|
||||
DROP TABLE "SYS_DEPART_ROLE_PERMISSION";
|
||||
CREATE TABLE "SYS_DEPART_ROLE_PERMISSION" (
|
||||
"ID" NVARCHAR2(32) NOT NULL ,
|
||||
"DEPART_ID" NVARCHAR2(32) NULL ,
|
||||
"ROLE_ID" NVARCHAR2(32) NULL ,
|
||||
"PERMISSION_ID" NVARCHAR2(32) NULL ,
|
||||
"DATA_RULE_IDS" NVARCHAR2(1000) NULL ,
|
||||
"OPERATE_DATE" DATE NULL ,
|
||||
"OPERATE_IP" NVARCHAR2(20) NULL
|
||||
)
|
||||
LOGGING
|
||||
NOCOMPRESS
|
||||
NOCACHE
|
||||
|
||||
;
|
||||
COMMENT ON TABLE "SYS_DEPART_ROLE_PERMISSION" IS '部门角色权限表';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_PERMISSION"."DEPART_ID" IS '部门id';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_PERMISSION"."ROLE_ID" IS '角色id';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_PERMISSION"."PERMISSION_ID" IS '权限id';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_PERMISSION"."DATA_RULE_IDS" IS '数据权限ids';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_PERMISSION"."OPERATE_DATE" IS '操作时间';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_PERMISSION"."OPERATE_IP" IS '操作ip';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of SYS_DEPART_ROLE_PERMISSION
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for SYS_DEPART_ROLE_USER
|
||||
-- ----------------------------
|
||||
DROP TABLE "SYS_DEPART_ROLE_USER";
|
||||
CREATE TABLE "SYS_DEPART_ROLE_USER" (
|
||||
"ID" NVARCHAR2(32) NOT NULL ,
|
||||
"USER_ID" NVARCHAR2(32) NULL ,
|
||||
"DROLE_ID" NVARCHAR2(32) NULL
|
||||
)
|
||||
LOGGING
|
||||
NOCOMPRESS
|
||||
NOCACHE
|
||||
|
||||
;
|
||||
COMMENT ON TABLE "SYS_DEPART_ROLE_USER" IS '部门角色用户表';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_USER"."ID" IS '主键id';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_USER"."USER_ID" IS '用户id';
|
||||
COMMENT ON COLUMN "SYS_DEPART_ROLE_USER"."DROLE_ID" IS '角色id';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of SYS_DEPART_ROLE_USER
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for SYS_DICT
|
||||
-- ----------------------------
|
||||
@@ -2140,7 +2053,7 @@ INSERT INTO "SYS_PERMISSION" VALUES ('9502685863ab87f0ad1134142788a385', null, '
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('97c8629abc7848eccdb6d77c24bb3ebb', '700b7f95165c46cc7a78bf227aa8fed3', '磁盘监控', '/monitor/Disk', 'modules/monitor/DiskMonitoring', null, null, '1', null, null, '6', '0', null, '1', '1', null, '0', null, 'admin', TO_DATE('2019-04-25 14:30:06', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2019-05-05 14:37:14', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, null);
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('9a90363f216a6a08f32eecb3f0bf12a3', '2a470fc0c3954d9dbb61de6d80846549', 'Jero组件示例', '/demo/SelectDemo', 'demo/SelectDemo', null, null, '1', null, null, '0', '0', null, '1', '1', '0', '0', null, 'admin', TO_DATE('2019-03-19 11:19:05', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2021-03-16 22:15:28', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, '0');
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('ae4fed059f67086fd52a73d913cf473d', '540a2936940846cb98114ffb0d145cb8', '内联编辑表格', '/list/edit-table', 'demo/list/TableInnerEditList', null, null, '1', null, null, '2', null, null, '1', '1', null, null, null, null, TO_DATE('2018-12-25 20:34:38', 'YYYY-MM-DD HH24:MI:SS'), null, null, '0', '0', null, null);
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('aedbf679b5773c1f25e9f7b10111da73', '08e6b9dc3c04489c8e1ff2ce6f105aa4', 'SQL监控', '{{ window._CONFIG[''domianURL''] }}/druid/', 'layouts/IframePageView', null, null, '1', null, null, '3', '0', null, '1', '1', '0', '0', null, 'admin', TO_DATE('2019-01-30 09:43:22', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2020-09-09 14:48:38', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, '0');
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('aedbf679b5773c1f25e9f7b10111da73', '08e6b9dc3c04489c8e1ff2ce6f105aa4', 'SQL监控', '{{ window._CONFIG[''domianURL''] }}/druid/', 'layouts/IframePageView', null, null, '1', null, null, '3', '0', null, '1', '1', '0', '0', null, 'admin', TO_DATE('2019-01-30 09:43:22', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2020-09-09 14:48:38', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, '1');
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('b1cb0a3fedf7ed0e4653cb5a229837ee', 'e41b69c57a941a3bbcce45032fe57605', '定时任务', '/isystem/QuartzJobList', 'system/QuartzJobList', null, null, '1', null, null, '10', '0', null, '1', '1', '0', '0', null, null, TO_DATE('2019-01-03 09:38:52', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2021-03-16 22:42:39', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, '0');
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('b3c824fc22bd953e2eb16ae6914ac8f9', '4875ebe289344e14844d8e3ea1edd73f', '高级详情页', '/profile/advanced', 'demo/profile/advanced/Advanced', null, null, '1', null, null, '2', null, null, '1', '1', null, null, null, null, TO_DATE('2018-12-25 20:34:38', 'YYYY-MM-DD HH24:MI:SS'), null, null, '0', '0', null, null);
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('b4dfc7d5dd9e8d5b6dd6d4579b1aa559', 'c65321e57b7949b7a975313220de0422', '500', '/exception/500', 'exception/500', null, null, '1', null, null, '3', null, null, '1', '1', null, null, null, null, TO_DATE('2018-12-25 20:34:38', 'YYYY-MM-DD HH24:MI:SS'), null, null, '0', '0', null, null);
|
||||
@@ -2181,7 +2094,7 @@ INSERT INTO "SYS_PERMISSION" VALUES ('265de841c58907954b8877fb85212622', '2a470f
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('277bfabef7d76e89b33062b16a9a5020', 'e3c13679c73a4f829bcff2aba8fd68b1', '基础表单', '/form/base-form', 'demo/form/BasicForm', null, null, '1', null, null, '1', '0', null, '1', '0', null, '0', null, null, TO_DATE('2018-12-25 20:34:38', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2019-02-26 17:02:08', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, null);
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('2a470fc0c3954d9dbb61de6d80846549', null, '开发示例Demo', '/jero', 'layouts/RouteView', null, null, '0', null, null, '20', '0', 'qrcode', '1', '0', '0', '0', null, null, TO_DATE('2018-12-25 20:34:38', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2021-03-16 22:31:20', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, '0');
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('2aeddae571695cd6380f6d6d334d6e7d', 'f0675b52d89100ee88472b6800754a08', '布局统计报表', '/report/ArchivesStatisticst', 'demo/report/ArchivesStatisticst', null, null, '1', null, null, '1', '0', null, '1', '1', null, '0', null, 'admin', TO_DATE('2019-04-03 18:32:48', 'YYYY-MM-DD HH24:MI:SS'), null, null, '0', '0', null, null);
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('2dbbafa22cda07fa5d169d741b81fe12', 'e41b69c57a941a3bbcce45032fe57605', '在线文档', '{{ window._CONFIG[''domianURL''] }}/doc.html', 'layouts/IframePageView', null, null, '1', null, null, '8', '0', null, '1', '1', '0', '0', null, 'admin', TO_DATE('2019-01-30 10:00:01', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2021-03-16 22:33:43', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, '0');
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('2dbbafa22cda07fa5d169d741b81fe12', 'e41b69c57a941a3bbcce45032fe57605', '在线文档', '{{ window._CONFIG[''domianURL''] }}/doc.html', 'layouts/IframePageView', null, null, '1', null, null, '8', '0', null, '1', '1', '0', '0', null, 'admin', TO_DATE('2019-01-30 10:00:01', 'YYYY-MM-DD HH24:MI:SS'), 'admin', TO_DATE('2021-03-16 22:33:43', 'YYYY-MM-DD HH24:MI:SS'), '0', '0', null, '1');
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('1383952003393466369', '190c2b43bec6a5f7a4194a85db67d96a', '角色添加', NULL, NULL, NULL, NULL, 2, 'sys:role:add', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', TO_DATE('2021-04-19 09:14:05', 'YYYY-MM-DD HH24:MI:SS'), NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('1383952499906785282', '190c2b43bec6a5f7a4194a85db67d96a', '角色编辑', NULL, NULL, NULL, NULL, 2, 'sys:role:edit', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', TO_DATE('2021-04-19 09:14:05', 'YYYY-MM-DD HH24:MI:SS'), NULL, NULL, 0, 0, '1', 0);
|
||||
INSERT INTO "SYS_PERMISSION" VALUES ('1383952680177971201', '190c2b43bec6a5f7a4194a85db67d96a', '角色删除', NULL, NULL, NULL, NULL, 2, 'sys:role:del', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', TO_DATE('2021-04-19 09:14:05', 'YYYY-MM-DD HH24:MI:SS'), NULL, NULL, 0, 0, '1', 0);
|
||||
@@ -3786,63 +3699,6 @@ ALTER TABLE "SYS_DEPART_PERMISSION" ADD CHECK ("ID" IS NOT NULL);
|
||||
-- ----------------------------
|
||||
ALTER TABLE "SYS_DEPART_PERMISSION" ADD PRIMARY KEY ("ID");
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table SYS_DEPART_ROLE
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Checks structure for table SYS_DEPART_ROLE
|
||||
-- ----------------------------
|
||||
ALTER TABLE "SYS_DEPART_ROLE" ADD CHECK ("ID" IS NOT NULL);
|
||||
ALTER TABLE "SYS_DEPART_ROLE" ADD CHECK ("ID" IS NOT NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Primary Key structure for table SYS_DEPART_ROLE
|
||||
-- ----------------------------
|
||||
ALTER TABLE "SYS_DEPART_ROLE" ADD PRIMARY KEY ("ID");
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table SYS_DEPART_ROLE_PERMISSION
|
||||
-- ----------------------------
|
||||
CREATE INDEX "IDX_SDRP_PER_ID"
|
||||
ON "SYS_DEPART_ROLE_PERMISSION" ("PERMISSION_ID" ASC)
|
||||
LOGGING
|
||||
VISIBLE;
|
||||
CREATE INDEX "IDX_SDRP_ROLE_ID"
|
||||
ON "SYS_DEPART_ROLE_PERMISSION" ("ROLE_ID" ASC)
|
||||
LOGGING
|
||||
VISIBLE;
|
||||
CREATE INDEX "IDX_SDRP_ROLE_PER_ID"
|
||||
ON "SYS_DEPART_ROLE_PERMISSION" ("ROLE_ID" ASC, "PERMISSION_ID" ASC)
|
||||
LOGGING
|
||||
VISIBLE;
|
||||
|
||||
-- ----------------------------
|
||||
-- Checks structure for table SYS_DEPART_ROLE_PERMISSION
|
||||
-- ----------------------------
|
||||
ALTER TABLE "SYS_DEPART_ROLE_PERMISSION" ADD CHECK ("ID" IS NOT NULL);
|
||||
ALTER TABLE "SYS_DEPART_ROLE_PERMISSION" ADD CHECK ("ID" IS NOT NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Primary Key structure for table SYS_DEPART_ROLE_PERMISSION
|
||||
-- ----------------------------
|
||||
ALTER TABLE "SYS_DEPART_ROLE_PERMISSION" ADD PRIMARY KEY ("ID");
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table SYS_DEPART_ROLE_USER
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Checks structure for table SYS_DEPART_ROLE_USER
|
||||
-- ----------------------------
|
||||
ALTER TABLE "SYS_DEPART_ROLE_USER" ADD CHECK ("ID" IS NOT NULL);
|
||||
ALTER TABLE "SYS_DEPART_ROLE_USER" ADD CHECK ("ID" IS NOT NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Primary Key structure for table SYS_DEPART_ROLE_USER
|
||||
-- ----------------------------
|
||||
ALTER TABLE "SYS_DEPART_ROLE_USER" ADD PRIMARY KEY ("ID");
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table SYS_DICT
|
||||
-- ----------------------------
|
||||
|
||||
@@ -4204,219 +4204,6 @@ GO
|
||||
-- Records of sys_depart_permission
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_depart_role
|
||||
-- ----------------------------
|
||||
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_depart_role]') AND type IN ('U'))
|
||||
DROP TABLE [dbo].[sys_depart_role]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[sys_depart_role] (
|
||||
[id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||
[depart_id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[role_name] nvarchar(200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[role_code] nvarchar(100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[description] nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[create_by] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[create_time] datetime2(7) NULL,
|
||||
[update_by] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[update_time] datetime2(7) NULL
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[sys_depart_role] SET (LOCK_ESCALATION = TABLE)
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'部门id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'depart_id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'部门角色名称',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'role_name'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'部门角色编码',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'role_code'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'描述',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'description'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'创建人',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'create_by'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'创建时间',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'create_time'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'更新人',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'update_by'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'更新时间',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role',
|
||||
'COLUMN', N'update_time'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'部门角色表',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role'
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_depart_role
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_depart_role_permission
|
||||
-- ----------------------------
|
||||
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_depart_role_permission]') AND type IN ('U'))
|
||||
DROP TABLE [dbo].[sys_depart_role_permission]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[sys_depart_role_permission] (
|
||||
[id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||
[depart_id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[role_id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[permission_id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[data_rule_ids] nvarchar(1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[operate_date] datetime2(7) NULL,
|
||||
[operate_ip] nvarchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[sys_depart_role_permission] SET (LOCK_ESCALATION = TABLE)
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'部门id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_permission',
|
||||
'COLUMN', N'depart_id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'角色id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_permission',
|
||||
'COLUMN', N'role_id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'权限id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_permission',
|
||||
'COLUMN', N'permission_id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'数据权限ids',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_permission',
|
||||
'COLUMN', N'data_rule_ids'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'操作时间',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_permission',
|
||||
'COLUMN', N'operate_date'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'操作ip',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_permission',
|
||||
'COLUMN', N'operate_ip'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'部门角色权限表',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_permission'
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_depart_role_permission
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_depart_role_user
|
||||
-- ----------------------------
|
||||
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_depart_role_user]') AND type IN ('U'))
|
||||
DROP TABLE [dbo].[sys_depart_role_user]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[sys_depart_role_user] (
|
||||
[id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||
[user_id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||
[drole_id] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[sys_depart_role_user] SET (LOCK_ESCALATION = TABLE)
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'主键id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_user',
|
||||
'COLUMN', N'id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'用户id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_user',
|
||||
'COLUMN', N'user_id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'角色id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_user',
|
||||
'COLUMN', N'drole_id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'部门角色用户表',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'sys_depart_role_user'
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_depart_role_user
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dict
|
||||
-- ----------------------------
|
||||
@@ -5675,7 +5462,7 @@ GO
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'2aeddae571695cd6380f6d6d334d6e7d', N'f0675b52d89100ee88472b6800754a08', N'布局统计报表', N'/report/ArchivesStatisticst', N'demo/report/ArchivesStatisticst', NULL, NULL, N'1', NULL, NULL, N'1', N'0', NULL, N'1', N'1', NULL, N'0', NULL, N'admin', N'2019-04-03 18:32:48.0000000', NULL, NULL, N'0', N'0', NULL, NULL)
|
||||
GO
|
||||
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'2dbbafa22cda07fa5d169d741b81fe12', N'e41b69c57a941a3bbcce45032fe57605', N'在线文档', N'{{ window._CONFIG[''domianURL''] }}/doc.html', N'layouts/IframePageView', NULL, NULL, N'1', NULL, NULL, N'8', N'0', NULL, N'1', N'1', N'0', N'0', NULL, N'admin', N'2019-01-30 10:00:01.0000000', N'admin', N'2021-03-16 22:33:43.0000000', N'0', N'0', NULL, N'0')
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'2dbbafa22cda07fa5d169d741b81fe12', N'e41b69c57a941a3bbcce45032fe57605', N'在线文档', N'{{ window._CONFIG[''domianURL''] }}/doc.html', N'layouts/IframePageView', NULL, NULL, N'1', NULL, NULL, N'8', N'0', NULL, N'1', N'1', N'0', N'0', NULL, N'admin', N'2019-01-30 10:00:01.0000000', N'admin', N'2021-03-16 22:33:43.0000000', N'0', N'0', NULL, N'1')
|
||||
GO
|
||||
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'2e42e3835c2b44ec9f7bc26c146ee531', N'2a470fc0c3954d9dbb61de6d80846549', N'结果页', N'/result', N'layouts/PageView', NULL, NULL, N'1', NULL, NULL, N'20', N'0', N'check-circle-o', N'1', N'0', N'0', N'0', NULL, NULL, N'2018-12-25 20:34:38.0000000', N'admin', N'2021-03-16 22:22:54.0000000', N'0', N'0', NULL, N'0')
|
||||
@@ -5792,7 +5579,7 @@ GO
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'ae4fed059f67086fd52a73d913cf473d', N'540a2936940846cb98114ffb0d145cb8', N'内联编辑表格', N'/list/edit-table', N'demo/list/TableInnerEditList', NULL, NULL, N'1', NULL, NULL, N'2', NULL, NULL, N'1', N'1', NULL, NULL, NULL, NULL, N'2018-12-25 20:34:38.0000000', NULL, NULL, N'0', N'0', NULL, NULL)
|
||||
GO
|
||||
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'aedbf679b5773c1f25e9f7b10111da73', N'08e6b9dc3c04489c8e1ff2ce6f105aa4', N'SQL监控', N'{{ window._CONFIG[''domianURL''] }}/druid/', N'layouts/IframePageView', NULL, NULL, N'1', NULL, NULL, N'3', N'0', NULL, N'1', N'1', N'0', N'0', NULL, N'admin', N'2019-01-30 09:43:22.0000000', N'admin', N'2020-09-09 14:48:38.0000000', N'0', N'0', NULL, N'0')
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'aedbf679b5773c1f25e9f7b10111da73', N'08e6b9dc3c04489c8e1ff2ce6f105aa4', N'SQL监控', N'{{ window._CONFIG[''domianURL''] }}/druid/', N'layouts/IframePageView', NULL, NULL, N'1', NULL, NULL, N'3', N'0', NULL, N'1', N'1', N'0', N'0', NULL, N'admin', N'2019-01-30 09:43:22.0000000', N'admin', N'2020-09-09 14:48:38.0000000', N'0', N'0', NULL, N'1')
|
||||
GO
|
||||
|
||||
INSERT INTO [dbo].[sys_permission] ([id], [parent_id], [name], [url], [component], [component_name], [redirect], [menu_type], [perms], [perms_type], [sort_no], [always_show], [icon], [is_route], [is_leaf], [keep_alive], [hidden], [description], [create_by], [create_time], [update_by], [update_time], [del_flag], [rule_flag], [status], [internal_or_external]) VALUES (N'b1cb0a3fedf7ed0e4653cb5a229837ee', N'e41b69c57a941a3bbcce45032fe57605', N'定时任务', N'/isystem/QuartzJobList', N'system/QuartzJobList', NULL, NULL, N'1', NULL, NULL, N'10', N'0', NULL, N'1', N'1', N'0', N'0', NULL, NULL, N'2019-01-03 09:38:52.0000000', N'admin', N'2021-03-16 22:42:39.0000000', N'0', N'0', NULL, N'0')
|
||||
@@ -8557,76 +8344,6 @@ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW
|
||||
ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Primary Key structure for table sys_depart_role
|
||||
-- ----------------------------
|
||||
ALTER TABLE [dbo].[sys_depart_role] ADD CONSTRAINT [PK__sys_depa__3213E83FD3FE48EB] PRIMARY KEY CLUSTERED ([id])
|
||||
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
||||
ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table sys_depart_role_permission
|
||||
-- ----------------------------
|
||||
CREATE NONCLUSTERED INDEX [index_group_role_per_id]
|
||||
ON [dbo].[sys_depart_role_permission] (
|
||||
[role_id] ASC,
|
||||
[permission_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE NONCLUSTERED INDEX [index_group_role_id]
|
||||
ON [dbo].[sys_depart_role_permission] (
|
||||
[role_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE NONCLUSTERED INDEX [index_group_per_id]
|
||||
ON [dbo].[sys_depart_role_permission] (
|
||||
[permission_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE NONCLUSTERED INDEX [idx_sdrp_role_per_id]
|
||||
ON [dbo].[sys_depart_role_permission] (
|
||||
[role_id] ASC,
|
||||
[permission_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE NONCLUSTERED INDEX [idx_sdrp_role_id]
|
||||
ON [dbo].[sys_depart_role_permission] (
|
||||
[role_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE NONCLUSTERED INDEX [idx_sdrp_per_id]
|
||||
ON [dbo].[sys_depart_role_permission] (
|
||||
[permission_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Primary Key structure for table sys_depart_role_permission
|
||||
-- ----------------------------
|
||||
ALTER TABLE [dbo].[sys_depart_role_permission] ADD CONSTRAINT [PK__sys_depa__3213E83F1D8B962B] PRIMARY KEY CLUSTERED ([id])
|
||||
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
||||
ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Primary Key structure for table sys_depart_role_user
|
||||
-- ----------------------------
|
||||
ALTER TABLE [dbo].[sys_depart_role_user] ADD CONSTRAINT [PK__sys_depa__3213E83FA05CDB64] PRIMARY KEY CLUSTERED ([id])
|
||||
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
||||
ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table sys_dict
|
||||
-- ----------------------------
|
||||
|
||||
-7
@@ -107,13 +107,6 @@ public class Result<T> implements Serializable {
|
||||
return r;
|
||||
}
|
||||
|
||||
public static<T> Result<T> error500(String message) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.message = message;
|
||||
r.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
|
||||
r.success = false;
|
||||
return r;
|
||||
}
|
||||
/**
|
||||
* 无权限访问返回结果
|
||||
*/
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.jero.common.exception;
|
||||
|
||||
import io.lettuce.core.RedisConnectionException;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import com.jero.common.api.vo.Result;
|
||||
@@ -29,7 +29,7 @@ public class JeroBootExceptionHandler {
|
||||
* 处理自定义异常
|
||||
*/
|
||||
@ExceptionHandler(JeroBootException.class)
|
||||
public Result<?> handleRRException(JeroBootException e){
|
||||
public Result<?> handleJeroBootException(JeroBootException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
+1
-4
@@ -215,7 +215,7 @@ public class QueryGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
//多字段排序 TODO 需要修改前端
|
||||
//多字段排序
|
||||
public static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
|
||||
String column=null,order=null;
|
||||
if(parameterMap!=null&& parameterMap.containsKey(ORDER_COLUMN)) {
|
||||
@@ -224,7 +224,6 @@ public class QueryGenerator {
|
||||
if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
|
||||
order = parameterMap.get(ORDER_TYPE)[0];
|
||||
}
|
||||
log.info("排序规则>>列:" + column + ",排序方式:" + order);
|
||||
if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
//字典字段,去掉字典翻译文本后缀
|
||||
if(column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) {
|
||||
@@ -238,12 +237,10 @@ public class QueryGenerator {
|
||||
// 将现有排序 _ 前端传递排序条件{....,column: 'column1,column2',order: 'desc'} 翻译成sql "column1,column2 desc"
|
||||
// 修改为 _ 前端传递排序条件{....,column: 'column1,column2',order: 'desc'} 翻译成sql "column1 desc,column2 desc"
|
||||
if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
|
||||
// queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
String columnStr = oConvertUtils.camelToUnderline(column);
|
||||
String[] columnArray = columnStr.split(",");
|
||||
queryWrapper.orderByAsc(Arrays.asList(columnArray));
|
||||
} else {
|
||||
// queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
String columnStr = oConvertUtils.camelToUnderline(column);
|
||||
String[] columnArray = columnStr.split(",");
|
||||
queryWrapper.orderByDesc(Arrays.asList(columnArray));
|
||||
|
||||
+3
-2
@@ -28,8 +28,9 @@ import com.jero.common.util.oConvertUtils;
|
||||
**/
|
||||
public class JwtUtil {
|
||||
|
||||
// Token过期时间30分钟(用户登录过期时间是此时间的两倍,以token在reids缓存时间为准)
|
||||
public static final long EXPIRE_TIME = 60 * 60 * 1000;
|
||||
// Token过期时间180分钟(用户登录过期时间是此时间的两倍,以token在reids缓存时间为准)
|
||||
public static final long EXPIRE_TIME = 180 * 60 * 1000;
|
||||
// public static final long EXPIRE_TIME = 2000;
|
||||
|
||||
/**
|
||||
* 校验token是否正确
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public class TokenUtils {
|
||||
String newAuthorization = JwtUtil.sign(userName, passWord);
|
||||
// 设置Toekn缓存有效时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, newAuthorization);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
}
|
||||
//update-begin--Author:scott Date:20191005 for:解决每次请求,都重写redis中 token缓存问题
|
||||
// else {
|
||||
|
||||
+1
-8
@@ -162,16 +162,9 @@ public class ShiroRealm extends AuthorizingRealm {
|
||||
String newAuthorization = JwtUtil.sign(userName, passWord);
|
||||
// 设置超时时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, newAuthorization);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME *2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
log.debug("——————————用户在线操作,更新token保证不掉线—————————jwtTokenRefresh——————— "+ token);
|
||||
}
|
||||
//update-begin--Author:scott Date:20191005 for:解决每次请求,都重写redis中 token缓存问题
|
||||
// else {
|
||||
// // 设置超时时间
|
||||
// redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, cacheToken);
|
||||
// redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
// }
|
||||
//update-end--Author:scott Date:20191005 for:解决每次请求,都重写redis中 token缓存问题
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+4
-4
@@ -82,7 +82,7 @@ public class OnlCgformAuthController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class OnlCgformAuthController {
|
||||
return Result.OK("操作成功!", paramOnlAuthPage);
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class OnlCgformAuthController {
|
||||
return Result.OK("操作成功!");
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class OnlCgformAuthController {
|
||||
return Result.OK("操作成功!");
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -143,8 +143,7 @@ public class OnlCgformApiController {
|
||||
Result var2 = new Result();
|
||||
OnlCgformHead var3 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
var2.error500("实体不存在");
|
||||
return var2;
|
||||
return Result.error("实体不存在");
|
||||
} else {
|
||||
OnlComplexModel var4 = this.onlineService.queryOnlineConfig(var3);
|
||||
var4.setIsDesForm(var3.getIsDesForm());
|
||||
@@ -167,8 +166,7 @@ public class OnlCgformApiController {
|
||||
Result var3 = new Result();
|
||||
OnlCgformHead var4 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var4 == null) {
|
||||
var3.error500("实体不存在");
|
||||
return var3;
|
||||
return Result.error("实体不存在");
|
||||
} else {
|
||||
try {
|
||||
String var5 = var4.getTableName();
|
||||
@@ -178,7 +176,7 @@ public class OnlCgformApiController {
|
||||
var3.setResult(var7);
|
||||
} catch (Exception var8) {
|
||||
log.error(var8.getMessage(), var8);
|
||||
var3.error500("数据库查询失败," + var8.getMessage());
|
||||
return Result.error("数据库查询失败," + var8.getMessage());
|
||||
}
|
||||
|
||||
var3.setOnlTable(var4.getTableName());
|
||||
@@ -1100,7 +1098,7 @@ public class OnlCgformApiController {
|
||||
Result var3 = new Result();
|
||||
OnlCgformHead var4 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var4 == null) {
|
||||
var3.error500("实体不存在");
|
||||
var3.error("实体不存在");
|
||||
return var3;
|
||||
} else {
|
||||
try {
|
||||
@@ -1127,7 +1125,7 @@ public class OnlCgformApiController {
|
||||
var3.setResult(var11);
|
||||
} catch (Exception var12) {
|
||||
log.error(var12.getMessage(), var12);
|
||||
var3.error500("数据库查询失败" + var12.getMessage());
|
||||
var3.error("数据库查询失败" + var12.getMessage());
|
||||
}
|
||||
|
||||
var3.setOnlTable(var4.getTableName());
|
||||
@@ -1183,7 +1181,7 @@ public class OnlCgformApiController {
|
||||
Result var2 = new Result();
|
||||
OnlCgformHead var3 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
var2.error500("实体不存在");
|
||||
var2.error("实体不存在");
|
||||
return var2;
|
||||
} else {
|
||||
HashMap var4 = new HashMap();
|
||||
|
||||
+6
-6
@@ -54,7 +54,7 @@ public class OnlCgformButtonController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class OnlCgformButtonController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class OnlCgformButtonController {
|
||||
public Result<Object> edit(@RequestBody OnlCgformButton cgformButton) {
|
||||
OnlCgformButton existCgformButton = (OnlCgformButton)this.onlCgformButtonService.getById(cgformButton.getId());
|
||||
if (existCgformButton == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean flag = this.onlCgformButtonService.updateById(cgformButton);
|
||||
if (flag) {
|
||||
@@ -92,7 +92,7 @@ public class OnlCgformButtonController {
|
||||
public Result<Object> delete(@RequestParam(name = "id",required = true) String id) {
|
||||
OnlCgformButton cgformButton = (OnlCgformButton)this.onlCgformButtonService.getById(id);
|
||||
if (cgformButton == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean flag = this.onlCgformButtonService.removeById(id);
|
||||
if (flag) {
|
||||
@@ -109,7 +109,7 @@ public class OnlCgformButtonController {
|
||||
this.onlCgformButtonService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class OnlCgformButtonController {
|
||||
public Result<OnlCgformButton> queryById(@RequestParam(name = "id",required = true) String id) {
|
||||
OnlCgformButton cgformButton = (OnlCgformButton)this.onlCgformButtonService.getById(id);
|
||||
if (cgformButton == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
return Result.OK(cgformButton);
|
||||
}
|
||||
|
||||
+5
-5
@@ -72,7 +72,7 @@ public class OnlCgformFieldController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class OnlCgformFieldController {
|
||||
public Result<Object> edit(@RequestBody OnlCgformField var1) {
|
||||
OnlCgformField var3 = (OnlCgformField)this.onlCgformFieldService.getById(var1.getId());
|
||||
if (var3 == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean var4 = this.onlCgformFieldService.updateById(var1);
|
||||
if (var4) {
|
||||
@@ -94,7 +94,7 @@ public class OnlCgformFieldController {
|
||||
public Result<Object> delete(@RequestParam(name = "id",required = true) String var1) {
|
||||
OnlCgformField var3 = (OnlCgformField)this.onlCgformFieldService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean var4 = this.onlCgformFieldService.removeById(var1);
|
||||
if (var4) {
|
||||
@@ -111,7 +111,7 @@ public class OnlCgformFieldController {
|
||||
this.onlCgformFieldService.removeByIds(Arrays.asList(var1.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class OnlCgformFieldController {
|
||||
public Result<Object> queryById(@RequestParam(name = "id",required = true) String var1) {
|
||||
OnlCgformField var3 = (OnlCgformField)this.onlCgformFieldService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
return Result.OK(var3);
|
||||
}
|
||||
|
||||
+4
-4
@@ -92,7 +92,7 @@ public class OnlCgformHeadController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class OnlCgformHeadController {
|
||||
public Result<Object> edit(@RequestBody OnlCgformHead var1) {
|
||||
OnlCgformHead var3 = (OnlCgformHead)this.onlCgformHeadService.getById(var1.getId());
|
||||
if (var3 == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean var4 = this.onlCgformHeadService.updateById(var1);
|
||||
if (var4) {
|
||||
@@ -142,7 +142,7 @@ public class OnlCgformHeadController {
|
||||
this.onlCgformHeadService.deleteBatch(var1, var2);
|
||||
return Result.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class OnlCgformHeadController {
|
||||
public Result<OnlCgformHead> queryById(@RequestParam(name = "id",required = true) String id) {
|
||||
OnlCgformHead cgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(id);
|
||||
if (cgformHead == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
return Result.OK(cgformHead);
|
||||
}
|
||||
|
||||
+5
-5
@@ -61,7 +61,7 @@ public class OnlCgformIndexController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class OnlCgformIndexController {
|
||||
public Result<Object> edit(@RequestBody OnlCgformIndex cgformIndex) {
|
||||
OnlCgformIndex existCgformIndex = (OnlCgformIndex)this.onlCgformIndexService.getById(cgformIndex.getId());
|
||||
if (existCgformIndex == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean flag = this.onlCgformIndexService.updateById(cgformIndex);
|
||||
if (flag) {
|
||||
@@ -84,7 +84,7 @@ public class OnlCgformIndexController {
|
||||
public Result<Object> delete(@RequestParam(name = "id",required = true) String id) {
|
||||
OnlCgformIndex cgformIndex = (OnlCgformIndex)this.onlCgformIndexService.getById(id);
|
||||
if (cgformIndex == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean flag = this.onlCgformIndexService.removeById(id);
|
||||
if (flag) {
|
||||
@@ -101,7 +101,7 @@ public class OnlCgformIndexController {
|
||||
this.onlCgformIndexService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class OnlCgformIndexController {
|
||||
public Result<OnlCgformIndex> queryById(@RequestParam(name = "id",required = true) String var1) {
|
||||
OnlCgformIndex cgformIndex = (OnlCgformIndex)this.onlCgformIndexService.getById(var1);
|
||||
if (cgformIndex == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
return Result.OK(cgformIndex);
|
||||
}
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ public class OnlCgreportHeadController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception var9) {
|
||||
log.error(var9.getMessage(), var9);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ public class MockController {
|
||||
res.setResult(list);
|
||||
res.setMessage("查询成功");
|
||||
} catch (Exception e) {
|
||||
res.error500("查询失败"+e.getMessage());
|
||||
return Result.error("查询失败"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
+5
-5
@@ -88,7 +88,7 @@ public class JoaDemoController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class JoaDemoController {
|
||||
public Result<Object> edit(@RequestBody JoaDemo joaDemo) {
|
||||
JoaDemo joaDemoEntity = joaDemoService.getById(joaDemo.getId());
|
||||
if(joaDemoEntity==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = joaDemoService.updateById(joaDemo);
|
||||
if(ok) {
|
||||
@@ -121,7 +121,7 @@ public class JoaDemoController {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
JoaDemo joaDemo = joaDemoService.getById(id);
|
||||
if(joaDemo==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = joaDemoService.removeById(id);
|
||||
if(ok) {
|
||||
@@ -139,7 +139,7 @@ public class JoaDemoController {
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
this.joaDemoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
@@ -155,7 +155,7 @@ public class JoaDemoController {
|
||||
public Result<JoaDemo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
JoaDemo joaDemo = joaDemoService.getById(id);
|
||||
if(joaDemo==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(joaDemo);
|
||||
}
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ public class CasClientController {
|
||||
String token = JwtUtil.sign(sysUser.getUsername(), sysUser.getPassword());
|
||||
// 设置超时时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
|
||||
//获取用户部门信息
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
+2
-2
@@ -155,13 +155,13 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
try {
|
||||
map = (Map<String, String>) JSON.parse(msgParams.getTestData());
|
||||
} catch (Exception e) {
|
||||
return Result.error500("解析Json出错!");
|
||||
return Result.error("解析Json出错!");
|
||||
}
|
||||
boolean is_sendSuccess = pushMsgUtil.sendMessage(msgParams.getMsgType(), msgParams.getTemplateCode(), map, msgParams.getReceiver());
|
||||
if (is_sendSuccess) {
|
||||
return Result.OK("发送消息任务添加成功!");
|
||||
} else {
|
||||
return Result.error500("发送消息任务添加失败!");
|
||||
return Result.error("发送消息任务添加失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ public class ActuatorRedisController {
|
||||
res.setResult(list);
|
||||
res.setMessage("查询成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error500("查询失败"+e.getMessage());
|
||||
return Result.error("查询失败"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
+1
-2
@@ -63,8 +63,7 @@ public class NgAlainController {
|
||||
result.setResult(ls);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
List<JSONObject> dictlist=new ArrayList<>();
|
||||
for (DictModel l : ls) {
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ public class OSSFileController {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
log.info(ex.getMessage(), ex);
|
||||
return Result.error500("上传失败");
|
||||
return Result.error("上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class OSSFileController {
|
||||
public Result delete(@RequestParam(name = "id") String id) {
|
||||
OSSFile file = ossFileService.getById(id);
|
||||
if (file == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = ossFileService.delete(file);
|
||||
if (ok) {
|
||||
@@ -81,7 +81,7 @@ public class OSSFileController {
|
||||
Result<OSSFile> result = new Result<>();
|
||||
OSSFile file = ossFileService.getById(id);
|
||||
if (file == null) {
|
||||
result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}
|
||||
else {
|
||||
result.setResult(file);
|
||||
|
||||
+8
-8
@@ -126,7 +126,7 @@ public class SysAnnouncementController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class SysAnnouncementController {
|
||||
public Result<Object> eidt(@RequestBody SysAnnouncement sysAnnouncement) {
|
||||
SysAnnouncement sysAnnouncementEntity = sysAnnouncementService.getById(sysAnnouncement.getId());
|
||||
if(sysAnnouncementEntity==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
// update-begin-author:liusq date:20210804 for:标题处理xss攻击的问题
|
||||
String title = XSSUtils.striptXSS(sysAnnouncement.getTitile());
|
||||
@@ -163,7 +163,7 @@ public class SysAnnouncementController {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_1.toString());
|
||||
boolean ok = sysAnnouncementService.updateById(sysAnnouncement);
|
||||
@@ -183,7 +183,7 @@ public class SysAnnouncementController {
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
String[] id = ids.split(",");
|
||||
for(int i=0;i<id.length;i++) {
|
||||
@@ -205,7 +205,7 @@ public class SysAnnouncementController {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysAnnouncement);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class SysAnnouncementController {
|
||||
public Result<SysAnnouncement> doReleaseData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.PUBLISHED_STATUS_1);//发布中
|
||||
sysAnnouncement.setSendTime(new Date());
|
||||
@@ -262,7 +262,7 @@ public class SysAnnouncementController {
|
||||
public Result<Object> doReovkeData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.REVOKE_STATUS_2);//撤销发布
|
||||
sysAnnouncement.setCancelTime(new Date());
|
||||
@@ -401,7 +401,7 @@ public class SysAnnouncementController {
|
||||
if(StringUtils.isNotBlank(anntId)){
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(anntId);
|
||||
if(sysAnnouncement==null) {
|
||||
result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
if(sysAnnouncement.getMsgType().equals(CommonConstant.MSG_TYPE_ALL)) {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
|
||||
+5
-5
@@ -94,7 +94,7 @@ public class SysAnnouncementSendController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SysAnnouncementSendController {
|
||||
public Result<Object> edit(@RequestBody SysAnnouncementSend sysAnnouncementSend) {
|
||||
SysAnnouncementSend sysAnnouncementSendEntity = sysAnnouncementSendService.getById(sysAnnouncementSend.getId());
|
||||
if(sysAnnouncementSendEntity==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysAnnouncementSendService.updateById(sysAnnouncementSend);
|
||||
if(ok) {
|
||||
@@ -127,7 +127,7 @@ public class SysAnnouncementSendController {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysAnnouncementSend sysAnnouncementSend = sysAnnouncementSendService.getById(id);
|
||||
if(sysAnnouncementSend==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysAnnouncementSendService.removeById(id);
|
||||
if(ok) {
|
||||
@@ -146,7 +146,7 @@ public class SysAnnouncementSendController {
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(ids == null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
this.sysAnnouncementSendService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
@@ -163,7 +163,7 @@ public class SysAnnouncementSendController {
|
||||
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
|
||||
SysAnnouncementSend sysAnnouncementSend = sysAnnouncementSendService.getById(id);
|
||||
if(sysAnnouncementSend==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysAnnouncementSend);
|
||||
}
|
||||
|
||||
+5
-5
@@ -104,7 +104,7 @@ public class SysCategoryController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class SysCategoryController {
|
||||
public Result<Object> edit(@RequestBody SysCategory sysCategory) {
|
||||
SysCategory sysCategoryEntity = sysCategoryService.getById(sysCategory.getId());
|
||||
if(sysCategoryEntity==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
sysCategoryService.updateSysCategory(sysCategory);
|
||||
return Result.OK("修改成功!");
|
||||
@@ -135,7 +135,7 @@ public class SysCategoryController {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysCategory sysCategory = sysCategoryService.getById(id);
|
||||
if(sysCategory==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
this.sysCategoryService.deleteSysCategory(id);
|
||||
return Result.OK("删除成功!");
|
||||
@@ -151,7 +151,7 @@ public class SysCategoryController {
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
this.sysCategoryService.deleteSysCategory(ids);
|
||||
return Result.OK("删除成功!");
|
||||
@@ -168,7 +168,7 @@ public class SysCategoryController {
|
||||
public Result<SysCategory> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysCategory sysCategory = sysCategoryService.getById(id);
|
||||
if(sysCategory==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysCategory);
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class SysDataLogController {
|
||||
queryWrapper.eq("data_id", dataId);
|
||||
List<SysDataLog> list = service.list(queryWrapper);
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到版本信息");
|
||||
return Result.error("未找到版本信息");
|
||||
}else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
|
||||
+16
-16
@@ -182,7 +182,7 @@ public class SysDepartController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class SysDepartController {
|
||||
sysDepart.setUpdateBy(username);
|
||||
SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
|
||||
if (sysDepartEntity == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
|
||||
if (ok) {
|
||||
@@ -217,21 +217,21 @@ public class SysDepartController {
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresPermissions("sys:depart:del")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@RequiresPermissions("sys:depart:del")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysDepart sysDepart = sysDepartService.getById(id);
|
||||
if(sysDepart==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDepartService.delete(id);
|
||||
if(ok) {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysDepart sysDepart = sysDepartService.getById(id);
|
||||
if(sysDepart==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDepartService.delete(id);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -246,7 +246,7 @@ public class SysDepartController {
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<Object> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
} else {
|
||||
this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
|
||||
-44
@@ -13,7 +13,6 @@ import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysDepartPermission;
|
||||
import com.jero.modules.system.entity.SysDepartRolePermission;
|
||||
import com.jero.modules.system.entity.SysPermission;
|
||||
import com.jero.modules.system.entity.SysPermissionDataRule;
|
||||
import com.jero.modules.system.model.TreeModel;
|
||||
@@ -22,7 +21,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.modules.system.service.ISysDepartRolePermissionService;
|
||||
import com.jero.modules.system.service.ISysPermissionDataRuleService;
|
||||
import com.jero.modules.system.service.ISysPermissionService;
|
||||
|
||||
@@ -52,9 +50,6 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartRolePermissionService sysDepartRolePermissionService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -192,45 +187,6 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色授权
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryDeptRolePermission", method = RequestMethod.GET)
|
||||
public Result<List<String>> queryDeptRolePermission(@RequestParam(name = "roleId", required = true) String roleId) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
try {
|
||||
List<SysDepartRolePermission> list = sysDepartRolePermissionService.list(new QueryWrapper<SysDepartRolePermission>().lambda().eq(SysDepartRolePermission::getRoleId, roleId));
|
||||
result.setResult(list.stream().map(SysDepartRolePermission -> String.valueOf(SysDepartRolePermission.getPermissionId())).collect(Collectors.toList()));
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色授权
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/saveDeptRolePermission", method = RequestMethod.POST)
|
||||
public Result<Object> saveDeptRolePermission(@RequestBody JSONObject json) {
|
||||
long start = System.currentTimeMillis();
|
||||
try {
|
||||
String roleId = json.getString("roleId");
|
||||
String permissionIds = json.getString("permissionIds");
|
||||
String lastPermissionIds = json.getString("lastpermissionIds");
|
||||
this.sysDepartRolePermissionService.saveDeptRolePermission(roleId, permissionIds, lastPermissionIds);
|
||||
log.info("======部门角色授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒");
|
||||
return Result.OK("保存成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("授权失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户角色授权功能,查询菜单权限树
|
||||
* @param request
|
||||
|
||||
-294
@@ -1,294 +0,0 @@
|
||||
package com.jero.modules.system.controller;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.*;
|
||||
import com.jero.modules.system.service.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags="部门角色")
|
||||
@RestController
|
||||
@RequestMapping("/sys/sysDepartRole")
|
||||
public class SysDepartRoleController extends JeroController<SysDepartRole, ISysDepartRoleService> {
|
||||
@Autowired
|
||||
private ISysDepartRoleService sysDepartRoleService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartRoleUserService departRoleUserService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartPermissionService sysDepartPermissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartRolePermissionService sysDepartRolePermissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysDepartRole
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="部门角色-分页列表查询", notes="部门角色-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SysDepartRole sysDepartRole,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name="deptId",required=false) String deptId,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysDepartRole> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartRole, req.getParameterMap());
|
||||
Page<SysDepartRole> page = new Page<SysDepartRole>(pageNo, pageSize);
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<String> deptIds = null;
|
||||
// if(oConvertUtils.isEmpty(deptId)){
|
||||
// if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2) ){
|
||||
// deptIds = sysDepartService.getMySubDepIdsByDepId(user.getDepartIds());
|
||||
// }else{
|
||||
// return Result.OK(null);
|
||||
// }
|
||||
// }else{
|
||||
// deptIds = sysDepartService.getSubDepIdsByDepId(deptId);
|
||||
// }
|
||||
// queryWrapper.in("depart_id",deptIds);
|
||||
|
||||
//我的部门,选中部门只能看当前部门下的角色
|
||||
queryWrapper.eq("depart_id",deptId);
|
||||
IPage<SysDepartRole> pageList = sysDepartRoleService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysDepartRole
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@ApiOperation(value="部门角色-添加", notes="部门角色-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysDepartRole sysDepartRole) {
|
||||
sysDepartRoleService.save(sysDepartRole);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysDepartRole
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@ApiOperation(value="部门角色-编辑", notes="部门角色-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody SysDepartRole sysDepartRole) {
|
||||
sysDepartRoleService.updateById(sysDepartRole);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@AutoLog(value = "部门角色-通过id删除")
|
||||
@ApiOperation(value="部门角色-通过id删除", notes="部门角色-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysDepartRoleService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@AutoLog(value = "部门角色-批量删除")
|
||||
@ApiOperation(value="部门角色-批量删除", notes="部门角色-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sysDepartRoleService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="部门角色-通过id查询", notes="部门角色-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysDepartRole sysDepartRole = sysDepartRoleService.getById(id);
|
||||
return Result.OK(sysDepartRole);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下角色
|
||||
* @param departId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getDeptRoleList", method = RequestMethod.GET)
|
||||
public Result<List<SysDepartRole>> getDeptRoleList(@RequestParam(value = "departId") String departId,@RequestParam(value = "userId") String userId){
|
||||
Result<List<SysDepartRole>> result = new Result<>();
|
||||
//查询选中部门的角色
|
||||
List<SysDepartRole> deptRoleList = sysDepartRoleService.list(new LambdaQueryWrapper<SysDepartRole>().eq(SysDepartRole::getDepartId,departId));
|
||||
result.setSuccess(true);
|
||||
result.setResult(deptRoleList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deptRoleUserAdd", method = RequestMethod.POST)
|
||||
public Result<?> deptRoleAdd(@RequestBody JSONObject json) {
|
||||
String newRoleId = json.getString("newRoleId");
|
||||
String oldRoleId = json.getString("oldRoleId");
|
||||
String userId = json.getString("userId");
|
||||
departRoleUserService.deptRoleUserAdd(userId,newRoleId,oldRoleId);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id获取已设置部门角色
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getDeptRoleByUserId", method = RequestMethod.GET)
|
||||
public Result<List<SysDepartRoleUser>> getDeptRoleByUserId(@RequestParam(value = "userId") String userId,@RequestParam(value = "departId") String departId){
|
||||
Result<List<SysDepartRoleUser>> result = new Result<>();
|
||||
//查询部门下角色
|
||||
List<SysDepartRole> roleList = sysDepartRoleService.list(new QueryWrapper<SysDepartRole>().eq("depart_id",departId));
|
||||
List<String> roleIds = roleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
|
||||
//根据角色id,用户id查询已授权角色
|
||||
List<SysDepartRoleUser> roleUserList = null;
|
||||
if(roleIds!=null && roleIds.size()>0){
|
||||
roleUserList = departRoleUserService.list(new QueryWrapper<SysDepartRoleUser>().eq("user_id",userId).in("drole_id",roleIds));
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(roleUserList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据规则数据
|
||||
*/
|
||||
@GetMapping(value = "/datarule/{permissionId}/{departId}/{roleId}")
|
||||
public Result<?> loadDatarule(@PathVariable("permissionId") String permissionId,@PathVariable("departId") String departId,@PathVariable("roleId") String roleId) {
|
||||
//查询已授权的部门规则
|
||||
List<SysPermissionDataRule> list = sysDepartPermissionService.getPermRuleListByDeptIdAndPermId(departId,permissionId);
|
||||
if(list==null || list.size()==0) {
|
||||
return Result.error("未找到权限配置信息");
|
||||
}else {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("datarule", list);
|
||||
LambdaQueryWrapper<SysDepartRolePermission> query = new LambdaQueryWrapper<SysDepartRolePermission>()
|
||||
.eq(SysDepartRolePermission::getPermissionId, permissionId)
|
||||
.eq(SysDepartRolePermission::getRoleId,roleId);
|
||||
SysDepartRolePermission sysRolePermission = sysDepartRolePermissionService.getOne(query);
|
||||
if(sysRolePermission==null) {
|
||||
//return Result.error("未找到角色菜单配置信息");
|
||||
}else {
|
||||
String drChecked = sysRolePermission.getDataRuleIds();
|
||||
if(oConvertUtils.isNotEmpty(drChecked)) {
|
||||
map.put("drChecked", drChecked.endsWith(",")?drChecked.substring(0, drChecked.length()-1):drChecked);
|
||||
}
|
||||
}
|
||||
return Result.OK(map);
|
||||
//TODO 以后按钮权限的查询也走这个请求 无非在map中多加两个key
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据规则至角色菜单关联表
|
||||
*/
|
||||
@PostMapping(value = "/datarule")
|
||||
public Result<?> saveDatarule(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String permissionId = jsonObject.getString("permissionId");
|
||||
String roleId = jsonObject.getString("roleId");
|
||||
String dataRuleIds = jsonObject.getString("dataRuleIds");
|
||||
log.info("保存数据规则>>"+"菜单ID:"+permissionId+"角色ID:"+ roleId+"数据权限ID:"+dataRuleIds);
|
||||
LambdaQueryWrapper<SysDepartRolePermission> query = new LambdaQueryWrapper<SysDepartRolePermission>()
|
||||
.eq(SysDepartRolePermission::getPermissionId, permissionId)
|
||||
.eq(SysDepartRolePermission::getRoleId,roleId);
|
||||
SysDepartRolePermission sysRolePermission = sysDepartRolePermissionService.getOne(query);
|
||||
if(sysRolePermission==null) {
|
||||
return Result.error("请先保存角色菜单权限!");
|
||||
}else {
|
||||
sysRolePermission.setDataRuleIds(dataRuleIds);
|
||||
this.sysDepartRolePermissionService.updateById(sysRolePermission);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("SysRoleController.saveDatarule()发生异常:" + e.getMessage(),e);
|
||||
return Result.error("保存失败");
|
||||
}
|
||||
return Result.OK("保存成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysDepartRole
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysDepartRole sysDepartRole) {
|
||||
return super.exportXls(request, sysDepartRole, SysDepartRole.class, "部门角色");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysDepartRole.class);
|
||||
}
|
||||
|
||||
}
|
||||
+12
-19
@@ -146,8 +146,7 @@ public class SysDictController {
|
||||
result.setResult(text);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -165,16 +164,14 @@ public class SysDictController {
|
||||
try {
|
||||
List<DictModel> ls = sysDictService.getDictItems(dictCode);
|
||||
if (ls == null) {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
return Result.error("字典Code格式不正确!");
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
log.debug(result.toString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -196,8 +193,7 @@ public class SysDictController {
|
||||
try {
|
||||
List<DictModel> ls = sysDictService.loadDict(dictCode, keyword, pageSize);
|
||||
if (ls == null) {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
return Result.error("字典Code格式不正确!");
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
@@ -205,8 +201,7 @@ public class SysDictController {
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,8 +262,7 @@ public class SysDictController {
|
||||
if(dictCode.indexOf(",")!=-1) {
|
||||
String[] params = dictCode.split(",");
|
||||
if(params.length!=3) {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
return Result.error("字典Code格式不正确!");
|
||||
}
|
||||
List<String> texts = sysDictService.queryTableDictByKeys(params[0], params[1], params[2], keys, delNotExist);
|
||||
|
||||
@@ -276,12 +270,11 @@ public class SysDictController {
|
||||
result.setResult(texts);
|
||||
log.info(result.toString());
|
||||
}else {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return Result.error("字典Code格式不正确!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -348,7 +341,7 @@ public class SysDictController {
|
||||
return Result.OK("保存成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +355,7 @@ public class SysDictController {
|
||||
public Result<Object> edit(@RequestBody SysDict sysDict) {
|
||||
SysDict sysdict = sysDictService.getById(sysDict.getId());
|
||||
if(sysdict==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
sysDict.setUpdateTime(new Date());
|
||||
boolean ok = sysDictService.updateById(sysDict);
|
||||
@@ -388,7 +381,7 @@ public class SysDictController {
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
}else{
|
||||
return Result.error500("删除失败!");
|
||||
return Result.error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +395,7 @@ public class SysDictController {
|
||||
@CacheEvict(value= {CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
sysDictService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
|
||||
+4
-4
@@ -84,7 +84,7 @@ public class SysDictItemController {
|
||||
return Result.OK("保存成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class SysDictItemController {
|
||||
public Result<Object> edit(@RequestBody SysDictItem sysDictItem) {
|
||||
SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
|
||||
if(sysdict==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
sysDictItem.setUpdateTime(new Date());
|
||||
boolean ok = sysDictItemService.updateById(sysDictItem);
|
||||
@@ -123,7 +123,7 @@ public class SysDictItemController {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysDictItem joinSystem = sysDictItemService.getById(id);
|
||||
if(joinSystem==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDictItemService.removeById(id);
|
||||
if(ok) {
|
||||
@@ -144,7 +144,7 @@ public class SysDictItemController {
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
|
||||
+2
-2
@@ -78,7 +78,7 @@ public class SysLogController {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysLog sysLog = sysLogService.getById(id);
|
||||
if(sysLog==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysLogService.removeById(id);
|
||||
if(ok) {
|
||||
@@ -96,7 +96,7 @@ public class SysLogController {
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
if("allclear".equals(ids)) {
|
||||
this.sysLogService.removeAll();
|
||||
|
||||
+13
-13
@@ -187,7 +187,7 @@ public class SysPermissionController {
|
||||
// result.setResult(jsonArray);
|
||||
// result.success("查询成功");
|
||||
// } catch (Exception e) {
|
||||
// result.error500("查询失败:" + e.getMessage());
|
||||
// result.error("查询失败:" + e.getMessage());
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
// return result;
|
||||
@@ -231,8 +231,8 @@ public class SysPermissionController {
|
||||
result.setResult(json);
|
||||
result.setMessage("查询成功");
|
||||
} catch (Exception e) {
|
||||
result.error500("查询失败:" + e.getMessage());
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ public class SysPermissionController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class SysPermissionController {
|
||||
return Result.OK("修改成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ public class SysPermissionController {
|
||||
return Result.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500(e.getMessage());
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class SysPermissionController {
|
||||
return Result.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("删除成功!");
|
||||
return Result.error("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ public class SysPermissionController {
|
||||
try {
|
||||
List<TreeModel> list = sysPermissionService.queryListByParentId(parentId);
|
||||
if (list == null || list.size() <= 0) {
|
||||
result.error500("未找到角色信息");
|
||||
return Result.error("未找到角色信息");
|
||||
} else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
@@ -403,7 +403,7 @@ public class SysPermissionController {
|
||||
return Result.OK("保存成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("授权失败!");
|
||||
return Result.error("授权失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ public class SysPermissionController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ public class SysPermissionController {
|
||||
return Result.OK("更新成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,7 +717,7 @@ public class SysPermissionController {
|
||||
return Result.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,7 +734,7 @@ public class SysPermissionController {
|
||||
return Result.OK("查询成功", permRuleList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -774,7 +774,7 @@ public class SysPermissionController {
|
||||
return Result.OK("保存成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("授权失败!");
|
||||
return Result.error("授权失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -120,7 +120,7 @@ public class SysRoleController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class SysRoleController {
|
||||
public Result<Object> edit(@RequestBody SysRole role) {
|
||||
SysRole sysrole = sysRoleService.getById(role.getId());
|
||||
if(sysrole==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
role.setUpdateTime(new Date());
|
||||
boolean ok = sysRoleService.updateById(role);
|
||||
@@ -170,7 +170,7 @@ public class SysRoleController {
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
return Result.error500("未选中角色!");
|
||||
return Result.error("未选中角色!");
|
||||
}else {
|
||||
sysRoleService.deleteBatchRole(ids.split(","));
|
||||
return Result.OK("删除角色成功!");
|
||||
@@ -187,7 +187,7 @@ public class SysRoleController {
|
||||
public Result<SysRole> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysRole sysRole = sysRoleService.getById(id);
|
||||
if(sysRole==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysRole);
|
||||
}
|
||||
@@ -197,7 +197,7 @@ public class SysRoleController {
|
||||
public Result<List<SysRole>> queryall() {
|
||||
List<SysRole> list = sysRoleService.list();
|
||||
if(list==null||list.size()<=0) {
|
||||
return Result.error500("未找到角色信息");
|
||||
return Result.error("未找到角色信息");
|
||||
}else {
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
+6
-6
@@ -60,7 +60,7 @@ public class SysTenantController {
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<Object> add(@RequestBody SysTenant sysTenant) {
|
||||
if(sysTenantService.getById(sysTenant.getId())!=null){
|
||||
return Result.error500("该编号已存在!");
|
||||
return Result.error("该编号已存在!");
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -68,7 +68,7 @@ public class SysTenantController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SysTenantController {
|
||||
public Result<Object> edit(@RequestBody SysTenant tenant) {
|
||||
SysTenant sysTenant = sysTenantService.getById(tenant.getId());
|
||||
if(sysTenant==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysTenantService.updateById(tenant);
|
||||
if(ok) {
|
||||
@@ -110,7 +110,7 @@ public class SysTenantController {
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
return Result.error500("未选中租户!");
|
||||
return Result.error("未选中租户!");
|
||||
}else {
|
||||
String[] ls = ids.split(",");
|
||||
// 过滤掉已被引用的租户
|
||||
@@ -130,7 +130,7 @@ public class SysTenantController {
|
||||
return Result.OK("部分删除成功!(被引用的租户无法删除)");
|
||||
}
|
||||
}else {
|
||||
return Result.error500("选择的租户都已被引用,无法删除!");
|
||||
return Result.error("选择的租户都已被引用,无法删除!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class SysTenantController {
|
||||
public Result<SysTenant> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysTenant sysTenant = sysTenantService.getById(id);
|
||||
if(sysTenant==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysTenant);
|
||||
}
|
||||
|
||||
+6
-6
@@ -96,7 +96,7 @@ public class SysUserAgentController {
|
||||
return Result.OK("代理人设置成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class SysUserAgentController {
|
||||
public Result<Object> edit(@RequestBody SysUserAgent sysUserAgent) {
|
||||
SysUserAgent sysUserAgentEntity = sysUserAgentService.getById(sysUserAgent.getId());
|
||||
if(sysUserAgentEntity==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysUserAgentService.updateById(sysUserAgent);
|
||||
if(ok) {
|
||||
@@ -129,7 +129,7 @@ public class SysUserAgentController {
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysUserAgent sysUserAgent = sysUserAgentService.getById(id);
|
||||
if(sysUserAgent==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysUserAgentService.removeById(id);
|
||||
if(ok) {
|
||||
@@ -147,7 +147,7 @@ public class SysUserAgentController {
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error500("参数不识别!");
|
||||
return Result.error("参数不识别!");
|
||||
}else {
|
||||
this.sysUserAgentService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
@@ -163,7 +163,7 @@ public class SysUserAgentController {
|
||||
public Result<SysUserAgent> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysUserAgent sysUserAgent = sysUserAgentService.getById(id);
|
||||
if(sysUserAgent==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysUserAgent);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class SysUserAgentController {
|
||||
queryWrapper.eq(SysUserAgent::getUserName, userName);
|
||||
SysUserAgent sysUserAgent = sysUserAgentService.getOne(queryWrapper);
|
||||
if(sysUserAgent==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysUserAgent);
|
||||
}
|
||||
|
||||
+32
-57
@@ -4,7 +4,6 @@ package com.jero.modules.system.controller;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -31,8 +30,6 @@ import com.jero.modules.system.model.SysUserSysDepartModel;
|
||||
import com.jero.modules.system.service.*;
|
||||
import com.jero.modules.system.vo.SysDepartUsersVO;
|
||||
import com.jero.modules.system.vo.SysUserRoleVO;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.checkerframework.framework.qual.RequiresQualifier;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
@@ -40,6 +37,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
@@ -79,15 +77,6 @@ public class SysUserController {
|
||||
@Autowired
|
||||
private ISysUserDepartService sysUserDepartService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserRoleService userRoleService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartRoleUserService departRoleUserService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartRoleService departRoleService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@@ -112,8 +101,6 @@ public class SysUserController {
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
queryWrapper.ne("username","_reserve_user_external");
|
||||
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
||||
IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
|
||||
|
||||
@@ -146,13 +133,11 @@ public class SysUserController {
|
||||
try {
|
||||
if (StrUtil.isNotEmpty(user.getEmail())){
|
||||
String email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
// email = PasswordUtil.encrypt(email);
|
||||
user.setEmail(email);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(user.getPhone())){
|
||||
String phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
// phone = PasswordUtil.encrypt(phone);
|
||||
user.setPhone(phone);
|
||||
}
|
||||
|
||||
@@ -174,7 +159,7 @@ public class SysUserController {
|
||||
return Result.OK("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +174,7 @@ public class SysUserController {
|
||||
SysUser sysUser = sysUserService.getById(jsonObject.getString("id"));
|
||||
baseCommonService.addLog("编辑用户,id: " +jsonObject.getString("id") ,CommonConstant.LOG_TYPE_2, 2);
|
||||
if(sysUser==null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
String email = null;
|
||||
@@ -207,12 +192,9 @@ public class SysUserController {
|
||||
throw new JeroBootException("解密失败!", e);
|
||||
}
|
||||
// 3:把数据加密在放回来
|
||||
// email = PasswordUtil.encrypt(email);
|
||||
// phone = PasswordUtil.encrypt(phone);
|
||||
user.setEmail(email);
|
||||
user.setPhone(phone);
|
||||
user.setUpdateTime(new Date());
|
||||
//String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
|
||||
user.setPassword(sysUser.getPassword());
|
||||
// 修改用户走一个service 保证事务
|
||||
sysUserService.editUser(user, roles, departs);
|
||||
@@ -220,7 +202,7 @@ public class SysUserController {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +236,7 @@ public class SysUserController {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("操作失败"+e.getMessage());
|
||||
return Result.error("操作失败"+e.getMessage());
|
||||
}
|
||||
return Result.OK("操作成功!");
|
||||
|
||||
@@ -264,7 +246,7 @@ public class SysUserController {
|
||||
public Result<SysUser> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysUser sysUser = sysUserService.getById(id);
|
||||
if (sysUser == null) {
|
||||
return Result.error500("未找到对应实体");
|
||||
return Result.error("未找到对应实体");
|
||||
} else {
|
||||
return Result.OK(sysUser);
|
||||
}
|
||||
@@ -276,7 +258,7 @@ public class SysUserController {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<SysUserRole> userRole = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, userid));
|
||||
if (userRole == null || userRole.size() <= 0) {
|
||||
return Result.error500("未找到用户相关角色信息");
|
||||
return Result.error("未找到用户相关角色信息");
|
||||
} else {
|
||||
for (SysUserRole sysUserRole : userRole) {
|
||||
list.add(sysUserRole.getRoleId());
|
||||
@@ -517,7 +499,7 @@ public class SysUserController {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
// 批量将部门和用户信息建立关联关系
|
||||
// 批量将部门和用户信息建立关联关系 TODO 错误需修改
|
||||
String departIds = sysUserExcel.getDepartIds();
|
||||
if (StringUtils.isNotBlank(departIds)) {
|
||||
String userId = sysUserExcel.getId();
|
||||
@@ -654,7 +636,7 @@ public class SysUserController {
|
||||
return Result.OK("删除成功!");
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("删除失败!");
|
||||
return Result.error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -675,7 +657,7 @@ public class SysUserController {
|
||||
return Result.OK("删除成功!");
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("删除失败!");
|
||||
return Result.error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,22 +761,12 @@ public class SysUserController {
|
||||
try {
|
||||
QueryWrapper<SysUserDepart> queryWrapper = new QueryWrapper<SysUserDepart>();
|
||||
queryWrapper.eq("dep_id", depId).eq("user_id",userId);
|
||||
boolean b = sysUserDepartService.remove(queryWrapper);
|
||||
if(b){
|
||||
List<SysDepartRole> sysDepartRoleList = departRoleService.list(new QueryWrapper<SysDepartRole>().eq("depart_id",depId));
|
||||
List<String> roleIds = sysDepartRoleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
|
||||
if(roleIds != null && roleIds.size()>0){
|
||||
QueryWrapper<SysDepartRoleUser> query = new QueryWrapper<>();
|
||||
query.eq("user_id",userId).in("drole_id",roleIds);
|
||||
departRoleUserService.remove(query);
|
||||
}
|
||||
return Result.OK("删除成功!");
|
||||
}else{
|
||||
return Result.error500("当前选中部门与用户无关联关系!");
|
||||
}
|
||||
sysUserDepartService.remove(queryWrapper);
|
||||
sysDepartService.deleteHeadDeptAndUserRelatedByUser(depId, userId);
|
||||
return Result.OK("删除成功!");
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("删除失败!");
|
||||
return Result.error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -802,20 +774,23 @@ public class SysUserController {
|
||||
* 批量删除指定机构的用户关系
|
||||
*/
|
||||
@RequestMapping(value = "/deleteUserInDepartBatch", method = RequestMethod.DELETE)
|
||||
@Transactional
|
||||
public Result<Object> deleteUserInDepartBatch(
|
||||
@RequestParam(name="depId") String depId,
|
||||
@RequestParam(name="userIds",required=true) String userIds) {
|
||||
try {
|
||||
List<String> userIdList = new ArrayList<>(Arrays.asList(userIds.split(",")));
|
||||
|
||||
QueryWrapper<SysUserDepart> queryWrapper = new QueryWrapper<SysUserDepart>();
|
||||
queryWrapper.eq("dep_id", depId).in("user_id",Arrays.asList(userIds.split(",")));
|
||||
boolean b = sysUserDepartService.remove(queryWrapper);
|
||||
if(b){
|
||||
departRoleUserService.removeDeptRoleUser(Arrays.asList(userIds.split(",")),depId);
|
||||
queryWrapper.eq("dep_id", depId).in("user_id", userIdList);
|
||||
sysUserDepartService.remove(queryWrapper);
|
||||
for (String userId : userIdList){
|
||||
sysDepartService.deleteHeadDeptAndUserRelatedByUser(depId, userId);
|
||||
}
|
||||
return Result.OK("删除成功!");
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("删除失败!");
|
||||
return Result.error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -835,7 +810,7 @@ public class SysUserController {
|
||||
return Result.OK(map);
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error500("查询失败!");
|
||||
return Result.error("查询失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -914,7 +889,7 @@ public class SysUserController {
|
||||
sysUserService.addUserWithRole(user,"ee8626f80f7c2619917b6236f3a7f02b");//默认临时角色 test
|
||||
result.setMessage("注册成功");
|
||||
} catch (Exception e) {
|
||||
result.error500("注册失败");
|
||||
return Result.error("注册失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1043,7 +1018,6 @@ public class SysUserController {
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "syncFlow", required = false) String syncFlow) {
|
||||
try {
|
||||
//TODO 从查询效率上将不要用mp的封装的page分页查询 建议自己写分页语句
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<SysUser>();
|
||||
if(oConvertUtils.isNotEmpty(syncFlow)){
|
||||
query.eq(SysUser::getActivitiSync, CommonConstant.ACT_SYNC_1);
|
||||
@@ -1143,13 +1117,12 @@ public class SysUserController {
|
||||
Date birthday=jsonObject.getDate("birthday");
|
||||
SysUser userPhone = sysUserService.getUserByPhone(phone);
|
||||
if(sysUser==null) {
|
||||
result.error500("未找到对应用户!");
|
||||
return Result.error("未找到对应用户!");
|
||||
}else {
|
||||
if(userPhone!=null){
|
||||
String userPhonename = userPhone.getUsername();
|
||||
if(!userPhonename.equals(username)){
|
||||
result.error500("手机号已存在!");
|
||||
return result;
|
||||
return Result.error("手机号已存在!");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(realname)){
|
||||
@@ -1175,7 +1148,7 @@ public class SysUserController {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败!");
|
||||
return Result.error("操作失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1191,17 +1164,18 @@ public class SysUserController {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
if(sysUser==null) {
|
||||
result.error500("未找到对应用户!");
|
||||
return Result.error("未找到对应用户!");
|
||||
}else {
|
||||
sysUser.setClientId(clientId);
|
||||
sysUserService.updateById(sysUser);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败!");
|
||||
return Result.error("操作失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userid获取用户信息和部门员工信息
|
||||
*
|
||||
@@ -1217,7 +1191,7 @@ public class SysUserController {
|
||||
Integer identity = sysUser.getUserIdentity();
|
||||
map.put("sysUser",sysUser);
|
||||
if(identity!=null && identity==2){
|
||||
//获取部门用户信息
|
||||
//获取部门用户信息 TODO错误,需修改
|
||||
String departIds = sysUser.getDepartIds();
|
||||
if(StringUtils.isNotBlank(departIds)){
|
||||
List<String> departIdList = Arrays.asList(departIds.split(","));
|
||||
@@ -1227,6 +1201,7 @@ public class SysUserController {
|
||||
}
|
||||
return Result.OK(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动端查询部门用户信息
|
||||
* @param departId
|
||||
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
package com.jero.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_depart_role")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="sys_depart_role对象", description="部门角色")
|
||||
public class SysDepartRole {
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**部门id*/
|
||||
@Excel(name = "部门id", width = 15)
|
||||
@ApiModelProperty(value = "部门id")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private java.lang.String departId;
|
||||
/**部门角色名称*/
|
||||
@Excel(name = "部门角色名称", width = 15)
|
||||
@ApiModelProperty(value = "部门角色名称")
|
||||
private java.lang.String roleName;
|
||||
/**部门角色编码*/
|
||||
@Excel(name = "部门角色编码", width = 15)
|
||||
@ApiModelProperty(value = "部门角色编码")
|
||||
private java.lang.String roleCode;
|
||||
/**描述*/
|
||||
@Excel(name = "描述", width = 15)
|
||||
@ApiModelProperty(value = "描述")
|
||||
private java.lang.String description;
|
||||
/**创建人*/
|
||||
@Excel(name = "创建人", width = 15)
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Excel(name = "更新人", width = 15)
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新时间*/
|
||||
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
package com.jero.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色权限
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_depart_role_permission")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="sys_depart_role_permission对象", description="部门角色权限")
|
||||
public class SysDepartRolePermission {
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**部门id*/
|
||||
@Excel(name = "部门id", width = 15)
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private java.lang.String departId;
|
||||
/**角色id*/
|
||||
@Excel(name = "角色id", width = 15)
|
||||
@ApiModelProperty(value = "角色id")
|
||||
private java.lang.String roleId;
|
||||
/**权限id*/
|
||||
@Excel(name = "权限id", width = 15)
|
||||
@ApiModelProperty(value = "权限id")
|
||||
private java.lang.String permissionId;
|
||||
/**dataRuleIds*/
|
||||
@Excel(name = "dataRuleIds", width = 15)
|
||||
@ApiModelProperty(value = "dataRuleIds")
|
||||
private java.lang.String dataRuleIds;
|
||||
/** 操作时间 */
|
||||
@Excel(name = "操作时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "操作时间")
|
||||
private java.util.Date operateDate;
|
||||
/** 操作ip */
|
||||
private java.lang.String operateIp;
|
||||
|
||||
public SysDepartRolePermission() {
|
||||
}
|
||||
|
||||
public SysDepartRolePermission(String roleId, String permissionId) {
|
||||
this.roleId = roleId;
|
||||
this.permissionId = permissionId;
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package com.jero.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色人员信息
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_depart_role_user")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="sys_depart_role_user对象", description="部门角色人员信息")
|
||||
public class SysDepartRoleUser {
|
||||
|
||||
/**主键id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private java.lang.String id;
|
||||
/**用户id*/
|
||||
@Excel(name = "用户id", width = 15)
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private java.lang.String userId;
|
||||
/**角色id*/
|
||||
@Excel(name = "角色id", width = 15)
|
||||
@ApiModelProperty(value = "角色id")
|
||||
private java.lang.String droleId;
|
||||
|
||||
public SysDepartRoleUser() {
|
||||
|
||||
}
|
||||
|
||||
public SysDepartRoleUser(String userId, String droleId) {
|
||||
this.userId = userId;
|
||||
this.droleId = droleId;
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
package com.jero.modules.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.system.entity.SysDepartRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysDepartRoleMapper extends BaseMapper<SysDepartRole> {
|
||||
/**
|
||||
* 根据用户id,部门id查询可授权所有部门角色
|
||||
* @param orgCode
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<SysDepartRole> queryDeptRoleByDeptAndUser(@Param("orgCode") String orgCode, @Param("userId") String userId);
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package com.jero.modules.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.system.entity.SysDepartRolePermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色权限
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysDepartRolePermissionMapper extends BaseMapper<SysDepartRolePermission> {
|
||||
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package com.jero.modules.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.system.entity.SysDepartRoleUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色人员信息
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysDepartRoleUserMapper extends BaseMapper<SysDepartRoleUser> {
|
||||
|
||||
}
|
||||
-1
@@ -62,7 +62,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
/**
|
||||
* 根据用户名设置部门ID
|
||||
* @param username
|
||||
* @param departId
|
||||
*/
|
||||
void updateUserDepart(@Param("username") String username,@Param("orgCode") String orgCode);
|
||||
|
||||
|
||||
-12
@@ -1,12 +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="com.jero.modules.system.mapper.SysDepartRoleMapper">
|
||||
|
||||
<!--根据用户id,部门id查询可授权所有部门角色 -->
|
||||
<select id="queryDeptRoleByDeptAndUser" resultType="com.jero.modules.system.entity.SysDepartRole">
|
||||
SELECT * FROM sys_depart_role WHERE depart_id IN (
|
||||
SELECT id FROM sys_depart WHERE id IN (SELECT dep_id FROM sys_user_depart WHERE user_id=#{userId})
|
||||
AND org_code LIKE CONCAT(#{orgCode},'%')
|
||||
)
|
||||
</select>
|
||||
</mapper>
|
||||
-5
@@ -1,5 +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="com.jero.modules.system.mapper.SysDepartRolePermissionMapper">
|
||||
|
||||
</mapper>
|
||||
-5
@@ -1,5 +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="com.jero.modules.system.mapper.SysDepartRoleUserMapper">
|
||||
|
||||
</mapper>
|
||||
-10
@@ -11,16 +11,6 @@
|
||||
join sys_user_role d on d.role_id = c.id
|
||||
join sys_user e on d.user_id = e.id
|
||||
where e.username = #{username} and b.id = #{permissionId}
|
||||
<!--update begin Author:lvdandan Date:20200213 for:加入部门权限 -->
|
||||
union
|
||||
select data_rule_ids
|
||||
from sys_depart_role_permission a
|
||||
join sys_permission b on a.permission_id = b.id
|
||||
join sys_depart_role c on a.role_id = c.id
|
||||
join sys_depart_role_user d on d.drole_id = c.id
|
||||
join sys_user e on d.user_id = e.id
|
||||
where e.username = #{username} and b.id = #{permissionId}
|
||||
<!--update end Author:lvdandan Date:20200213 for:加入部门权限 -->
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
-14
@@ -86,20 +86,6 @@
|
||||
<if test="permission.url !=null and permission.url != ''">
|
||||
and b.url = #{permission.url}
|
||||
</if>
|
||||
union all
|
||||
select count(*) as cnt
|
||||
from sys_permission z
|
||||
join sys_depart_role_permission y on z.id = y.permission_id
|
||||
join sys_depart_role x on y.role_id = x.id
|
||||
join sys_depart_role_user w on w.drole_id = x.id
|
||||
join sys_user v on w.user_id = v.id
|
||||
where v.username = #{username}
|
||||
<if test="permission.id !=null and permission.id != ''">
|
||||
and z.id = #{permission.id}
|
||||
</if>
|
||||
<if test="permission.url !=null and permission.url != ''">
|
||||
and z.url = #{permission.url}
|
||||
</if>
|
||||
) temp
|
||||
</select>
|
||||
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@
|
||||
)
|
||||
</if>
|
||||
<if test="username!=null and username!=''">
|
||||
and username = #{username}
|
||||
and username LIKE concat(concat('%',#{username}),'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<select id="getUserByRoleId" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where del_flag = 0 and id in (select user_id from sys_user_role where role_id=#{roleId})
|
||||
<if test="username!=null and username!=''">
|
||||
and username = #{username}
|
||||
and username LIKE concat(concat('%',#{username}),'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.jero.modules.system.service;
|
||||
|
||||
import com.jero.modules.system.entity.SysDepartRolePermission;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色权限
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysDepartRolePermissionService extends IService<SysDepartRolePermission> {
|
||||
/**
|
||||
* 保存授权 将上次的权限和这次作比较 差异处理提高效率
|
||||
* @param roleId
|
||||
* @param permissionIds
|
||||
* @param lastPermissionIds
|
||||
*/
|
||||
public void saveDeptRolePermission(String roleId,String permissionIds,String lastPermissionIds);
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package com.jero.modules.system.service;
|
||||
|
||||
import com.jero.modules.system.entity.SysDepartRole;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysDepartRoleService extends IService<SysDepartRole> {
|
||||
|
||||
/**
|
||||
* 根据用户id,部门id查询可授权所有部门角色
|
||||
* @param orgCode
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SysDepartRole> queryDeptRoleByDeptAndUser(String orgCode, String userId);
|
||||
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package com.jero.modules.system.service;
|
||||
|
||||
import com.jero.modules.system.entity.SysDepartRoleUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色人员信息
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysDepartRoleUserService extends IService<SysDepartRoleUser> {
|
||||
|
||||
void deptRoleUserAdd(String userId,String newRoleId,String oldRoleId);
|
||||
|
||||
/**
|
||||
* 取消用户与部门关联,删除关联关系
|
||||
* @param userIds
|
||||
* @param depId
|
||||
*/
|
||||
void removeDeptRoleUser(List<String> userIds,String depId);
|
||||
}
|
||||
+14
-2
@@ -1,10 +1,16 @@
|
||||
package com.jero.modules.system.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.system.vo.SysDepartTreeModel;
|
||||
import com.jero.modules.system.entity.SysDepart;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.model.DepartIdModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -69,12 +75,18 @@ public interface ISysDepartService extends IService<SysDepart>{
|
||||
*/
|
||||
boolean delete(String id);
|
||||
|
||||
/**
|
||||
* 删除部门的时候同步删除用户对应的负责部门
|
||||
* @param id
|
||||
*/
|
||||
void deleteHeadDeptAndUserRelatedByUser(String id, String userIds);
|
||||
|
||||
/**
|
||||
* 查询SysDepart集合
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<SysDepart> queryUserDeparts(String userId);
|
||||
List<SysDepart> queryUserDeparts(String userId);
|
||||
|
||||
/**
|
||||
* 根据用户名查询部门
|
||||
@@ -86,7 +98,7 @@ public interface ISysDepartService extends IService<SysDepart>{
|
||||
|
||||
/**
|
||||
* 根据部门id批量删除并删除其可能存在的子级部门
|
||||
* @param id
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteBatchWithChildren(List<String> ids);
|
||||
|
||||
+15
-24
@@ -75,7 +75,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
String rsaPrivateKey = redisUtil.get(rsaPublicKey) != null ? String.valueOf(redisUtil.get(rsaPublicKey)) : null;
|
||||
|
||||
if(StrUtil.isEmpty(rsaPrivateKey)){
|
||||
return result.error500("页面过期,请刷新页面");
|
||||
return Result.error("页面过期,请刷新页面");
|
||||
}
|
||||
|
||||
//update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题
|
||||
@@ -85,16 +85,14 @@ public class LoginServiceImpl implements ILoginService {
|
||||
//update-begin-author:taoyan date:20190828 for:校验验证码
|
||||
String captcha = sysLoginModel.getCaptcha();
|
||||
if(captcha==null){
|
||||
result.error500("验证码无效");
|
||||
return result;
|
||||
return Result.error("验证码无效");
|
||||
}
|
||||
String lowerCaseCaptcha = captcha.toLowerCase();
|
||||
String realKey = MD5Util.MD5Encode(lowerCaseCaptcha+sysLoginModel.getCheckKey(), "utf-8");
|
||||
Object checkCode = redisUtil.get(realKey);
|
||||
//当进入登录页时,有一定几率出现验证码错误 #1714
|
||||
if(checkCode==null || !checkCode.toString().equals(lowerCaseCaptcha)) {
|
||||
result.error500("验证码错误");
|
||||
return result;
|
||||
return Result.error("验证码错误");
|
||||
}
|
||||
try {
|
||||
//解密获取密码和用户名
|
||||
@@ -120,8 +118,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
retryCount = (int) redisUtil.get(RETRY_LOGIN_PREFIX + username);
|
||||
}
|
||||
if (retryCount >= RETRY_LOGIN_MAX_COUNT){
|
||||
result.error500("密码错误次数过多,请稍后重试");
|
||||
return result;
|
||||
return Result.error("密码错误次数过多,请15分钟后重试");
|
||||
}
|
||||
//2. 校验用户名或密码是否正确
|
||||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
@@ -130,13 +127,12 @@ public class LoginServiceImpl implements ILoginService {
|
||||
// 重试登录次数加一
|
||||
retryCount++;
|
||||
if( retryCount == 1){
|
||||
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,60 * 30);
|
||||
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,60 * 15);
|
||||
}else {
|
||||
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,redisUtil.getExpire(RETRY_LOGIN_PREFIX + username));
|
||||
}
|
||||
String msg = retryCount == RETRY_LOGIN_MAX_COUNT ? "密码错误次数过多,请稍后重试":"用户名或密码错误,剩余可登录次数:"+(RETRY_LOGIN_MAX_COUNT - retryCount);
|
||||
result.error500(msg);
|
||||
return result;
|
||||
return Result.error(msg);
|
||||
}
|
||||
//登录成功,清除错误登录次数
|
||||
redisUtil.del(RETRY_LOGIN_PREFIX + username);
|
||||
@@ -273,9 +269,8 @@ public class LoginServiceImpl implements ILoginService {
|
||||
if (CommonConstant.SMS_TPL_TYPE_1.equals(smsmode)) {
|
||||
SysUser sysUser = sysUserService.getUserByPhone(mobile);
|
||||
if(sysUser!=null) {
|
||||
result.error500(" 手机号已经注册,请直接登录!");
|
||||
baseCommonService.addLog("手机号已经注册,请直接登录!", CommonConstant.LOG_TYPE_1, null);
|
||||
return result;
|
||||
return Result.error(" 手机号已经注册,请直接登录!");
|
||||
}
|
||||
b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.REGISTER_TEMPLATE_CODE);
|
||||
}else {
|
||||
@@ -285,7 +280,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
if(!result.isSuccess()) {
|
||||
String message = result.getMessage();
|
||||
if("该用户不存在,请注册".equals(message)){
|
||||
result.error500("该用户不存在或未绑定手机号");
|
||||
return Result.error("该用户不存在或未绑定手机号");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -316,8 +311,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
|
||||
} catch (ClientException e) {
|
||||
e.printStackTrace();
|
||||
result.error500(" 短信接口未配置,请联系管理员!");
|
||||
return result;
|
||||
return Result.error(" 短信接口未配置,请联系管理员!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -370,7 +364,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
res.setSuccess(true);
|
||||
res.setResult(base64);
|
||||
} catch (Exception e) {
|
||||
res.error500("获取验证码出错"+e.getMessage());
|
||||
res.error("获取验证码出错"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
@@ -393,8 +387,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
String syspassword = sysUser.getPassword();
|
||||
if (!syspassword.equals(userpassword)) {
|
||||
result.error500("用户名或密码错误");
|
||||
return result;
|
||||
return Result.error("用户名或密码错误");
|
||||
}
|
||||
|
||||
String orgCode = sysUser.getOrgCode();
|
||||
@@ -402,8 +395,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
//如果当前用户无选择部门 查看部门关联信息
|
||||
List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
|
||||
if (departs == null || departs.size() == 0) {
|
||||
result.error500("用户暂未归属部门,不可登录!");
|
||||
return result;
|
||||
return Result.error("用户暂未归属部门,不可登录!");
|
||||
}
|
||||
orgCode = departs.get(0).getOrgCode();
|
||||
sysUser.setOrgCode(orgCode);
|
||||
@@ -417,7 +409,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
String token = JwtUtil.sign(username, syspassword);
|
||||
// 设置超时时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
|
||||
//token 信息
|
||||
obj.put("token", token);
|
||||
@@ -494,8 +486,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
// 该方法仅查询有效的租户,如果返回0个就说明所有的租户均无效。
|
||||
List<SysTenant> tenantList = sysTenantService.queryEffectiveTenant(tenantIdList);
|
||||
if (tenantList.size() == 0) {
|
||||
result.error500("与该用户关联的租户均已被冻结,无法登录!");
|
||||
return result;
|
||||
return Result.error("与该用户关联的租户均已被冻结,无法登录!");
|
||||
} else {
|
||||
obj.put("tenantList", tenantList);
|
||||
}
|
||||
@@ -505,7 +496,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
String token = JwtUtil.sign(username, syspassword);
|
||||
// 设置token缓存有效时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
|
||||
obj.put("token", token);
|
||||
obj.put("userInfo", sysUser);
|
||||
|
||||
+1
-16
@@ -4,12 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysDepartPermission;
|
||||
import com.jero.modules.system.entity.SysDepartRole;
|
||||
import com.jero.modules.system.entity.SysDepartRolePermission;
|
||||
import com.jero.modules.system.entity.SysPermissionDataRule;
|
||||
import com.jero.modules.system.mapper.SysDepartPermissionMapper;
|
||||
import com.jero.modules.system.mapper.SysDepartRoleMapper;
|
||||
import com.jero.modules.system.mapper.SysDepartRolePermissionMapper;
|
||||
import com.jero.modules.system.mapper.SysPermissionDataRuleMapper;
|
||||
import com.jero.modules.system.service.ISysDepartPermissionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -29,15 +25,10 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
public class SysDepartPermissionServiceImpl extends ServiceImpl<SysDepartPermissionMapper, SysDepartPermission> implements ISysDepartPermissionService {
|
||||
|
||||
@Resource
|
||||
private SysPermissionDataRuleMapper ruleMapper;
|
||||
|
||||
@Resource
|
||||
private SysDepartRoleMapper sysDepartRoleMapper;
|
||||
|
||||
@Resource
|
||||
private SysDepartRolePermissionMapper departRolePermissionMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveDepartPermission(String departId, String permissionIds, String lastPermissionIds) {
|
||||
@@ -56,12 +47,6 @@ public class SysDepartPermissionServiceImpl extends ServiceImpl<SysDepartPermiss
|
||||
if(delete!=null && delete.size()>0) {
|
||||
for (String permissionId : delete) {
|
||||
this.remove(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
|
||||
//删除部门权限时,删除部门角色中已授权的权限
|
||||
List<SysDepartRole> sysDepartRoleList = sysDepartRoleMapper.selectList(new LambdaQueryWrapper<SysDepartRole>().eq(SysDepartRole::getDepartId,departId));
|
||||
List<String> roleIds = sysDepartRoleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
|
||||
if(roleIds != null && roleIds.size()>0){
|
||||
departRolePermissionMapper.delete(new LambdaQueryWrapper<SysDepartRolePermission>().eq(SysDepartRolePermission::getPermissionId,permissionId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.util.IPUtils;
|
||||
import com.jero.common.util.SpringContextUtils;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysDepartRolePermission;
|
||||
import com.jero.modules.system.mapper.SysDepartRolePermissionMapper;
|
||||
import com.jero.modules.system.service.ISysDepartRolePermissionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色权限
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysDepartRolePermissionServiceImpl extends ServiceImpl<SysDepartRolePermissionMapper, SysDepartRolePermission> implements ISysDepartRolePermissionService {
|
||||
|
||||
@Override
|
||||
public void saveDeptRolePermission(String roleId, String permissionIds, String lastPermissionIds) {
|
||||
String ip = "";
|
||||
try {
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
//获取IP地址
|
||||
ip = IPUtils.getIpAddr(request);
|
||||
} catch (Exception e) {
|
||||
ip = "127.0.0.1";
|
||||
}
|
||||
List<String> add = getDiff(lastPermissionIds,permissionIds);
|
||||
if(add!=null && add.size()>0) {
|
||||
List<SysDepartRolePermission> list = new ArrayList<SysDepartRolePermission>();
|
||||
for (String p : add) {
|
||||
if(oConvertUtils.isNotEmpty(p)) {
|
||||
SysDepartRolePermission rolepms = new SysDepartRolePermission(roleId, p);
|
||||
rolepms.setOperateDate(new Date());
|
||||
rolepms.setOperateIp(ip);
|
||||
list.add(rolepms);
|
||||
}
|
||||
}
|
||||
this.saveBatch(list);
|
||||
}
|
||||
|
||||
List<String> delete = getDiff(permissionIds,lastPermissionIds);
|
||||
if(delete!=null && delete.size()>0) {
|
||||
for (String permissionId : delete) {
|
||||
this.remove(new QueryWrapper<SysDepartRolePermission>().lambda().eq(SysDepartRolePermission::getRoleId, roleId).eq(SysDepartRolePermission::getPermissionId, permissionId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从diff中找出main中没有的元素
|
||||
* @param main
|
||||
* @param diff
|
||||
* @return
|
||||
*/
|
||||
private List<String> getDiff(String main, String diff){
|
||||
if(oConvertUtils.isEmpty(diff)) {
|
||||
return null;
|
||||
}
|
||||
if(oConvertUtils.isEmpty(main)) {
|
||||
return Arrays.asList(diff.split(","));
|
||||
}
|
||||
|
||||
String[] mainArr = main.split(",");
|
||||
String[] diffArr = diff.split(",");
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
for (String string : mainArr) {
|
||||
map.put(string, 1);
|
||||
}
|
||||
List<String> res = new ArrayList<String>();
|
||||
for (String key : diffArr) {
|
||||
if(oConvertUtils.isNotEmpty(key) && !map.containsKey(key)) {
|
||||
res.add(key);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import com.jero.modules.system.entity.SysDepartRole;
|
||||
import com.jero.modules.system.mapper.SysDepartRoleMapper;
|
||||
import com.jero.modules.system.service.ISysDepartRoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysDepartRoleServiceImpl extends ServiceImpl<SysDepartRoleMapper, SysDepartRole> implements ISysDepartRoleService {
|
||||
|
||||
@Override
|
||||
public List<SysDepartRole> queryDeptRoleByDeptAndUser(String orgCode, String userId) {
|
||||
return this.baseMapper.queryDeptRoleByDeptAndUser(orgCode,userId);
|
||||
}
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysDepartRole;
|
||||
import com.jero.modules.system.entity.SysDepartRoleUser;
|
||||
import com.jero.modules.system.mapper.SysDepartRoleMapper;
|
||||
import com.jero.modules.system.mapper.SysDepartRoleUserMapper;
|
||||
import com.jero.modules.system.service.ISysDepartRoleUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 部门角色人员信息
|
||||
* @Author: jero-boot
|
||||
* @Date: 2020-02-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysDepartRoleUserServiceImpl extends ServiceImpl<SysDepartRoleUserMapper, SysDepartRoleUser> implements ISysDepartRoleUserService {
|
||||
@Autowired
|
||||
private SysDepartRoleMapper sysDepartRoleMapper;
|
||||
|
||||
@Override
|
||||
public void deptRoleUserAdd(String userId, String newRoleId, String oldRoleId) {
|
||||
List<String> add = getDiff(oldRoleId,newRoleId);
|
||||
if(add!=null && add.size()>0) {
|
||||
List<SysDepartRoleUser> list = new ArrayList<>();
|
||||
for (String roleId : add) {
|
||||
if(oConvertUtils.isNotEmpty(roleId)) {
|
||||
SysDepartRoleUser rolepms = new SysDepartRoleUser(userId, roleId);
|
||||
list.add(rolepms);
|
||||
}
|
||||
}
|
||||
this.saveBatch(list);
|
||||
}
|
||||
List<String> remove = getDiff(newRoleId,oldRoleId);
|
||||
if(remove!=null && remove.size()>0) {
|
||||
for (String roleId : remove) {
|
||||
this.remove(new QueryWrapper<SysDepartRoleUser>().lambda().eq(SysDepartRoleUser::getUserId, userId).eq(SysDepartRoleUser::getDroleId, roleId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeDeptRoleUser(List<String> userIds, String depId) {
|
||||
for(String userId : userIds){
|
||||
List<SysDepartRole> sysDepartRoleList = sysDepartRoleMapper.selectList(new QueryWrapper<SysDepartRole>().eq("depart_id",depId));
|
||||
List<String> roleIds = sysDepartRoleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
|
||||
if(roleIds != null && roleIds.size()>0){
|
||||
QueryWrapper<SysDepartRoleUser> query = new QueryWrapper<>();
|
||||
query.eq("user_id",userId).in("drole_id",roleIds);
|
||||
this.remove(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从diff中找出main中没有的元素
|
||||
* @param main
|
||||
* @param diff
|
||||
* @return
|
||||
*/
|
||||
private List<String> getDiff(String main, String diff){
|
||||
if(oConvertUtils.isEmpty(diff)) {
|
||||
return null;
|
||||
}
|
||||
if(oConvertUtils.isEmpty(main)) {
|
||||
return Arrays.asList(diff.split(","));
|
||||
}
|
||||
|
||||
String[] mainArr = main.split(",");
|
||||
String[] diffArr = diff.split(",");
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
for (String string : mainArr) {
|
||||
map.put(string, 1);
|
||||
}
|
||||
List<String> res = new ArrayList<String>();
|
||||
for (String key : diffArr) {
|
||||
if(oConvertUtils.isNotEmpty(key) && !map.containsKey(key)) {
|
||||
res.add(key);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
+51
-53
@@ -2,6 +2,7 @@ package com.jero.modules.system.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -41,16 +42,12 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
|
||||
@Autowired
|
||||
private SysUserDepartMapper userDepartMapper;
|
||||
@Autowired
|
||||
private SysDepartRoleMapper sysDepartRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private SysDepartPermissionMapper departPermissionMapper;
|
||||
|
||||
@Autowired
|
||||
private SysDepartRolePermissionMapper departRolePermissionMapper;
|
||||
@Autowired
|
||||
private SysDepartRoleUserMapper departRoleUserMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public List<SysDepartTreeModel> queryMyDeptTreeList(String departIds) {
|
||||
@@ -199,19 +196,6 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
//update-end--Author:Steve Date:20190201 for:组织机构添加数据代码调整
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* removeDepartDataById 对应 delete方法 根据ID删除相关部门数据
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* @Override
|
||||
*
|
||||
* @Transactional public boolean removeDepartDataById(String id) {
|
||||
* System.out.println("要删除的ID 为=============================>>>>>"+id); boolean
|
||||
* flag = this.removeById(id); return flag; }
|
||||
*/
|
||||
|
||||
/**
|
||||
* updateDepartDataById 对应 edit 根据部门主键来更新对应的部门数据
|
||||
*/
|
||||
@@ -238,25 +222,13 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
this.checkChildrenExists(id, idList);
|
||||
}
|
||||
this.removeByIds(idList);
|
||||
//根据部门id获取部门角色id
|
||||
List<String> roleIdList = new ArrayList<>();
|
||||
LambdaQueryWrapper<SysDepartRole> query = new LambdaQueryWrapper<>();
|
||||
query.select(SysDepartRole::getId).in(SysDepartRole::getDepartId, idList);
|
||||
List<SysDepartRole> depRoleList = sysDepartRoleMapper.selectList(query);
|
||||
for(SysDepartRole deptRole : depRoleList){
|
||||
roleIdList.add(deptRole.getId());
|
||||
}
|
||||
//根据部门id删除用户与部门关系
|
||||
userDepartMapper.delete(new LambdaQueryWrapper<SysUserDepart>().in(SysUserDepart::getDepId,idList));
|
||||
//根据部门id删除部门授权
|
||||
departPermissionMapper.delete(new LambdaQueryWrapper<SysDepartPermission>().in(SysDepartPermission::getDepartId,idList));
|
||||
//根据部门id删除部门角色
|
||||
sysDepartRoleMapper.delete(new LambdaQueryWrapper<SysDepartRole>().in(SysDepartRole::getDepartId,idList));
|
||||
if(roleIdList != null && roleIdList.size()>0){
|
||||
//根据角色id删除部门角色授权
|
||||
departRolePermissionMapper.delete(new LambdaQueryWrapper<SysDepartRolePermission>().in(SysDepartRolePermission::getRoleId,roleIdList));
|
||||
//根据角色id删除部门角色用户信息
|
||||
departRoleUserMapper.delete(new LambdaQueryWrapper<SysDepartRoleUser>().in(SysDepartRoleUser::getDroleId,roleIdList));
|
||||
//删除人员负责部门
|
||||
for (String id : ids){
|
||||
deleteHeadDeptAndUserRelated(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,32 +297,58 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
List<String> idList = new ArrayList<>();
|
||||
idList.add(id);
|
||||
this.checkChildrenExists(id, idList);
|
||||
//清空部门树内存
|
||||
//FindsDepartsChildrenUtil.clearDepartIdModel();
|
||||
boolean ok = this.removeByIds(idList);
|
||||
//根据部门id获取部门角色id
|
||||
List<String> roleIdList = new ArrayList<>();
|
||||
LambdaQueryWrapper<SysDepartRole> query = new LambdaQueryWrapper<>();
|
||||
query.select(SysDepartRole::getId).in(SysDepartRole::getDepartId, idList);
|
||||
List<SysDepartRole> depRoleList = sysDepartRoleMapper.selectList(query);
|
||||
for(SysDepartRole deptRole : depRoleList){
|
||||
roleIdList.add(deptRole.getId());
|
||||
}
|
||||
//根据部门id删除用户与部门关系
|
||||
userDepartMapper.delete(new LambdaQueryWrapper<SysUserDepart>().in(SysUserDepart::getDepId,idList));
|
||||
//根据部门id删除部门授权
|
||||
departPermissionMapper.delete(new LambdaQueryWrapper<SysDepartPermission>().in(SysDepartPermission::getDepartId,idList));
|
||||
//根据部门id删除部门角色
|
||||
sysDepartRoleMapper.delete(new LambdaQueryWrapper<SysDepartRole>().in(SysDepartRole::getDepartId,idList));
|
||||
if(roleIdList != null && roleIdList.size()>0){
|
||||
//根据角色id删除部门角色授权
|
||||
departRolePermissionMapper.delete(new LambdaQueryWrapper<SysDepartRolePermission>().in(SysDepartRolePermission::getRoleId,roleIdList));
|
||||
//根据角色id删除部门角色用户信息
|
||||
departRoleUserMapper.delete(new LambdaQueryWrapper<SysDepartRoleUser>().in(SysDepartRoleUser::getDroleId,roleIdList));
|
||||
}
|
||||
//查找用户中的上级部门关联的数据并删除
|
||||
deleteHeadDeptAndUserRelated(id);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门的时候同步删除用户对应的负责部门
|
||||
* @param id
|
||||
*/
|
||||
private void deleteHeadDeptAndUserRelated(String id) {
|
||||
List<SysUser> containParentDeptUser = userMapper.selectList(new LambdaQueryWrapper<SysUser>().like(SysUser::getDepartIds, id));
|
||||
this.deleteHeadDpetFromUserInfo(id, containParentDeptUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门的时候同步删除用户对应的负责部门
|
||||
* @param id
|
||||
*/
|
||||
public void deleteHeadDeptAndUserRelatedByUser(String id, String userIds) {
|
||||
List<SysUser> containParentDeptUser = userMapper.selectList(new LambdaQueryWrapper<SysUser>().like(SysUser::getDepartIds, id).in(SysUser::getId, userIds));
|
||||
this.deleteHeadDpetFromUserInfo(id, containParentDeptUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id和用户信息进行数据的删除处理
|
||||
* @param id
|
||||
* @param containParentDeptUser
|
||||
*/
|
||||
private void deleteHeadDpetFromUserInfo(String id, List<SysUser> containParentDeptUser) {
|
||||
for (SysUser sysUser : containParentDeptUser) {
|
||||
List<String> headDepartList = new ArrayList<String>(Arrays.asList(sysUser.getDepartIds().split(",")));
|
||||
// 遍历负责部门的list,如果存在本次删除id,则从list中移除
|
||||
int headDepartNum = headDepartList.size();
|
||||
for (int i = 0; i < headDepartNum; i++) {
|
||||
String next = headDepartList.get(i);
|
||||
if (next.equals(id)) {
|
||||
headDepartList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sysUser.setDepartIds(StrUtil.join(",", headDepartList));
|
||||
userMapper.updateById(sysUser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete 方法调用
|
||||
* @param id
|
||||
|
||||
+1
-9
@@ -14,7 +14,6 @@ import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysPermission;
|
||||
import com.jero.modules.system.entity.SysPermissionDataRule;
|
||||
import com.jero.modules.system.mapper.SysDepartPermissionMapper;
|
||||
import com.jero.modules.system.mapper.SysDepartRolePermissionMapper;
|
||||
import com.jero.modules.system.mapper.SysPermissionMapper;
|
||||
import com.jero.modules.system.mapper.SysRolePermissionMapper;
|
||||
import com.jero.modules.system.model.TreeModel;
|
||||
@@ -52,9 +51,6 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
@Resource
|
||||
private SysDepartPermissionMapper sysDepartPermissionMapper;
|
||||
|
||||
@Resource
|
||||
private SysDepartRolePermissionMapper sysDepartRolePermissionMapper;
|
||||
|
||||
@Override
|
||||
public List<TreeModel> queryListByParentId(String parentId) {
|
||||
return sysPermissionMapper.queryListByParentId(parentId);
|
||||
@@ -91,8 +87,6 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
sysRolePermissionMapper.deleteByMap(map);
|
||||
//删除部门权限表
|
||||
sysDepartPermissionMapper.deleteByMap(map);
|
||||
//删除部门角色授权
|
||||
sysDepartRolePermissionMapper.deleteByMap(map);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,8 +116,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
sysRolePermissionMapper.deleteByMap(map);
|
||||
//删除部门权限表
|
||||
sysDepartPermissionMapper.deleteByMap(map);
|
||||
//删除部门角色授权
|
||||
sysDepartRolePermissionMapper.deleteByMap(map);
|
||||
|
||||
num = this.count(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getParentId, id));
|
||||
// 如果有, 则递归
|
||||
if (num > 0) {
|
||||
@@ -138,7 +131,6 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
|
||||
//@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true,condition="#sysPermission.menuType==2")
|
||||
public void deletePermissionLogical(String id) throws JeroBootException {
|
||||
SysPermission sysPermission = this.getById(id);
|
||||
if(sysPermission==null) {
|
||||
|
||||
+4
-50
@@ -56,10 +56,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
private SysDepartMapper sysDepartMapper;
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
@Autowired
|
||||
private SysDepartRoleUserMapper departRoleUserMapper;
|
||||
@Autowired
|
||||
private SysDepartRoleMapper sysDepartRoleMapper;
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@@ -177,10 +173,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
Set<String> permissionSet = new HashSet<>();
|
||||
List<SysPermission> permissionList = sysPermissionMapper.queryByUser(username);
|
||||
for (SysPermission po : permissionList) {
|
||||
// // TODO URL规则有问题?
|
||||
// if (oConvertUtils.isNotEmpty(po.getUrl())) {
|
||||
// permissionSet.add(po.getUrl());
|
||||
// }
|
||||
if (oConvertUtils.isNotEmpty(po.getPerms())) {
|
||||
permissionSet.add(po.getPerms());
|
||||
}
|
||||
@@ -193,10 +185,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
public SysUserCacheInfo getCacheUser(String username) {
|
||||
SysUserCacheInfo info = new SysUserCacheInfo();
|
||||
info.setOneDepart(true);
|
||||
// SysUser user = userMapper.getUserByName(username);
|
||||
// info.setSysUserCode(user.getUsername());
|
||||
// info.setSysUserName(user.getRealname());
|
||||
|
||||
|
||||
LoginUser user = sysBaseAPI.getUserByName(username);
|
||||
if(user!=null) {
|
||||
@@ -320,22 +308,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
if(oConvertUtils.isNotEmpty(departs)){
|
||||
arr = departs.split(",");
|
||||
}
|
||||
//查询已关联部门
|
||||
List<SysUserDepart> userDepartList = sysUserDepartMapper.selectList(new QueryWrapper<SysUserDepart>().lambda().eq(SysUserDepart::getUserId, user.getId()));
|
||||
if(userDepartList != null && userDepartList.size()>0){
|
||||
for(SysUserDepart depart : userDepartList ){
|
||||
//修改已关联部门删除部门用户角色关系
|
||||
if(!Arrays.asList(arr).contains(depart.getDepId())){
|
||||
List<SysDepartRole> sysDepartRoleList = sysDepartRoleMapper.selectList(
|
||||
new QueryWrapper<SysDepartRole>().lambda().eq(SysDepartRole::getDepartId,depart.getDepId()));
|
||||
List<String> roleIds = sysDepartRoleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
|
||||
if(roleIds != null && roleIds.size()>0){
|
||||
departRoleUserMapper.delete(new QueryWrapper<SysDepartRoleUser>().lambda().eq(SysDepartRoleUser::getUserId, user.getId())
|
||||
.in(SysDepartRoleUser::getDroleId,roleIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//先删后加
|
||||
sysUserDepartMapper.delete(new QueryWrapper<SysUserDepart>().lambda().eq(SysUserDepart::getUserId, user.getId()));
|
||||
if(oConvertUtils.isNotEmpty(departs)) {
|
||||
@@ -357,23 +329,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
Result<?> result = new Result<Object>();
|
||||
//情况1:根据用户信息查询,该用户不存在
|
||||
if (sysUser == null) {
|
||||
result.error500("该用户不存在,请注册");
|
||||
baseCommonService.addLog("用户登录失败,用户不存在!", CommonConstant.LOG_TYPE_1, null);
|
||||
return result;
|
||||
return Result.error("该用户不存在,请注册");
|
||||
}
|
||||
//情况2:根据用户信息查询,该用户已注销
|
||||
//update-begin---author:王帅 Date:20200601 for:if条件永远为falsebug------------
|
||||
if (CommonConstant.DEL_FLAG_1.equals(sysUser.getDelFlag())) {
|
||||
//update-end---author:王帅 Date:20200601 for:if条件永远为falsebug------------
|
||||
baseCommonService.addLog("用户登录失败,用户名:" + sysUser.getUsername() + "已注销!", CommonConstant.LOG_TYPE_1, null);
|
||||
result.error500("该用户已注销");
|
||||
return result;
|
||||
return Result.error("该用户已注销");
|
||||
}
|
||||
//情况3:根据用户信息查询,该用户已冻结
|
||||
if (CommonConstant.USER_FREEZE.equals(sysUser.getStatus())) {
|
||||
baseCommonService.addLog("用户登录失败,用户名:" + sysUser.getUsername() + "已冻结!", CommonConstant.LOG_TYPE_1, null);
|
||||
result.error500("该用户已冻结");
|
||||
return result;
|
||||
return Result.error("该用户已冻结");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -484,22 +453,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
if(oConvertUtils.isNotEmpty(departs)){
|
||||
arr = departs.split(",");
|
||||
}
|
||||
//查询已关联部门
|
||||
List<SysUserDepart> userDepartList = sysUserDepartMapper.selectList(new QueryWrapper<SysUserDepart>().lambda().eq(SysUserDepart::getUserId, user.getId()));
|
||||
if(userDepartList != null && userDepartList.size()>0){
|
||||
for(SysUserDepart depart : userDepartList ){
|
||||
//修改已关联部门删除部门用户角色关系
|
||||
if(!Arrays.asList(arr).contains(depart.getDepId())){
|
||||
List<SysDepartRole> sysDepartRoleList = sysDepartRoleMapper.selectList(
|
||||
new QueryWrapper<SysDepartRole>().lambda().eq(SysDepartRole::getDepartId,depart.getDepId()));
|
||||
List<String> roleIds = sysDepartRoleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
|
||||
if(roleIds != null && roleIds.size()>0){
|
||||
departRoleUserMapper.delete(new QueryWrapper<SysDepartRoleUser>().lambda().eq(SysDepartRoleUser::getUserId, user.getId())
|
||||
.in(SysDepartRoleUser::getDroleId,roleIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//先删后加
|
||||
sysUserDepartMapper.delete(new QueryWrapper<SysUserDepart>().lambda().eq(SysUserDepart::getUserId, user.getId()));
|
||||
if(oConvertUtils.isNotEmpty(departs)) {
|
||||
|
||||
+31
-31
@@ -1,32 +1,32 @@
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private transient java.lang.String ${po.fieldName}String;
|
||||
|
||||
private byte[] ${po.fieldName};
|
||||
|
||||
public byte[] get${po.fieldName?cap_first}(){
|
||||
if(${po.fieldName}String==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ${po.fieldName}String.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String get${po.fieldName?cap_first}String(){
|
||||
if(${po.fieldName}==null || ${po.fieldName}.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(${po.fieldName},"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
<#else>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private transient java.lang.String ${po.fieldName}String;
|
||||
|
||||
private byte[] ${po.fieldName};
|
||||
|
||||
public byte[] get${po.fieldName?cap_first}(){
|
||||
if(${po.fieldName}String==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ${po.fieldName}String.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String get${po.fieldName?cap_first}String(){
|
||||
if(${po.fieldName}==null || ${po.fieldName}.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(${po.fieldName},"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
<#else>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
</#if>
|
||||
+179
-179
@@ -1,179 +1,179 @@
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller extends JeroController<${entityName}, I${entityName}Service> {
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-列表查询", notes="${tableVo.ftlDescription}-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<${entityName}>> queryList() {
|
||||
List<${entityName}> list = ${entityName?uncap_first}Service.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.add(${entityName?uncap_first});
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
${entityName?uncap_first}Service.editById(${entityName?uncap_first});
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.queryById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ${entityName}.class);
|
||||
}
|
||||
|
||||
}
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller extends JeroController<${entityName}, I${entityName}Service> {
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-列表查询", notes="${tableVo.ftlDescription}-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<${entityName}>> queryList() {
|
||||
List<${entityName}> list = ${entityName?uncap_first}Service.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.add(${entityName?uncap_first});
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
${entityName?uncap_first}Service.editById(${entityName?uncap_first});
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.queryById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ${entityName}.class);
|
||||
}
|
||||
|
||||
}
|
||||
+89
-89
@@ -1,89 +1,89 @@
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
<#-- <#if po.classType!='popup'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}",dicText="${po.dictText}",dictTable="${po.dictTable}")
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}")
|
||||
</#if>
|
||||
</#if>-->
|
||||
</#if>
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
<#-- <#if po.classType!='popup'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}",dicText="${po.dictText}",dictTable="${po.dictTable}")
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}")
|
||||
</#if>
|
||||
</#if>-->
|
||||
</#if>
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
+12
-12
@@ -1,13 +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="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
<resultMap id="${entityName}ResultMap" type="${bussiPackage}.${entityPackage}.entity.${entityName}">
|
||||
<#list originalColumns as field>
|
||||
<#if field.fieldDbName=="id">
|
||||
<id column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
<#else>
|
||||
<result column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
<?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="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
<resultMap id="${entityName}ResultMap" type="${bussiPackage}.${entityPackage}.entity.${entityName}">
|
||||
<#list originalColumns as field>
|
||||
<#if field.fieldDbName=="id">
|
||||
<id column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
<#else>
|
||||
<result column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+61
-60
@@ -1,60 +1,61 @@
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${entityName}Service extends IService<${entityName}> {
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
void add(${entityName} ${entityName?uncap_first});
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
void editById(${entityName} ${entityName?uncap_first});
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
${entityName} queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<${entityName}> queryList();
|
||||
}
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${entityName}Service extends IService<${entityName}> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
void add(${entityName} ${entityName?uncap_first});
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
void editById(${entityName} ${entityName?uncap_first});
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
${entityName} queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<${entityName}> queryList();
|
||||
}
|
||||
+89
-89
@@ -1,89 +1,89 @@
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(${entityName} ${entityName?uncap_first}) {
|
||||
Date now = new Date();
|
||||
${entityName?uncap_first}.setCreateTime(now);
|
||||
${entityName?uncap_first}.setUpdateTime(now);
|
||||
save(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(${entityName} ${entityName?uncap_first}) {
|
||||
Date now = new Date();
|
||||
${entityName?uncap_first}.setUpdateTime(now);
|
||||
saveOrUpdate(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ${entityName} queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<${entityName}> queryList() {
|
||||
return list();
|
||||
}
|
||||
}
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(${entityName} ${entityName?uncap_first}) {
|
||||
Date now = new Date();
|
||||
${entityName?uncap_first}.setCreateTime(now);
|
||||
${entityName?uncap_first}.setUpdateTime(now);
|
||||
save(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(${entityName} ${entityName?uncap_first}) {
|
||||
Date now = new Date();
|
||||
${entityName?uncap_first}.setUpdateTime(now);
|
||||
saveOrUpdate(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ${entityName} queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<${entityName}> queryList() {
|
||||
return list();
|
||||
}
|
||||
}
|
||||
+425
-425
@@ -1,426 +1,426 @@
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign list_need_switch=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='switch'>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> query></j-switch>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=true>
|
||||
</#if>
|
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
|
||||
<#assign list_need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign list_need_switch=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
:scroll="{x:true}"
|
||||
</#if>
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
class="j-table-force-nowrap"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"></${Format.humpToShortbar(entityName)}-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import '@/assets/less/TableExpand.less'
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: '${entityName}List',
|
||||
mixins:[JeroListMixin, mixinDevice],
|
||||
components: {
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
<#assign showColNum=0>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y' && po.fieldName !='id'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : ''),
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
fixed:"right",
|
||||
width:147,
|
||||
</#if>
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/page",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
//代码生成后需手动设置流程编码
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
<#if list_need_pca>
|
||||
pcaData:'',
|
||||
</#if>
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
<#if list_need_switch>
|
||||
<#list columns as po>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
<#if po.dictField?default("")?contains("[")>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
this.$set(this.dictOptions, '${po.fieldName}', [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && list_need_category==true>
|
||||
loadCategoryData({code:'${po.dictField?default("")}'}).then((res) => {
|
||||
if (res.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
getSuperFieldList(){
|
||||
<#include "/common/utils.ftl">
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign list_need_switch=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='switch'>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> query></j-switch>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=true>
|
||||
</#if>
|
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
|
||||
<#assign list_need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign list_need_switch=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
:scroll="{x:true}"
|
||||
</#if>
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
class="j-table-force-nowrap"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"></${Format.humpToShortbar(entityName)}-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import '@/assets/less/TableExpand.less'
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: '${entityName}List',
|
||||
mixins:[JeroListMixin, mixinDevice],
|
||||
components: {
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
<#assign showColNum=0>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y' && po.fieldName !='id'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : ''),
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
fixed:"right",
|
||||
width:147,
|
||||
</#if>
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/page",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
//代码生成后需手动设置流程编码
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
<#if list_need_pca>
|
||||
pcaData:'',
|
||||
</#if>
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
<#if list_need_switch>
|
||||
<#list columns as po>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
<#if po.dictField?default("")?contains("[")>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
this.$set(this.dictOptions, '${po.fieldName}', [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && list_need_category==true>
|
||||
loadCategoryData({code:'${po.dictField?default("")}'}).then((res) => {
|
||||
if (res.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
getSuperFieldList(){
|
||||
<#include "/common/utils.ftl">
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
||||
+280
-280
@@ -1,280 +1,280 @@
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.vo.${entityName}Page;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service;
|
||||
</#list>
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
<#list subTables as sub>
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ${entityName?uncap_first}Page
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
|
||||
${entityName} ${entityName?uncap_first} = new ${entityName}();
|
||||
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ${entityName?uncap_first}Page
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
|
||||
${entityName} ${entityName?uncap_first} = new ${entityName}();
|
||||
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
|
||||
${entityName} ${entityName?uncap_first}Entity = ${entityName?uncap_first}Service.getById(${entityName?uncap_first}.getId());
|
||||
if(${entityName?uncap_first}Entity==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
|
||||
}
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${sub.ftlDescription}通过主表ID查询")
|
||||
@ApiOperation(value="${sub.ftlDescription}主表ID查询", notes="${sub.ftlDescription}-通主表ID查询")
|
||||
@GetMapping(value = "/query${sub.entityName}ByMainId")
|
||||
public Result<?> query${sub.entityName}ListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(id);
|
||||
return Result.OK(${sub.entityName?uncap_first}List);
|
||||
}
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
// Step.1 组装查询条件查询数据
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//Step.2 获取导出数据
|
||||
List<${entityName}> queryList = ${entityName?uncap_first}Service.list(queryWrapper);
|
||||
// 过滤选中数据
|
||||
String selections = request.getParameter("selections");
|
||||
List<${entityName}> ${entityName?uncap_first}List = new ArrayList<${entityName}>();
|
||||
if(oConvertUtils.isEmpty(selections)) {
|
||||
${entityName?uncap_first}List = queryList;
|
||||
}else {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
${entityName?uncap_first}List = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// Step.3 组装pageList
|
||||
List<${entityName}Page> pageList = new ArrayList<${entityName}Page>();
|
||||
for (${entityName} main : ${entityName?uncap_first}List) {
|
||||
${entityName}Page vo = new ${entityName}Page();
|
||||
BeanUtils.copyProperties(main, vo);
|
||||
<#list subTables as sub>
|
||||
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(main.getId());
|
||||
vo.set${sub.entityName}List(${sub.entityName?uncap_first}List);
|
||||
</#list>
|
||||
pageList.add(vo);
|
||||
}
|
||||
|
||||
// Step.4 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<${entityName}Page> list = ExcelImportUtil.importExcel(file.getInputStream(), ${entityName}Page.class, params);
|
||||
for (${entityName}Page page : list) {
|
||||
${entityName} po = new ${entityName}();
|
||||
BeanUtils.copyProperties(page, po);
|
||||
${entityName?uncap_first}Service.saveMain(po, <#list subTables as sub>page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.vo.${entityName}Page;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service;
|
||||
</#list>
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
<#list subTables as sub>
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ${entityName?uncap_first}Page
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
|
||||
${entityName} ${entityName?uncap_first} = new ${entityName}();
|
||||
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ${entityName?uncap_first}Page
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
|
||||
${entityName} ${entityName?uncap_first} = new ${entityName}();
|
||||
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
|
||||
${entityName} ${entityName?uncap_first}Entity = ${entityName?uncap_first}Service.getById(${entityName?uncap_first}.getId());
|
||||
if(${entityName?uncap_first}Entity==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
|
||||
}
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${sub.ftlDescription}通过主表ID查询")
|
||||
@ApiOperation(value="${sub.ftlDescription}主表ID查询", notes="${sub.ftlDescription}-通主表ID查询")
|
||||
@GetMapping(value = "/query${sub.entityName}ByMainId")
|
||||
public Result<?> query${sub.entityName}ListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(id);
|
||||
return Result.OK(${sub.entityName?uncap_first}List);
|
||||
}
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
// Step.1 组装查询条件查询数据
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//Step.2 获取导出数据
|
||||
List<${entityName}> queryList = ${entityName?uncap_first}Service.list(queryWrapper);
|
||||
// 过滤选中数据
|
||||
String selections = request.getParameter("selections");
|
||||
List<${entityName}> ${entityName?uncap_first}List = new ArrayList<${entityName}>();
|
||||
if(oConvertUtils.isEmpty(selections)) {
|
||||
${entityName?uncap_first}List = queryList;
|
||||
}else {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
${entityName?uncap_first}List = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// Step.3 组装pageList
|
||||
List<${entityName}Page> pageList = new ArrayList<${entityName}Page>();
|
||||
for (${entityName} main : ${entityName?uncap_first}List) {
|
||||
${entityName}Page vo = new ${entityName}Page();
|
||||
BeanUtils.copyProperties(main, vo);
|
||||
<#list subTables as sub>
|
||||
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(main.getId());
|
||||
vo.set${sub.entityName}List(${sub.entityName?uncap_first}List);
|
||||
</#list>
|
||||
pageList.add(vo);
|
||||
}
|
||||
|
||||
// Step.4 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<${entityName}Page> list = ExcelImportUtil.importExcel(file.getInputStream(), ${entityName}Page.class, params);
|
||||
for (${entityName}Page page : list) {
|
||||
${entityName} po = new ${entityName}();
|
||||
BeanUtils.copyProperties(page, po);
|
||||
${entityName?uncap_first}Service.saveMain(po, <#list subTables as sub>page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
+73
-73
@@ -1,73 +1,73 @@
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
+71
-71
@@ -1,72 +1,72 @@
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}.java
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@ApiModel(value="${subTab.tableName}对象", description="${subTab.ftlDescription}")
|
||||
@Data
|
||||
@TableName("${subTab.tableName}")
|
||||
public class ${subTab.entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list subTab.originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}.java
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jero-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@ApiModel(value="${subTab.tableName}对象", description="${subTab.ftlDescription}")
|
||||
@Data
|
||||
@TableName("${subTab.tableName}")
|
||||
public class ${subTab.entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list subTab.originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
</#list>
|
||||
+12
-12
@@ -1,13 +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="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
<resultMap id="${entityName}ResultMap" type="${bussiPackage}.${entityPackage}.entity.${entityName}">
|
||||
<#list originalColumns as field>
|
||||
<#if field.fieldDbName=="id">
|
||||
<id column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
<#else>
|
||||
<result column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
<?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="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
<resultMap id="${entityName}ResultMap" type="${bussiPackage}.${entityPackage}.entity.${entityName}">
|
||||
<#list originalColumns as field>
|
||||
<#if field.fieldDbName=="id">
|
||||
<id column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
<#else>
|
||||
<result column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+33
-33
@@ -1,34 +1,34 @@
|
||||
<#list subTables as subTab>
|
||||
<#assign originalForeignKeys = subTab.originalForeignKeys>
|
||||
#segment#${subTab.entityName}Mapper.xml
|
||||
<?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="${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper">
|
||||
<resultMap id="${subTab.entityName}ResultMap" type="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
|
||||
<#list subTab.originalColumns as field>
|
||||
<#if field.fieldDbName=="id">
|
||||
<id column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
<#else>
|
||||
<result column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String">
|
||||
DELETE
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
</delete>
|
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
|
||||
SELECT *
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
</select>
|
||||
</mapper>
|
||||
<#list subTables as subTab>
|
||||
<#assign originalForeignKeys = subTab.originalForeignKeys>
|
||||
#segment#${subTab.entityName}Mapper.xml
|
||||
<?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="${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper">
|
||||
<resultMap id="${subTab.entityName}ResultMap" type="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
|
||||
<#list subTab.originalColumns as field>
|
||||
<#if field.fieldDbName=="id">
|
||||
<id column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
<#else>
|
||||
<result column="${field.fieldDbName}" property="${field.fieldName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String">
|
||||
DELETE
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
</delete>
|
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
|
||||
SELECT *
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
</select>
|
||||
</mapper>
|
||||
</#list>
|
||||
+396
-396
@@ -1,397 +1,397 @@
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=true>
|
||||
</#if>
|
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
|
||||
<#assign list_need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"/>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
import '@/assets/less/TableExpand.less'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
mixins:[JeroListMixin],
|
||||
components: {
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
<#assign showColNum=0>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictField?default("")?trim?length gt 1>
|
||||
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
|
||||
<#else>
|
||||
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/page",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && list_need_category==true>
|
||||
loadCategoryData({code:"${po.dictField?default('')}"}).then((res) => {
|
||||
if (res.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
getSuperFieldList(){
|
||||
<#include "/common/utils.ftl">
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=true>
|
||||
</#if>
|
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
|
||||
<#assign list_need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"/>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
import '@/assets/less/TableExpand.less'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
mixins:[JeroListMixin],
|
||||
components: {
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
<#assign showColNum=0>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictField?default("")?trim?length gt 1>
|
||||
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
|
||||
<#else>
|
||||
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/page",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && list_need_category==true>
|
||||
loadCategoryData({code:"${po.dictField?default('')}"}).then((res) => {
|
||||
if (res.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
getSuperFieldList(){
|
||||
<#include "/common/utils.ftl">
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user