Commit 47c7fba0 by tangyi

修复bug,增加租户查询条件

parent 5d59e233
...@@ -122,13 +122,15 @@ ...@@ -122,13 +122,15 @@
## 后续 ## 后续
- swagger修复 - [ ] 多租户
- jwt只存userId这些关键信息,各服务鉴权需要重新换取token - [ ] 作业、考试、知识点管理、考试成绩排名、图表展示
- 重构部门角色,用户直接绑定角色,部门不关联角色 - [ ] 学生签到、请假
- 简答题,题库完善,智能组卷,在线学习,成绩排名 - [ ] 短信验证码,第三方登录
- 站内信 - [ ] swagger修复
- 多租户 - [ ] 站内信
- 短信验证码,第三方登录 - [x] jwt只存userId这些关键信息,各服务鉴权需要重新换取token
- [x] 重构部门角色,用户直接绑定角色,部门不关联角色
- [x] 简答题,题库完善,智能组卷,在线学习,成绩排名
## 问题反馈 ## 问题反馈
......
...@@ -4,7 +4,7 @@ package com.github.tangyi.common.core.constant; ...@@ -4,7 +4,7 @@ package com.github.tangyi.common.core.constant;
* 公用常量 * 公用常量
* *
* @author tangyi * @author tangyi
* @date 2018-08-23-12:00 * @date 2018-08-23 12:00
*/ */
public class CommonConstant { public class CommonConstant {
...@@ -14,6 +14,11 @@ public class CommonConstant { ...@@ -14,6 +14,11 @@ public class CommonConstant {
public static final String SYS_CODE = "EXAM"; public static final String SYS_CODE = "EXAM";
/** /**
* 默认租户编号
*/
public static final String TENANT_CODE = "GITHUB";
/**
* JSON 资源 * JSON 资源
*/ */
public static final String CONTENT_TYPE = "application/json; charset=utf-8"; public static final String CONTENT_TYPE = "application/json; charset=utf-8";
......
...@@ -32,4 +32,13 @@ public class SysUtil { ...@@ -32,4 +32,13 @@ public class SysUtil {
public static String getSysCode() { public static String getSysCode() {
return CommonConstant.SYS_CODE; return CommonConstant.SYS_CODE;
} }
/**
* 获取租户编号
*
* @return String
*/
public static String getTenantCode() {
return CommonConstant.TENANT_CODE;
}
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50617 Target Server Version : 50617
File Encoding : 65001 File Encoding : 65001
Date: 19/05/2019 21:43:23 Date: 22/05/2019 22:21:34
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
...@@ -48,6 +48,6 @@ CREATE TABLE `oauth_client_details` ( ...@@ -48,6 +48,6 @@ CREATE TABLE `oauth_client_details` (
-- ---------------------------- -- ----------------------------
-- Records of oauth_client_details -- Records of oauth_client_details
-- ---------------------------- -- ----------------------------
INSERT INTO `oauth_client_details` VALUES ('471037a0c1be4df99b40e3f84141cc56', 'web_app', NULL, 'spring-microservice-exam-secret', '$2a$10$IWLD8r7e0rKMW.ZhGsGCUO./MZUNDKudIswSToa9puXJwty.h59.u', 'read,write', 'password,authorization_code,refresh_token,implicit', NULL, NULL, '30', '3600', NULL, NULL, 'admin', '2019-03-30 23:43:07', 'admin', '2019-05-19 20:28:58', '0', 'EXAM', NULL); INSERT INTO `oauth_client_details` VALUES ('471037a0c1be4df99b40e3f84141cc56', 'web_app', NULL, 'spring-microservice-exam-secret', '$2a$10$IWLD8r7e0rKMW.ZhGsGCUO./MZUNDKudIswSToa9puXJwty.h59.u', 'read,write', 'password,authorization_code,refresh_token,implicit', NULL, NULL, '3600', '21600', NULL, NULL, 'admin', '2019-03-30 23:43:07', 'admin', '2019-05-22 22:16:18', '0', 'EXAM', NULL);
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50617 Target Server Version : 50617
File Encoding : 65001 File Encoding : 65001
Date: 19/05/2019 21:43:15 Date: 22/05/2019 22:21:26
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
...@@ -66,7 +66,7 @@ CREATE TABLE `course` ( ...@@ -66,7 +66,7 @@ CREATE TABLE `course` (
-- Records of course -- Records of course
-- ---------------------------- -- ----------------------------
INSERT INTO `course` VALUES ('571449673634680832', '大学语文', '信息学院', '软件工程', '陈老师', '大学语文', 'admin', '2019-04-26 21:36:59', 'admin', '2019-04-26 21:36:59', '0', 'EXAM', NULL); INSERT INTO `course` VALUES ('571449673634680832', '大学语文', '信息学院', '软件工程', '陈老师', '大学语文', 'admin', '2019-04-26 21:36:59', 'admin', '2019-04-26 21:36:59', '0', 'EXAM', NULL);
INSERT INTO `course` VALUES ('573843243792470016', '计算机基础', '信息学院', '软件工程', '', '', 'admin', '2019-05-03 12:08:10', 'admin', '2019-05-03 12:08:10', '0', 'EXAM', NULL); INSERT INTO `course` VALUES ('573843243792470016', '计算机基础', '信息学院', '软件工程', '', '', 'admin', '2019-05-03 12:08:10', 'admin', '2019-05-22 22:17:41', '0', 'EXAM', NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for exam_record -- Table structure for exam_record
...@@ -134,7 +134,7 @@ INSERT INTO `examination` VALUES ('573841891515305984', '全国计算机统考 ...@@ -134,7 +134,7 @@ INSERT INTO `examination` VALUES ('573841891515305984', '全国计算机统考
INSERT INTO `examination` VALUES ('576869700143812608', '测试1', '0', '323', '2019-05-16 20:37', '2019-05-16 23:34', '', '20', '3', '0', 'group1/M00/00/00/rBAAClzXxROAC5s0AADGqyYhFOI619.jpg', '577147187818008576', '32323', '23232', '571449673634680832', '323', 'admin', '2019-05-11 20:34:14', 'admin', '2019-05-16 22:19:45', '0', 'EXAM', NULL); INSERT INTO `examination` VALUES ('576869700143812608', '测试1', '0', '323', '2019-05-16 20:37', '2019-05-16 23:34', '', '20', '3', '0', 'group1/M00/00/00/rBAAClzXxROAC5s0AADGqyYhFOI619.jpg', '577147187818008576', '32323', '23232', '571449673634680832', '323', 'admin', '2019-05-11 20:34:14', 'admin', '2019-05-16 22:19:45', '0', 'EXAM', NULL);
INSERT INTO `examination` VALUES ('577225388753817600', '测试2', '0', '22', '2019-05-14 20:07', '2019-05-14 23:00', '', '2', '0', '0', '', NULL, '22', '2', '571449673634680832', '2222', 'admin', '2019-05-12 20:07:37', 'admin', '2019-05-14 21:02:19', '0', 'EXAM', NULL); INSERT INTO `examination` VALUES ('577225388753817600', '测试2', '0', '22', '2019-05-14 20:07', '2019-05-14 23:00', '', '2', '0', '0', '', NULL, '22', '2', '571449673634680832', '2222', 'admin', '2019-05-12 20:07:37', 'admin', '2019-05-14 21:02:19', '0', 'EXAM', NULL);
INSERT INTO `examination` VALUES ('577225454889603072', '测试3', '0', '33', '2019-05-12 20:07', '2019-05-13 00:00', '', '3', '0', '0', 'group1/M00/00/00/rBAAClzYEqeAQRfVAAB2nqimI80762.jpg', '577230488272506880', '3', '3', '573843243792470016', '', 'admin', '2019-05-12 20:07:52', 'admin', '2019-05-12 20:27:53', '0', 'EXAM', NULL); INSERT INTO `examination` VALUES ('577225454889603072', '测试3', '0', '33', '2019-05-12 20:07', '2019-05-13 00:00', '', '3', '0', '0', 'group1/M00/00/00/rBAAClzYEqeAQRfVAAB2nqimI80762.jpg', '577230488272506880', '3', '3', '573843243792470016', '', 'admin', '2019-05-12 20:07:52', 'admin', '2019-05-12 20:27:53', '0', 'EXAM', NULL);
INSERT INTO `examination` VALUES ('577235497684963328', '测试4', '0', '33', '2019-05-12 20:47', '2019-05-13 20:47', '', '3', NULL, '0', '', NULL, '3333', '3', '', '333', 'admin', '2019-05-12 20:47:47', 'admin', '2019-05-12 20:47:47', '0', 'EXAM', NULL); INSERT INTO `examination` VALUES ('577235497684963328', '测试4', '0', '33', '2019-05-12 20:47', '2019-05-13 20:47', '', '3', '0', '0', '', NULL, '3333', '3', '', '333', 'admin', '2019-05-12 20:47:47', 'admin', '2019-05-22 22:17:49', '0', 'EXAM', NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for incorrect_answer -- Table structure for incorrect_answer
...@@ -273,7 +273,7 @@ CREATE TABLE `subject_bank` ( ...@@ -273,7 +273,7 @@ CREATE TABLE `subject_bank` (
-- ---------------------------- -- ----------------------------
-- Records of subject_bank -- Records of subject_bank
-- ---------------------------- -- ----------------------------
INSERT INTO `subject_bank` VALUES ('571463421858549760', '571450070935932928', 1, '若下列城市都安装了“风光互补路灯”,北半球夏至日这一天太阳能板左右摆动幅度最大的地点是', '0', '', '哈尔滨', '北京', '广州', '广州', '', '', 'A', 4, '', '2', 'admin', '2019-04-26 22:31:37', 'admin', '2019-04-26 22:33:35', '0', 'EXAM', NULL); INSERT INTO `subject_bank` VALUES ('571463421858549760', '571450070935932928', 1, '若下列城市都安装了“风光互补路灯”,北半球夏至日这一天太阳能板左右摆动幅度最大的地点是', '0', '', '哈尔滨', '北京', '广州', '广州', '', '', 'A', 4, '', '2', 'admin', '2019-04-26 22:31:37', 'admin', '2019-05-22 22:17:59', '0', 'EXAM', NULL);
INSERT INTO `subject_bank` VALUES ('571467576304078848', '571450070935932928', 2, '干热岩主要属于', '0', '', '岩浆', '喷出岩', '沉积岩', '侵入岩', '', '', 'B', 4, '', '2', 'admin', '2019-04-26 22:48:07', 'admin', '2019-04-26 22:48:07', '0', 'EXAM', NULL); INSERT INTO `subject_bank` VALUES ('571467576304078848', '571450070935932928', 2, '干热岩主要属于', '0', '', '岩浆', '喷出岩', '沉积岩', '侵入岩', '', '', 'B', 4, '', '2', 'admin', '2019-04-26 22:48:07', 'admin', '2019-04-26 22:48:07', '0', 'EXAM', NULL);
INSERT INTO `subject_bank` VALUES ('571467771968360448', '571450070935932928', 3, '我国干热岩最主要分布在', '0', '', '东南沿海', '华北地区', '西北内陆', '青藏高原', '', '', 'D', 4, '', '2', 'admin', '2019-04-26 22:48:54', 'admin', '2019-04-26 22:52:01', '0', 'EXAM', NULL); INSERT INTO `subject_bank` VALUES ('571467771968360448', '571450070935932928', 3, '我国干热岩最主要分布在', '0', '', '东南沿海', '华北地区', '西北内陆', '青藏高原', '', '', 'D', 4, '', '2', 'admin', '2019-04-26 22:48:54', 'admin', '2019-04-26 22:52:01', '0', 'EXAM', NULL);
INSERT INTO `subject_bank` VALUES ('571467945222475776', '571450070935932928', 4, '与传统地热资源相比,干热岩', '0', '', '开发难度小、成本低', '埋藏较浅、分布广', '无季节变化、污染少', '产业链短、效率低', '', '', 'C', 4, '', '2', 'admin', '2019-04-26 22:49:35', 'admin', '2019-04-26 22:52:15', '0', 'EXAM', NULL); INSERT INTO `subject_bank` VALUES ('571467945222475776', '571450070935932928', 4, '与传统地热资源相比,干热岩', '0', '', '开发难度小、成本低', '埋藏较浅、分布广', '无季节变化、污染少', '产业链短、效率低', '', '', 'C', 4, '', '2', 'admin', '2019-04-26 22:49:35', 'admin', '2019-04-26 22:52:15', '0', 'EXAM', NULL);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50617 Target Server Version : 50617
File Encoding : 65001 File Encoding : 65001
Date: 19/05/2019 21:43:07 Date: 22/05/2019 22:21:43
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
...@@ -65,7 +65,7 @@ CREATE TABLE `sys_dept` ( ...@@ -65,7 +65,7 @@ CREATE TABLE `sys_dept` (
-- ---------------------------- -- ----------------------------
-- Records of sys_dept -- Records of sys_dept
-- ---------------------------- -- ----------------------------
INSERT INTO `sys_dept` VALUES ('571347099191480320', '测试部门', '-1', '30', 'admin', '2019-04-26 14:49:23', 'admin', '2019-05-19 11:54:19', '0', 'EXAM', '0', '测试部门', '管理员', NULL); INSERT INTO `sys_dept` VALUES ('571347099191480320', '测试部门', '-1', '30', 'admin', '2019-04-26 14:49:23', 'admin', '2019-05-22 22:15:31', '0', 'EXAM', '0', '测试部门', '管理员', NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for sys_log -- Table structure for sys_log
...@@ -161,7 +161,7 @@ INSERT INTO `sys_menu` VALUES ('571362994005610496', 'zipkin监控', 'monitor:li ...@@ -161,7 +161,7 @@ INSERT INTO `sys_menu` VALUES ('571362994005610496', 'zipkin监控', 'monitor:li
INSERT INTO `sys_menu` VALUES ('571363268497641472', '服务监控', 'monitor:admin', '/api/monitor/**', '571361163502292992', '', '33', '0', 'admin', '2019-04-26 15:53:38', 'admin', '2019-04-26 15:53:38', '0', 'EXAM', NULL, 'http://localhost:8085/admin', NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES ('571363268497641472', '服务监控', 'monitor:admin', '/api/monitor/**', '571361163502292992', '', '33', '0', 'admin', '2019-04-26 15:53:38', 'admin', '2019-04-26 15:53:38', '0', 'EXAM', NULL, 'http://localhost:8085/admin', NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES ('571363537549660160', '接口文档', 'monitor:document', '/api/monitor/**', '571361163502292992', '', '34', '0', 'admin', '2019-04-26 15:54:42', 'admin', '2019-04-26 15:54:42', '0', 'EXAM', NULL, 'http://localhost:8000/swagger-ui.html', NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES ('571363537549660160', '接口文档', 'monitor:document', '/api/monitor/**', '571361163502292992', '', '34', '0', 'admin', '2019-04-26 15:54:42', 'admin', '2019-04-26 15:54:42', '0', 'EXAM', NULL, 'http://localhost:8000/swagger-ui.html', NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES ('571364115214372864', '删除日志', 'monitor:log:del', NULL, '571361526066319360', '', '30', '1', 'admin', '2019-04-26 15:57:00', 'admin', '2019-04-26 15:57:00', '0', 'EXAM', NULL, NULL, NULL, '删除日志', NULL); INSERT INTO `sys_menu` VALUES ('571364115214372864', '删除日志', 'monitor:log:del', NULL, '571361526066319360', '', '30', '1', 'admin', '2019-04-26 15:57:00', 'admin', '2019-04-26 15:57:00', '0', 'EXAM', NULL, NULL, NULL, '删除日志', NULL);
INSERT INTO `sys_menu` VALUES ('571365178965364736', '首页', 'dashboard', '/', '-1', 'dashboard', '0', '0', 'admin', '2019-04-26 16:01:14', 'admin', '2019-05-19 12:25:51', '0', 'EXAM', 'Layout', '/dashboard', NULL, '首页', NULL); INSERT INTO `sys_menu` VALUES ('571365178965364736', '首页', 'dashboard', '/', '-1', 'dashboard', '0', '0', 'admin', '2019-04-26 16:01:14', 'admin', '2019-05-22 22:15:49', '0', 'EXAM', 'Layout', '/dashboard', NULL, '首页', NULL);
INSERT INTO `sys_menu` VALUES ('571367565360762880', '系统管理', 'sys', '/api/user/v1/**', '-1', 'component', '1', '0', 'admin', '2019-04-26 16:10:43', 'admin', '2019-05-15 23:51:07', '0', 'EXAM', 'Layout', '/sys', NULL, '系统管理', NULL); INSERT INTO `sys_menu` VALUES ('571367565360762880', '系统管理', 'sys', '/api/user/v1/**', '-1', 'component', '1', '0', 'admin', '2019-04-26 16:10:43', 'admin', '2019-05-15 23:51:07', '0', 'EXAM', 'Layout', '/sys', NULL, '系统管理', NULL);
INSERT INTO `sys_menu` VALUES ('571367969767165952', '用户管理', 'sys:user', '/api/user/v1/user/**', '571367565360762880', '', '2', '0', 'admin', '2019-04-26 16:12:19', 'admin', '2019-04-26 16:12:19', '0', 'EXAM', 'views/sys/user', 'user', NULL, '用户管理', NULL); INSERT INTO `sys_menu` VALUES ('571367969767165952', '用户管理', 'sys:user', '/api/user/v1/user/**', '571367565360762880', '', '2', '0', 'admin', '2019-04-26 16:12:19', 'admin', '2019-04-26 16:12:19', '0', 'EXAM', 'views/sys/user', 'user', NULL, '用户管理', NULL);
INSERT INTO `sys_menu` VALUES ('571368181252362240', '部门管理', 'sys:dept', '/api/user/v1/dept/**', '571367565360762880', '', '8', '0', 'admin', '2019-04-26 16:13:09', 'admin', '2019-04-26 16:13:09', '0', 'EXAM', 'views/sys/dept', 'dept', NULL, '部门管理', NULL); INSERT INTO `sys_menu` VALUES ('571368181252362240', '部门管理', 'sys:dept', '/api/user/v1/dept/**', '571367565360762880', '', '8', '0', 'admin', '2019-04-26 16:13:09', 'admin', '2019-04-26 16:13:09', '0', 'EXAM', 'views/sys/dept', 'dept', NULL, '部门管理', NULL);
...@@ -221,7 +221,7 @@ CREATE TABLE `sys_role` ( ...@@ -221,7 +221,7 @@ CREATE TABLE `sys_role` (
-- ---------------------------- -- ----------------------------
INSERT INTO `sys_role` VALUES ('571347202849509376', '管理员', 'role_admin', '管理员', '0', 'admin', '2019-04-26 14:49:48', 'admin', '2019-04-26 14:49:48', '0', 'EXAM', '0', NULL); INSERT INTO `sys_role` VALUES ('571347202849509376', '管理员', 'role_admin', '管理员', '0', 'admin', '2019-04-26 14:49:48', 'admin', '2019-04-26 14:49:48', '0', 'EXAM', '0', NULL);
INSERT INTO `sys_role` VALUES ('571347272906969088', '教师', 'role_teacher', '教师', '0', 'admin', '2019-04-26 14:50:04', 'admin', '2019-05-19 17:40:08', '0', 'EXAM', '0', NULL); INSERT INTO `sys_role` VALUES ('571347272906969088', '教师', 'role_teacher', '教师', '0', 'admin', '2019-04-26 14:50:04', 'admin', '2019-05-19 17:40:08', '0', 'EXAM', '0', NULL);
INSERT INTO `sys_role` VALUES ('571347357346697216', '普通用户', 'role_user', '普通用户', '1', 'admin', '2019-04-26 14:50:25', 'admin', '2019-05-19 17:38:15', '0', 'EXAM', '0', NULL); INSERT INTO `sys_role` VALUES ('571347357346697216', '普通用户', 'role_user', '普通用户', '1', 'admin', '2019-04-26 14:50:25', 'admin', '2019-05-22 22:15:42', '0', 'EXAM', '0', NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for sys_role_menu -- Table structure for sys_role_menu
...@@ -369,10 +369,10 @@ INSERT INTO `sys_role_menu` VALUES ('577962109418213434', '571347272906969088', ...@@ -369,10 +369,10 @@ INSERT INTO `sys_role_menu` VALUES ('577962109418213434', '571347272906969088',
INSERT INTO `sys_role_menu` VALUES ('577962109418213435', '571347272906969088', '571348650370928640'); INSERT INTO `sys_role_menu` VALUES ('577962109418213435', '571347272906969088', '571348650370928640');
INSERT INTO `sys_role_menu` VALUES ('577962109418213436', '571347272906969088', '571349816924311552'); INSERT INTO `sys_role_menu` VALUES ('577962109418213436', '571347272906969088', '571349816924311552');
INSERT INTO `sys_role_menu` VALUES ('577962109418213437', '571347272906969088', '571350099653955584'); INSERT INTO `sys_role_menu` VALUES ('577962109418213437', '571347272906969088', '571350099653955584');
INSERT INTO `sys_role_menu` VALUES ('578366680363831296', '571347357346697216', '571365178965364736'); INSERT INTO `sys_role_menu` VALUES ('580882321092251648', '571347357346697216', '571365178965364736');
INSERT INTO `sys_role_menu` VALUES ('578366680363831297', '571347357346697216', '571348650370928640'); INSERT INTO `sys_role_menu` VALUES ('580882321092251649', '571347357346697216', '571348650370928640');
INSERT INTO `sys_role_menu` VALUES ('578366680363831298', '571347357346697216', '571349816924311552'); INSERT INTO `sys_role_menu` VALUES ('580882321092251650', '571347357346697216', '571349816924311552');
INSERT INTO `sys_role_menu` VALUES ('578366680363831299', '571347357346697216', '571350099653955584'); INSERT INTO `sys_role_menu` VALUES ('580882321092251651', '571347357346697216', '571350099653955584');
-- ---------------------------- -- ----------------------------
-- Table structure for sys_route -- Table structure for sys_route
...@@ -438,7 +438,6 @@ CREATE TABLE `sys_user` ( ...@@ -438,7 +438,6 @@ CREATE TABLE `sys_user` (
INSERT INTO `sys_user` VALUES ('571346919268421632', '管理员', 'admin', '$2a$10$6mW2B1GMnGLQejJ4QXb2ke.Oqu3cAUYWxX7rgsrO/.SP.Na4QFCwq', NULL, '15512345678', '', '', '15512345678@qq.com', '0', '2019-04-26', '0', 'admin', '2019-04-26 14:48:40', 'admin', '2019-04-26 14:51:13', 0, 'EXAM', '管理员', '571347099191480320', NULL); INSERT INTO `sys_user` VALUES ('571346919268421632', '管理员', 'admin', '$2a$10$6mW2B1GMnGLQejJ4QXb2ke.Oqu3cAUYWxX7rgsrO/.SP.Na4QFCwq', NULL, '15512345678', '', '', '15512345678@qq.com', '0', '2019-04-26', '0', 'admin', '2019-04-26 14:48:40', 'admin', '2019-04-26 14:51:13', 0, 'EXAM', '管理员', '571347099191480320', NULL);
INSERT INTO `sys_user` VALUES ('571347698284892160', '林老师', 'teacher', '$2a$10$PvRqajVApOtseEy8jJCzU.AnvrtoE5ecwQHQ9zuf.ezYnlFTF1Vm2', NULL, '155123456789', NULL, NULL, '155123456789@qq.com', '0', '2019-04-26', '0', 'admin', '2019-04-26 14:51:46', 'admin', '2019-05-16 22:07:08', 0, 'EXAM', '林老师', '571347099191480320', NULL); INSERT INTO `sys_user` VALUES ('571347698284892160', '林老师', 'teacher', '$2a$10$PvRqajVApOtseEy8jJCzU.AnvrtoE5ecwQHQ9zuf.ezYnlFTF1Vm2', NULL, '155123456789', NULL, NULL, '155123456789@qq.com', '0', '2019-04-26', '0', 'admin', '2019-04-26 14:51:46', 'admin', '2019-05-16 22:07:08', 0, 'EXAM', '林老师', '571347099191480320', NULL);
INSERT INTO `sys_user` VALUES ('571347817814167552', '梁同学', 'student', '$2a$10$mtmSUZJwfgtqlK5J/wu9CeWAPhfr4j.k/C6njPFUzNht.GEw1H0r.', NULL, '155123456789', NULL, NULL, '155123456789@qq.com', '0', '2019-04-26', '0', 'admin', '2019-04-26 14:52:14', 'admin', '2019-05-16 22:07:04', 0, 'EXAM', '梁同学', '571347099191480320', NULL); INSERT INTO `sys_user` VALUES ('571347817814167552', '梁同学', 'student', '$2a$10$mtmSUZJwfgtqlK5J/wu9CeWAPhfr4j.k/C6njPFUzNht.GEw1H0r.', NULL, '155123456789', NULL, NULL, '155123456789@qq.com', '0', '2019-04-26', '0', 'admin', '2019-04-26 14:52:14', 'admin', '2019-05-16 22:07:04', 0, 'EXAM', '梁同学', '571347099191480320', NULL);
INSERT INTO `sys_user` VALUES ('578707569342812160', '1', '1', '$2a$10$D0ue0eJrn33Bd1Z.6XMKpeixG.F7GKKHHEvQAYw4klJF/vwoCWoHC', NULL, '323', NULL, NULL, NULL, '0', '2019-05-30', '0', 'admin', '2019-05-16 22:17:16', 'admin', '2019-05-16 22:17:16', 0, 'EXAM', '3233', '571347099191480320', NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for sys_user_role -- Table structure for sys_user_role
...@@ -457,6 +456,5 @@ CREATE TABLE `sys_user_role` ( ...@@ -457,6 +456,5 @@ CREATE TABLE `sys_user_role` (
INSERT INTO `sys_user_role` VALUES ('571347558564237312', '571346919268421632', '571347202849509376'); INSERT INTO `sys_user_role` VALUES ('571347558564237312', '571346919268421632', '571347202849509376');
INSERT INTO `sys_user_role` VALUES ('578705002672033792', '571347817814167552', '571347272906969088'); INSERT INTO `sys_user_role` VALUES ('578705002672033792', '571347817814167552', '571347272906969088');
INSERT INTO `sys_user_role` VALUES ('578705020137115648', '571347698284892160', '571347272906969088'); INSERT INTO `sys_user_role` VALUES ('578705020137115648', '571347698284892160', '571347272906969088');
INSERT INTO `sys_user_role` VALUES ('578707569720299520', '578707569342812160', '571347357346697216');
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
...@@ -29,7 +29,7 @@ import java.net.URI; ...@@ -29,7 +29,7 @@ import java.net.URI;
@Component @Component
public class ValidateCodeFilter implements GlobalFilter, Ordered { public class ValidateCodeFilter implements GlobalFilter, Ordered {
private final RedisTemplate<String, String> redisTemplate; private final RedisTemplate redisTemplate;
@Override @Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="oauthClientColumns"> <sql id="oauthClientColumns">
...@@ -41,7 +42,8 @@ ...@@ -41,7 +42,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -49,6 +51,9 @@ ...@@ -49,6 +51,9 @@
<if test="clientId != null and clientId != ''"> <if test="clientId != null and clientId != ''">
and a.client_id like #{clientId} and a.client_id like #{clientId}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="oauthClientResultMap"> <select id="get" resultMap="oauthClientResultMap">
...@@ -97,7 +102,8 @@ ...@@ -97,7 +102,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) VALUES ( ) VALUES (
#{id}, #{id},
#{clientId}, #{clientId},
...@@ -117,7 +123,8 @@ ...@@ -117,7 +123,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
) )
</insert> </insert>
......
...@@ -24,7 +24,7 @@ import java.util.stream.Stream; ...@@ -24,7 +24,7 @@ import java.util.stream.Stream;
@Configuration @Configuration
public class ExaminationInitConfig { public class ExaminationInitConfig {
private final RedisTemplate<String, Examination> redisTemplate; private final RedisTemplate redisTemplate;
private final ExaminationService examinationService; private final ExaminationService examinationService;
......
...@@ -15,6 +15,7 @@ import com.github.tangyi.exam.api.dto.ExamRecordDto; ...@@ -15,6 +15,7 @@ import com.github.tangyi.exam.api.dto.ExamRecordDto;
import com.github.tangyi.exam.api.dto.StartExamDto; import com.github.tangyi.exam.api.dto.StartExamDto;
import com.github.tangyi.exam.api.module.ExamRecord; import com.github.tangyi.exam.api.module.ExamRecord;
import com.github.tangyi.exam.api.module.Examination; import com.github.tangyi.exam.api.module.Examination;
import com.github.tangyi.exam.service.AnswerService;
import com.github.tangyi.exam.service.ExamRecordService; import com.github.tangyi.exam.service.ExamRecordService;
import com.github.tangyi.exam.service.ExaminationService; import com.github.tangyi.exam.service.ExaminationService;
import com.github.tangyi.exam.utils.ExamRecordUtil; import com.github.tangyi.exam.utils.ExamRecordUtil;
...@@ -60,6 +61,8 @@ public class ExamRecordController extends BaseController { ...@@ -60,6 +61,8 @@ public class ExamRecordController extends BaseController {
private final UserServiceClient userServiceClient; private final UserServiceClient userServiceClient;
private final AnswerService answerService;
/** /**
* 根据ID获取 * 根据ID获取
* *
...@@ -356,7 +359,7 @@ public class ExamRecordController extends BaseController { ...@@ -356,7 +359,7 @@ public class ExamRecordController extends BaseController {
@PostMapping("start") @PostMapping("start")
@Log("开始考试") @Log("开始考试")
public ResponseBean<StartExamDto> start(@RequestBody ExamRecord examRecord) { public ResponseBean<StartExamDto> start(@RequestBody ExamRecord examRecord) {
return new ResponseBean<>(examRecordService.start(examRecord)); return new ResponseBean<>(answerService.start(examRecord));
} }
/** /**
......
...@@ -12,7 +12,6 @@ import com.github.tangyi.exam.api.dto.SubjectDto; ...@@ -12,7 +12,6 @@ import com.github.tangyi.exam.api.dto.SubjectDto;
import com.github.tangyi.exam.api.module.Examination; import com.github.tangyi.exam.api.module.Examination;
import com.github.tangyi.exam.api.module.Subject; import com.github.tangyi.exam.api.module.Subject;
import com.github.tangyi.exam.service.AnswerService; import com.github.tangyi.exam.service.AnswerService;
import com.github.tangyi.exam.service.ExamRecordService;
import com.github.tangyi.exam.service.ExaminationService; import com.github.tangyi.exam.service.ExaminationService;
import com.github.tangyi.exam.service.SubjectService; import com.github.tangyi.exam.service.SubjectService;
import com.github.tangyi.exam.utils.SubjectUtil; import com.github.tangyi.exam.utils.SubjectUtil;
...@@ -52,8 +51,6 @@ public class SubjectController extends BaseController { ...@@ -52,8 +51,6 @@ public class SubjectController extends BaseController {
private final AnswerService answerService; private final AnswerService answerService;
private final ExamRecordService examRecordService;
private final ExaminationService examinationService; private final ExaminationService examinationService;
/** /**
...@@ -330,6 +327,6 @@ public class SubjectController extends BaseController { ...@@ -330,6 +327,6 @@ public class SubjectController extends BaseController {
public ResponseBean<SubjectDto> subjectAnswer(@RequestParam("serialNumber") String serialNumber, public ResponseBean<SubjectDto> subjectAnswer(@RequestParam("serialNumber") String serialNumber,
@RequestParam("examRecordId") String examRecordId, @RequestParam("examRecordId") String examRecordId,
@RequestParam(value = "userId", required = false) String userId) { @RequestParam(value = "userId", required = false) String userId) {
return new ResponseBean<>(subjectService.subjectAnswer(serialNumber, examRecordId, userId)); return new ResponseBean<>(answerService.subjectAnswer(serialNumber, examRecordId, userId));
} }
} }
package com.github.tangyi.exam.service; package com.github.tangyi.exam.service;
import com.github.tangyi.common.core.constant.MqConstant; import com.github.tangyi.common.core.constant.MqConstant;
import com.github.tangyi.common.core.exceptions.CommonException;
import com.github.tangyi.common.core.service.CrudService; import com.github.tangyi.common.core.service.CrudService;
import com.github.tangyi.common.core.utils.SysUtil; import com.github.tangyi.common.core.utils.SysUtil;
import com.github.tangyi.common.security.utils.SecurityUtil; import com.github.tangyi.common.security.utils.SecurityUtil;
import com.github.tangyi.exam.api.constants.ExamRecordConstant; import com.github.tangyi.exam.api.constants.ExamRecordConstant;
import com.github.tangyi.exam.api.constants.SubjectConstant; import com.github.tangyi.exam.api.constants.SubjectConstant;
import com.github.tangyi.exam.api.dto.StartExamDto;
import com.github.tangyi.exam.api.dto.SubjectDto; import com.github.tangyi.exam.api.dto.SubjectDto;
import com.github.tangyi.exam.api.module.Answer; import com.github.tangyi.exam.api.module.*;
import com.github.tangyi.exam.api.module.ExamRecord;
import com.github.tangyi.exam.api.module.IncorrectAnswer;
import com.github.tangyi.exam.api.module.Subject;
import com.github.tangyi.exam.mapper.AnswerMapper; import com.github.tangyi.exam.mapper.AnswerMapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.amqp.core.AmqpTemplate; import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -43,6 +44,8 @@ public class AnswerService extends CrudService<AnswerMapper, Answer> { ...@@ -43,6 +44,8 @@ public class AnswerService extends CrudService<AnswerMapper, Answer> {
private final ExamRecordService examRecordService; private final ExamRecordService examRecordService;
private final ExaminationService examinationService;
/** /**
* 查找答题 * 查找答题
* *
...@@ -148,7 +151,7 @@ public class AnswerService extends CrudService<AnswerMapper, Answer> { ...@@ -148,7 +151,7 @@ public class AnswerService extends CrudService<AnswerMapper, Answer> {
answer.setCommonValue(SecurityUtil.getCurrentUsername(), SysUtil.getSysCode()); answer.setCommonValue(SecurityUtil.getCurrentUsername(), SysUtil.getSysCode());
this.insert(answer); this.insert(answer);
} }
return subjectService.subjectAnswer(answer.getSerialNumber(), answer.getExamRecordId(), answer.getUserId()); return this.subjectAnswer(answer.getSerialNumber(), answer.getExamRecordId(), answer.getUserId());
} }
/** /**
...@@ -269,4 +272,109 @@ public class AnswerService extends CrudService<AnswerMapper, Answer> { ...@@ -269,4 +272,109 @@ public class AnswerService extends CrudService<AnswerMapper, Answer> {
log.debug("异步提交答卷成功,提交人:{},考试ID:{},耗时:{}ms", currentUsername, answer.getExaminationId(), System.currentTimeMillis() - start); log.debug("异步提交答卷成功,提交人:{},考试ID:{},耗时:{}ms", currentUsername, answer.getExaminationId(), System.currentTimeMillis() - start);
return success; return success;
} }
/**
* 开始考试
*
* @param examRecord examRecord
* @return StartExamDto
* @author tangyi
* @date 2019/04/30 23:06
*/
@Transactional
public StartExamDto start(ExamRecord examRecord) {
StartExamDto startExamDto = new StartExamDto();
String currentUsername = SecurityUtil.getCurrentUsername(), applicationCode = SysUtil.getSysCode();
// 创建考试记录
if (StringUtils.isEmpty(examRecord.getExaminationId()))
throw new CommonException("参数校验失败,考试id为空!");
if (StringUtils.isEmpty(examRecord.getUserId()))
throw new CommonException("参数校验失败,用户id为空!");
Examination examination = new Examination();
examination.setId(examRecord.getExaminationId());
// 查找考试信息
examination = examinationService.get(examination);
if (examination != null) {
examRecord.setExaminationName(examination.getExaminationName());
examRecord.setCourseId(examination.getCourseId());
}
examRecord.setCommonValue(currentUsername, applicationCode);
examRecord.setStartTime(examRecord.getCreateDate());
// 默认未提交状态
examRecord.setSubmitStatus(ExamRecordConstant.STATUS_NOT_SUBMITTED);
// 保存考试记录
if (examRecordService.insert(examRecord) > 0) {
startExamDto.setExamination(examination);
startExamDto.setExamRecord(examRecord);
// 封装dto
SubjectDto subjectDto = new SubjectDto();
startExamDto.setSubjectDto(subjectDto);
// 查找第一题
Subject subject = new Subject();
subject.setExaminationId(examRecord.getExaminationId());
subject.setSerialNumber(SubjectConstant.DEFAULT_SERIAL_NUMBER);
subject = subjectService.getByExaminationIdAndSerialNumber(subject);
if (subject == null)
throw new CommonException("没有第一题");
// 获取题目信息
BeanUtils.copyProperties(subject, subjectDto);
// 创建第一题的答题
Answer answer = new Answer();
answer.setCommonValue(currentUsername, applicationCode);
answer.setUserId(examRecord.getUserId());
answer.setExaminationId(examRecord.getExaminationId());
answer.setExamRecordId(examRecord.getId());
answer.setSubjectId(subject.getId());
// 默认题号为1
answer.setSerialNumber(subject.getSerialNumber());
// 保存答题
this.save(answer);
subjectDto.setAnswer(answer);
}
return startExamDto;
}
/**
* 查询题目和答题
*
* @param serialNumber serialNumber
* @param examRecordId examRecordId
* @param userId userId
* @return SubjectDto
* @author tangyi
* @date 2019/04/30 17:10
*/
@Transactional
public SubjectDto subjectAnswer(String serialNumber, String examRecordId, String userId) {
SubjectDto subjectDto = null;
ExamRecord examRecord = new ExamRecord();
examRecord.setId(examRecordId);
// 查找考试记录
examRecord = examRecordService.get(examRecord);
if (examRecord != null) {
// 查找题目
Subject subject = new Subject();
subject.setExaminationId(examRecord.getExaminationId());
subject.setSerialNumber(serialNumber);
subject = subjectService.getByExaminationIdAndSerialNumber(subject);
if (subject != null) {
subjectDto = new SubjectDto();
// 查找答题
Answer answer = new Answer();
answer.setSubjectId(subject.getId());
answer.setExaminationId(examRecord.getExaminationId());
answer.setExamRecordId(examRecordId);
answer.setUserId(userId);
Answer userAnswer = this.getAnswer(answer);
// 设置答题
if (userAnswer != null)
subjectDto.setAnswer(userAnswer);
BeanUtils.copyProperties(subject, subjectDto);
subjectDto.setExaminationRecordId(examRecordId);
}
}
return subjectDto;
}
} }
package com.github.tangyi.exam.service; package com.github.tangyi.exam.service;
import com.github.tangyi.common.core.exceptions.CommonException;
import com.github.tangyi.common.core.service.CrudService; import com.github.tangyi.common.core.service.CrudService;
import com.github.tangyi.common.core.utils.SysUtil;
import com.github.tangyi.common.security.utils.SecurityUtil;
import com.github.tangyi.exam.api.constants.ExamRecordConstant;
import com.github.tangyi.exam.api.constants.SubjectConstant;
import com.github.tangyi.exam.api.dto.StartExamDto;
import com.github.tangyi.exam.api.dto.SubjectDto;
import com.github.tangyi.exam.api.module.Answer;
import com.github.tangyi.exam.api.module.ExamRecord; import com.github.tangyi.exam.api.module.ExamRecord;
import com.github.tangyi.exam.api.module.Examination;
import com.github.tangyi.exam.api.module.Subject;
import com.github.tangyi.exam.mapper.ExamRecordMapper; import com.github.tangyi.exam.mapper.ExamRecordMapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -31,14 +19,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -31,14 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class ExamRecordService extends CrudService<ExamRecordMapper, ExamRecord> { public class ExamRecordService extends CrudService<ExamRecordMapper, ExamRecord> {
private final SubjectService subjectService;
private final AnswerService answerService;
private final ExamRecordService examRecordService;
private final ExaminationService examinationService;
/** /**
* 查询考试记录 * 查询考试记录
* *
...@@ -109,67 +89,4 @@ public class ExamRecordService extends CrudService<ExamRecordMapper, ExamRecord> ...@@ -109,67 +89,4 @@ public class ExamRecordService extends CrudService<ExamRecordMapper, ExamRecord>
public int deleteAll(String[] ids) { public int deleteAll(String[] ids) {
return super.deleteAll(ids); return super.deleteAll(ids);
} }
/**
* 开始考试
*
* @param examRecord examRecord
* @return StartExamDto
* @author tangyi
* @date 2019/04/30 23:06
*/
@Transactional
public StartExamDto start(ExamRecord examRecord) {
StartExamDto startExamDto = new StartExamDto();
String currentUsername = SecurityUtil.getCurrentUsername(), applicationCode = SysUtil.getSysCode();
// 创建考试记录
if (StringUtils.isEmpty(examRecord.getExaminationId()))
throw new CommonException("参数校验失败,考试id为空!");
if (StringUtils.isEmpty(examRecord.getUserId()))
throw new CommonException("参数校验失败,用户id为空!");
Examination examination = new Examination();
examination.setId(examRecord.getExaminationId());
// 查找考试信息
examination = examinationService.get(examination);
if (examination != null) {
examRecord.setExaminationName(examination.getExaminationName());
examRecord.setCourseId(examination.getCourseId());
}
examRecord.setCommonValue(currentUsername, applicationCode);
examRecord.setStartTime(examRecord.getCreateDate());
// 默认未提交状态
examRecord.setSubmitStatus(ExamRecordConstant.STATUS_NOT_SUBMITTED);
// 保存考试记录
if (examRecordService.insert(examRecord) > 0) {
startExamDto.setExamination(examination);
startExamDto.setExamRecord(examRecord);
// 封装dto
SubjectDto subjectDto = new SubjectDto();
startExamDto.setSubjectDto(subjectDto);
// 查找第一题
Subject subject = new Subject();
subject.setExaminationId(examRecord.getExaminationId());
subject.setSerialNumber(SubjectConstant.DEFAULT_SERIAL_NUMBER);
subject = subjectService.getByExaminationIdAndSerialNumber(subject);
if (subject == null)
throw new CommonException("没有第一题");
// 获取题目信息
BeanUtils.copyProperties(subject, subjectDto);
// 创建第一题的答题
Answer answer = new Answer();
answer.setCommonValue(currentUsername, applicationCode);
answer.setUserId(examRecord.getUserId());
answer.setExaminationId(examRecord.getExaminationId());
answer.setExamRecordId(examRecord.getId());
answer.setSubjectId(subject.getId());
// 默认题号为1
answer.setSerialNumber(subject.getSerialNumber());
// 保存答题
answerService.save(answer);
subjectDto.setAnswer(answer);
}
return startExamDto;
}
} }
package com.github.tangyi.exam.service; package com.github.tangyi.exam.service;
import com.github.tangyi.common.core.service.CrudService; import com.github.tangyi.common.core.service.CrudService;
import com.github.tangyi.exam.api.dto.SubjectDto;
import com.github.tangyi.exam.api.module.Answer;
import com.github.tangyi.exam.api.module.ExamRecord;
import com.github.tangyi.exam.api.module.Subject; import com.github.tangyi.exam.api.module.Subject;
import com.github.tangyi.exam.mapper.SubjectMapper; import com.github.tangyi.exam.mapper.SubjectMapper;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -19,14 +14,9 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -19,14 +14,9 @@ import org.springframework.transaction.annotation.Transactional;
* @author tangyi * @author tangyi
* @date 2018/11/8 21:23 * @date 2018/11/8 21:23
*/ */
@AllArgsConstructor
@Service @Service
public class SubjectService extends CrudService<SubjectMapper, Subject> { public class SubjectService extends CrudService<SubjectMapper, Subject> {
private final ExamRecordService examRecordService;
private final AnswerService answerService;
/** /**
* 查找题目 * 查找题目
* *
...@@ -123,46 +113,4 @@ public class SubjectService extends CrudService<SubjectMapper, Subject> { ...@@ -123,46 +113,4 @@ public class SubjectService extends CrudService<SubjectMapper, Subject> {
public int deleteAll(String[] ids) { public int deleteAll(String[] ids) {
return super.deleteAll(ids); return super.deleteAll(ids);
} }
/**
* 查询题目和答题
*
* @param serialNumber serialNumber
* @param examRecordId examRecordId
* @param userId userId
* @return SubjectDto
* @author tangyi
* @date 2019/04/30 17:10
*/
@Transactional
public SubjectDto subjectAnswer(String serialNumber, String examRecordId, String userId) {
SubjectDto subjectDto = null;
ExamRecord examRecord = new ExamRecord();
examRecord.setId(examRecordId);
// 查找考试记录
examRecord = examRecordService.get(examRecord);
if (examRecord != null) {
// 查找题目
Subject subject = new Subject();
subject.setExaminationId(examRecord.getExaminationId());
subject.setSerialNumber(serialNumber);
subject = this.getByExaminationIdAndSerialNumber(subject);
if (subject != null) {
subjectDto = new SubjectDto();
// 查找答题
Answer answer = new Answer();
answer.setSubjectId(subject.getId());
answer.setExaminationId(examRecord.getExaminationId());
answer.setExamRecordId(examRecordId);
answer.setUserId(userId);
Answer userAnswer = answerService.getAnswer(answer);
// 设置答题
if (userAnswer != null)
subjectDto.setAnswer(userAnswer);
BeanUtils.copyProperties(subject, subjectDto);
subjectDto.setExaminationRecordId(examRecordId);
}
}
return subjectDto;
}
} }
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="answerColumns"> <sql id="answerColumns">
...@@ -32,7 +33,8 @@ ...@@ -32,7 +33,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -52,6 +54,9 @@ ...@@ -52,6 +54,9 @@
<if test="subjectId != null and subjectId != ''"> <if test="subjectId != null and subjectId != ''">
and a.subject_id = #{subjectId} and a.subject_id = #{subjectId}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="answerResultMap"> <select id="get" resultMap="answerResultMap">
...@@ -94,7 +99,8 @@ ...@@ -94,7 +99,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code,
) values ( ) values (
#{id}, #{id},
#{userId}, #{userId},
...@@ -109,7 +115,8 @@ ...@@ -109,7 +115,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="courseColumns"> <sql id="courseColumns">
...@@ -28,7 +29,8 @@ ...@@ -28,7 +29,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -36,6 +38,9 @@ ...@@ -36,6 +38,9 @@
<if test="courseName != null and courseName != ''"> <if test="courseName != null and courseName != ''">
and a.course_name like CONCAT('%',#{courseName},'%') and a.course_name like CONCAT('%',#{courseName},'%')
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="courseResultMap"> <select id="get" resultMap="courseResultMap">
...@@ -76,7 +81,8 @@ ...@@ -76,7 +81,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{courseName}, #{courseName},
...@@ -89,7 +95,8 @@ ...@@ -89,7 +95,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="examRecordColumns"> <sql id="examRecordColumns">
...@@ -38,7 +39,8 @@ ...@@ -38,7 +39,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -58,6 +60,9 @@ ...@@ -58,6 +60,9 @@
<if test="submitStatus != null and submitStatus != ''"> <if test="submitStatus != null and submitStatus != ''">
and a.submit_status = #{submitStatus} and a.submit_status = #{submitStatus}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="examRecordResultMap"> <select id="get" resultMap="examRecordResultMap">
...@@ -110,7 +115,8 @@ ...@@ -110,7 +115,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{userId}, #{userId},
...@@ -128,7 +134,8 @@ ...@@ -128,7 +134,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="examinationColumns"> <sql id="examinationColumns">
...@@ -48,7 +49,8 @@ ...@@ -48,7 +49,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -65,6 +67,9 @@ ...@@ -65,6 +67,9 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and a.type = #{type} and a.type = #{type}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="examinationResultMap"> <select id="get" resultMap="examinationResultMap">
...@@ -121,7 +126,8 @@ ...@@ -121,7 +126,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{examinationName}, #{examinationName},
...@@ -144,7 +150,8 @@ ...@@ -144,7 +150,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="incorrectAnswerColumns"> <sql id="incorrectAnswerColumns">
...@@ -30,7 +31,8 @@ ...@@ -30,7 +31,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -47,6 +49,9 @@ ...@@ -47,6 +49,9 @@
<if test="serialNumber != null and serialNumber != ''"> <if test="serialNumber != null and serialNumber != ''">
and a.serial_number = #{serialNumber} and a.serial_number = #{serialNumber}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="incorrectAnswerResultMap"> <select id="get" resultMap="incorrectAnswerResultMap">
...@@ -78,7 +83,8 @@ ...@@ -78,7 +83,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{userId}, #{userId},
...@@ -92,7 +98,8 @@ ...@@ -92,7 +98,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
...@@ -111,7 +118,8 @@ ...@@ -111,7 +118,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ) values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
...@@ -127,7 +135,8 @@ ...@@ -127,7 +135,8 @@
#{item.modifier}, #{item.modifier},
#{item.modifyDate}, #{item.modifyDate},
#{item.delFlag}, #{item.delFlag},
#{item.applicationCode} #{item.applicationCode},
#{item.tenantCode}
) )
</foreach> </foreach>
</insert> </insert>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="knowledgeColumns"> <sql id="knowledgeColumns">
...@@ -26,7 +27,8 @@ ...@@ -26,7 +27,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -34,6 +36,9 @@ ...@@ -34,6 +36,9 @@
<if test="knowledgeName != null and knowledgeName != ''"> <if test="knowledgeName != null and knowledgeName != ''">
and a.knowledge_name like CONCAT('%',#{knowledgeName},'%') and a.knowledge_name like CONCAT('%',#{knowledgeName},'%')
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="knowledgeResultMap"> <select id="get" resultMap="knowledgeResultMap">
...@@ -73,7 +78,8 @@ ...@@ -73,7 +78,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{knowledgeName}, #{knowledgeName},
...@@ -85,7 +91,8 @@ ...@@ -85,7 +91,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="subjectBankColumns"> <sql id="subjectBankColumns">
...@@ -48,7 +49,8 @@ ...@@ -48,7 +49,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -62,6 +64,9 @@ ...@@ -62,6 +64,9 @@
<if test="subjectName != null and subjectName != ''"> <if test="subjectName != null and subjectName != ''">
and f.subject_name like CONCAT('%',#{subjectName},'%') and f.subject_name like CONCAT('%',#{subjectName},'%')
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="subjectBankResultMap"> <select id="get" resultMap="subjectBankResultMap">
...@@ -106,7 +111,8 @@ ...@@ -106,7 +111,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{categoryId}, #{categoryId},
...@@ -129,7 +135,8 @@ ...@@ -129,7 +135,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="subjectCategoryColumns"> <sql id="subjectCategoryColumns">
...@@ -26,7 +27,8 @@ ...@@ -26,7 +27,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -34,6 +36,9 @@ ...@@ -34,6 +36,9 @@
<if test="categoryName != null and categoryName != ''"> <if test="categoryName != null and categoryName != ''">
and a.category_name like CONCAT('%',#{categoryName},'%') and a.category_name like CONCAT('%',#{categoryName},'%')
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="subjectCategoryResultMap"> <select id="get" resultMap="subjectCategoryResultMap">
...@@ -55,7 +60,8 @@ ...@@ -55,7 +60,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) VALUES ( ) VALUES (
#{id}, #{id},
#{categoryName}, #{categoryName},
...@@ -67,7 +73,8 @@ ...@@ -67,7 +73,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
) )
</insert> </insert>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="subjectColumns"> <sql id="subjectColumns">
...@@ -48,7 +49,8 @@ ...@@ -48,7 +49,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -62,6 +64,9 @@ ...@@ -62,6 +64,9 @@
<if test="subjectName != null and subjectName != ''"> <if test="subjectName != null and subjectName != ''">
and a.subject_name like CONCAT('%',#{subjectName},'%') and a.subject_name like CONCAT('%',#{subjectName},'%')
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="subjectResultMap"> <select id="get" resultMap="subjectResultMap">
...@@ -127,7 +132,8 @@ ...@@ -127,7 +132,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{examinationId}, #{examinationId},
...@@ -150,7 +156,8 @@ ...@@ -150,7 +156,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="attachmentColumns"> <sql id="attachmentColumns">
...@@ -32,7 +33,8 @@ ...@@ -32,7 +33,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -46,6 +48,9 @@ ...@@ -46,6 +48,9 @@
<if test="busiModule != null and busiModule != ''"> <if test="busiModule != null and busiModule != ''">
and a.busi_module like #{busiModule} and a.busi_module like #{busiModule}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="attachmentResultMap"> <select id="get" resultMap="attachmentResultMap">
...@@ -89,7 +94,8 @@ ...@@ -89,7 +94,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) VALUES ( ) VALUES (
#{id}, #{id},
#{attachName}, #{attachName},
...@@ -104,7 +110,8 @@ ...@@ -104,7 +110,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
) )
</insert> </insert>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="deptColumns"> <sql id="deptColumns">
...@@ -30,7 +31,8 @@ ...@@ -30,7 +31,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -38,6 +40,9 @@ ...@@ -38,6 +40,9 @@
<if test="deptName != null and deptName != ''"> <if test="deptName != null and deptName != ''">
and a.dept_name like #{deptName} and a.dept_name like #{deptName}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="deptResultMap"> <select id="get" resultMap="deptResultMap">
...@@ -79,7 +84,8 @@ ...@@ -79,7 +84,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) VALUES ( ) VALUES (
#{id}, #{id},
#{deptName}, #{deptName},
...@@ -93,7 +99,8 @@ ...@@ -93,7 +99,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
) )
</insert> </insert>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="logColumns"> <sql id="logColumns">
...@@ -38,7 +39,8 @@ ...@@ -38,7 +39,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<select id="get" resultMap="logResultMap"> <select id="get" resultMap="logResultMap">
...@@ -73,7 +75,8 @@ ...@@ -73,7 +75,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{type}, #{type},
...@@ -91,7 +94,8 @@ ...@@ -91,7 +94,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="menuColumns"> <sql id="menuColumns">
...@@ -40,7 +41,8 @@ ...@@ -40,7 +41,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -54,6 +56,9 @@ ...@@ -54,6 +56,9 @@
<if test="permission != null and permission != ''"> <if test="permission != null and permission != ''">
and a.permission like #{permission} and a.permission like #{permission}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="menuResultMap"> <select id="get" resultMap="menuResultMap">
...@@ -82,7 +87,8 @@ ...@@ -82,7 +87,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) VALUES ( ) VALUES (
#{id}, #{id},
#{name}, #{name},
...@@ -101,7 +107,8 @@ ...@@ -101,7 +107,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
) )
</insert> </insert>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<result column="modify_date" property="modifyDate" /> <result column="modify_date" property="modifyDate" />
<result column="del_flag" property="delFlag" /> <result column="del_flag" property="delFlag" />
<result column="application_code" property="applicationCode" /> <result column="application_code" property="applicationCode" />
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<sql id="roleColumns"> <sql id="roleColumns">
...@@ -28,7 +29,8 @@ ...@@ -28,7 +29,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -42,6 +44,9 @@ ...@@ -42,6 +44,9 @@
<if test="isDefault != null and isDefault != ''"> <if test="isDefault != null and isDefault != ''">
and a.is_default = #{isDefault} and a.is_default = #{isDefault}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<select id="get" resultMap="roleResultMap"> <select id="get" resultMap="roleResultMap">
...@@ -90,7 +95,8 @@ ...@@ -90,7 +95,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) VALUES ( ) VALUES (
#{id}, #{id},
#{roleName}, #{roleName},
...@@ -103,7 +109,8 @@ ...@@ -103,7 +109,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
) )
</insert> </insert>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<result column="modify_date" property="modifyDate"/> <result column="modify_date" property="modifyDate"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="application_code" property="applicationCode"/> <result column="application_code" property="applicationCode"/>
<result column="tenant_code" property="tenantCode"/>
</resultMap> </resultMap>
<resultMap id="userVoResultMap" type="com.github.tangyi.common.core.vo.UserVo"> <resultMap id="userVoResultMap" type="com.github.tangyi.common.core.vo.UserVo">
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
<result column="umodify_date" property="modifyDate"/> <result column="umodify_date" property="modifyDate"/>
<result column="udel_flag" property="delFlag"/> <result column="udel_flag" property="delFlag"/>
<result column="uapplication_code" property="applicationCode"/> <result column="uapplication_code" property="applicationCode"/>
<result column="utenant_code" property="tenantCode"/>
<collection property="roleList" ofType="com.github.tangyi.common.core.vo.Role"> <collection property="roleList" ofType="com.github.tangyi.common.core.vo.Role">
<id column="roleId" property="id"/> <id column="roleId" property="id"/>
<result column="role_name" property="roleName"/> <result column="role_name" property="roleName"/>
...@@ -56,6 +58,7 @@ ...@@ -56,6 +58,7 @@
<result column="rmodify_date" property="modifyDate"/> <result column="rmodify_date" property="modifyDate"/>
<result column="rdel_flag" property="delFlag"/> <result column="rdel_flag" property="delFlag"/>
<result column="rapplication_code" property="applicationCode"/> <result column="rapplication_code" property="applicationCode"/>
<result column="rtenant_code" property="tenantCode"/>
</collection> </collection>
</resultMap> </resultMap>
...@@ -79,7 +82,8 @@ ...@@ -79,7 +82,8 @@
a.modifier, a.modifier,
a.modify_date, a.modify_date,
a.del_flag, a.del_flag,
a.application_code a.application_code,
a.tenant_code
</sql> </sql>
<!-- where 条件 --> <!-- where 条件 -->
...@@ -102,6 +106,9 @@ ...@@ -102,6 +106,9 @@
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and a.status = #{status} and a.status = #{status}
</if> </if>
<if test="tenantCode != null and tenantCode != ''">
and a.tenant_code = #{tenantCode}
</if>
</sql> </sql>
<sql id="selectUserVo"> <sql id="selectUserVo">
...@@ -126,6 +133,7 @@ ...@@ -126,6 +133,7 @@
`user`.modify_date as "umodify_date", `user`.modify_date as "umodify_date",
`user`.del_flag as "udel_flag", `user`.del_flag as "udel_flag",
`user`.application_code as "uapplication_code", `user`.application_code as "uapplication_code",
`user`.tenant_code as "utenant_code",
r.id as "roleId", r.id as "roleId",
r.role_name, r.role_name,
r.role_code, r.role_code,
...@@ -135,7 +143,8 @@ ...@@ -135,7 +143,8 @@
r.modifier as "rmodifier", r.modifier as "rmodifier",
r.modify_date as "rmodify_date", r.modify_date as "rmodify_date",
r.del_flag as "rdel_flag", r.del_flag as "rdel_flag",
r.application_code as "rapplication_code" r.application_code as "rapplication_code",
r.tenant_code as "rtenant_code"
FROM FROM
sys_user as `user` sys_user as `user`
LEFT JOIN sys_user_role ur ON ur.user_id = `user`.id LEFT JOIN sys_user_role ur ON ur.user_id = `user`.id
...@@ -198,7 +207,8 @@ ...@@ -198,7 +207,8 @@
modifier, modifier,
modify_date, modify_date,
del_flag, del_flag,
application_code application_code,
tenant_code
) values ( ) values (
#{id}, #{id},
#{name}, #{name},
...@@ -219,7 +229,8 @@ ...@@ -219,7 +229,8 @@
#{modifier}, #{modifier},
#{modifyDate}, #{modifyDate},
#{delFlag}, #{delFlag},
#{applicationCode} #{applicationCode},
#{tenantCode}
); );
</insert> </insert>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment