From 5167575dde37a2a5c7047df00069b6dedc3e4084 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 26 Mar 2021 17:08:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/20210326-zhangsai.sql | 17 ++ .../rtss/controller/OrgController.java | 21 +- .../controller/publish/ExamController.java | 24 +- .../training/TrainingV1Controller.java | 7 + .../joylink/rtss/entity/ExamDefinition.java | 18 +- .../rtss/entity/ExamDefinitionExample.java | 60 ++++ .../club/joylink/rtss/entity/OrgExam.java | 50 +++- .../joylink/rtss/entity/OrgExamExample.java | 201 +++++++++++++- .../joylink/rtss/services/ExamService.java | 258 ++++-------------- .../joylink/rtss/services/IExamService.java | 7 - .../joylink/rtss/services/MapService.java | 9 +- .../rtss/services/org/IOrgExamService.java | 10 + .../rtss/services/org/IOrgUserService.java | 6 - .../rtss/services/org/OrgExamService.java | 56 ++++ .../joylink/rtss/services/org/OrgService.java | 6 +- .../rtss/services/org/OrgUserService.java | 29 +- .../services/training/ITrainingV1Service.java | 6 + .../services/training/TrainingV1Service.java | 113 ++++---- .../rtss/vo/client/ExamDefinitionVO.java | 26 +- .../joylink/rtss/vo/client/map/MapVO.java | 3 +- .../rtss/vo/client/org/DepartmentVO.java | 8 +- .../mybatis/mapper/ExamDefinitionDAO.xml | 53 ++-- .../resources/mybatis/mapper/OrgExamDAO.xml | 85 +++++- 23 files changed, 678 insertions(+), 395 deletions(-) create mode 100644 sql/20210326-zhangsai.sql create mode 100644 src/main/java/club/joylink/rtss/services/org/IOrgExamService.java create mode 100644 src/main/java/club/joylink/rtss/services/org/OrgExamService.java diff --git a/sql/20210326-zhangsai.sql b/sql/20210326-zhangsai.sql new file mode 100644 index 000000000..b00b63dfe --- /dev/null +++ b/sql/20210326-zhangsai.sql @@ -0,0 +1,17 @@ +alter table exam_definition modify lesson_id bigint null comment '所属课程ID', + add map_id bigint not null comment '地图id' after id; + +-- 更新exam_definition的map_id字段 +UPDATE exam_definition SET map_id =( SELECT map_id FROM ls_lesson WHERE exam_definition.lesson_id = ls_lesson.id) + +alter table org_exam + modify org_id bigint not null, + add creator_id bigint not null, + add create_time datetime not null; + +ALTER TABLE `org_exam` +ADD COLUMN `id` bigint(20) NOT NULL AUTO_INCREMENT FIRST , +ADD PRIMARY KEY (`id`); + + + diff --git a/src/main/java/club/joylink/rtss/controller/OrgController.java b/src/main/java/club/joylink/rtss/controller/OrgController.java index 22103d485..c920f8909 100644 --- a/src/main/java/club/joylink/rtss/controller/OrgController.java +++ b/src/main/java/club/joylink/rtss/controller/OrgController.java @@ -3,10 +3,7 @@ package club.joylink.rtss.controller; import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.controller.advice.AuthenticateInterceptor; import club.joylink.rtss.controller.advice.Role; -import club.joylink.rtss.services.org.IOrgLessonService; -import club.joylink.rtss.services.org.IOrgScoringRuleService; -import club.joylink.rtss.services.org.IOrgService; -import club.joylink.rtss.services.org.IOrgUserService; +import club.joylink.rtss.services.org.*; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.LessonVO; @@ -39,6 +36,9 @@ public class OrgController { @Autowired private IOrgScoringRuleService iOrgScoringRuleService; + @Autowired + private IOrgExamService iOrgExamService; + @ApiOperation(value = "创建顶级组织") @PostMapping public CompanyVO create(@RequestBody @Validated CompanyVO company, @RequestAttribute(AuthenticateInterceptor.LOGIN_USER_KEY) UserVO user) { @@ -183,15 +183,15 @@ public class OrgController { iOrgService.createCls(createVO, loginInfo); } - @ApiOperation("分页查询班级") + @ApiOperation("分页查询当前登录项目所属组织下的班级") @GetMapping("/paged/cls") public PageVO pagedQuerySelfCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) { return iOrgService.pagedQueryCls(queryVO, loginInfo); } - @ApiOperation("查询班级") + @ApiOperation("查询当前登录项目所属组织下的班级") @GetMapping("/list/cls") - public List querySelfCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) { + public List queryCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) { return iOrgService.queryCls(queryVO, loginInfo); } @@ -257,4 +257,11 @@ public class OrgController { public PageVO adminPagedQueryOrg(OrgQueryVO queryVO) { return iOrgService.adminPagedQueryOrg(queryVO); } + + @ApiOperation("给班级安排考试") + @PostMapping("/orgExam/{clsId}") + public void createOrgExam(@PathVariable Long clsId, @RequestBody List examIds, @RequestAttribute UserVO user) { + iOrgExamService.create(clsId, examIds, user); + } + } diff --git a/src/main/java/club/joylink/rtss/controller/publish/ExamController.java b/src/main/java/club/joylink/rtss/controller/publish/ExamController.java index 84cffe71a..8cd2398b4 100644 --- a/src/main/java/club/joylink/rtss/controller/publish/ExamController.java +++ b/src/main/java/club/joylink/rtss/controller/publish/ExamController.java @@ -7,7 +7,6 @@ import club.joylink.rtss.vo.client.ExamDefinitionQueryVO; import club.joylink.rtss.vo.client.ExamDefinitionVO; import club.joylink.rtss.vo.client.ExamsLessonVO; import club.joylink.rtss.vo.client.PageVO; -import club.joylink.rtss.vo.client.validGroup.ExamDefinitionCheck; import club.joylink.rtss.vo.client.validGroup.ExamDefinitionRulesCheck; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -27,30 +26,16 @@ public class ExamController { @ApiOperation(value = "创建考试") @PostMapping(path = "") - public void create(@RequestBody @Validated(value = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) - ExamDefinitionVO examDefinitionVO, @RequestAttribute @ApiIgnore UserVO user) { + public void create(@RequestBody @Validated ExamDefinitionVO examDefinitionVO, @RequestAttribute @ApiIgnore UserVO user) { iExamService.create(examDefinitionVO, user); } -// @ApiOperation(value = "贵装备创建考试") -// @PostMapping(path = "/project/GZB") -// public void createGZBExam(@RequestBody @Validated(value = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) -// ExamDefinitionVO examDefinitionVO, @RequestAttribute @ApiIgnore UserVO user) { -// iExamService.createGZBExam(examDefinitionVO, user); -// } - @ApiOperation(value = "检查分数是否合理") @GetMapping(path = "/checkScore") public boolean checkScore(@Validated(value = ExamDefinitionRulesCheck.class) ExamDefinitionVO examDefinitionVO) { return iExamService.checkScore(examDefinitionVO); } -// @ApiOperation(value = "查询课程下的章节信息") -// @GetMapping(path = "/{lessonId}/chapter") -// public CommonJsonResponse queryChapterInfo(@PathVariable(required = true) String lessonId) { -// return CommonJsonResponse.newSuccessResponse(iExamService.queryChapterInfo(lessonId)); -// } - @ApiOperation(value = "查询课程所属产品下有实训的实训类型") @GetMapping(path = "/{lessonId}/trainingTypes") public List queryTrainingTypes(@PathVariable Long lessonId) { @@ -81,13 +66,6 @@ public class ExamController { iExamService.deleteExam(id, user); } -// @ApiOperation(value = "查询章节下允许创建的最多题目数量") -// @GetMapping(path = "/trainingNum/{lessonId}/{chapterId}") -// public CommonJsonResponse queryTrainingNum(@PathVariable(required = true) String lessonId, @PathVariable(required = true) String chapterId) { -// int trainingNum = iExamService.queryTrainingNum(lessonId, chapterId); -// return CommonJsonResponse.newSuccessResponse(trainingNum); -// } - @ApiOperation(value = "根据课程和实训类型查询实训数量") @GetMapping(path = "/trainingNum/{lessonId}/{trainingType}") public Long queryTrainingNum(@PathVariable Long lessonId, @PathVariable String trainingType, String operateType) { diff --git a/src/main/java/club/joylink/rtss/controller/training/TrainingV1Controller.java b/src/main/java/club/joylink/rtss/controller/training/TrainingV1Controller.java index 4f1ce72c3..fba9b9ec7 100644 --- a/src/main/java/club/joylink/rtss/controller/training/TrainingV1Controller.java +++ b/src/main/java/club/joylink/rtss/controller/training/TrainingV1Controller.java @@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.validation.constraints.NotBlank; +import java.util.Map; import java.util.Set; @Api(tags = { "实训数据管理接口" }) @@ -195,4 +196,10 @@ public class TrainingV1Controller { public TrainingNewVO loadTraining(@PathVariable String group, @PathVariable Long id) { return iTrainingService.loadTraining(group, id); } + + @ApiOperation("根据地图id和产品类型查询实训、操作类型及数量") + @GetMapping("/trainingTypeAndQuantity") + public Map> queryTrainingTypeAndQuantity(Long mapId, String prdType) { + return iTrainingService.queryTrainingTypeAndQuantity(mapId, prdType); + } } diff --git a/src/main/java/club/joylink/rtss/entity/ExamDefinition.java b/src/main/java/club/joylink/rtss/entity/ExamDefinition.java index f044c5acd..c5660bda3 100644 --- a/src/main/java/club/joylink/rtss/entity/ExamDefinition.java +++ b/src/main/java/club/joylink/rtss/entity/ExamDefinition.java @@ -4,12 +4,17 @@ import java.io.Serializable; import java.time.LocalDateTime; /** - * exam_definition * @author + * 考试定义表 */ public class ExamDefinition implements Serializable { private Long id; + /** + * 地图id + */ + private Long mapId; + /** * 所属课程ID */ @@ -85,6 +90,14 @@ public class ExamDefinition implements Serializable { this.id = id; } + public Long getMapId() { + return mapId; + } + + public void setMapId(Long mapId) { + this.mapId = mapId; + } + public Long getLessonId() { return lessonId; } @@ -202,6 +215,7 @@ public class ExamDefinition implements Serializable { } ExamDefinition other = (ExamDefinition) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId())) && (this.getLessonId() == null ? other.getLessonId() == null : this.getLessonId().equals(other.getLessonId())) && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) @@ -222,6 +236,7 @@ public class ExamDefinition implements Serializable { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode()); result = prime * result + ((getLessonId() == null) ? 0 : getLessonId().hashCode()); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); @@ -245,6 +260,7 @@ public class ExamDefinition implements Serializable { sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); + sb.append(", mapId=").append(mapId); sb.append(", lessonId=").append(lessonId); sb.append(", name=").append(name); sb.append(", type=").append(type); diff --git a/src/main/java/club/joylink/rtss/entity/ExamDefinitionExample.java b/src/main/java/club/joylink/rtss/entity/ExamDefinitionExample.java index a92e32b56..716282de6 100644 --- a/src/main/java/club/joylink/rtss/entity/ExamDefinitionExample.java +++ b/src/main/java/club/joylink/rtss/entity/ExamDefinitionExample.java @@ -185,6 +185,66 @@ public class ExamDefinitionExample { return (Criteria) this; } + public Criteria andMapIdIsNull() { + addCriterion("map_id is null"); + return (Criteria) this; + } + + public Criteria andMapIdIsNotNull() { + addCriterion("map_id is not null"); + return (Criteria) this; + } + + public Criteria andMapIdEqualTo(Long value) { + addCriterion("map_id =", value, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdNotEqualTo(Long value) { + addCriterion("map_id <>", value, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdGreaterThan(Long value) { + addCriterion("map_id >", value, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdGreaterThanOrEqualTo(Long value) { + addCriterion("map_id >=", value, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdLessThan(Long value) { + addCriterion("map_id <", value, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdLessThanOrEqualTo(Long value) { + addCriterion("map_id <=", value, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdIn(List values) { + addCriterion("map_id in", values, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdNotIn(List values) { + addCriterion("map_id not in", values, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdBetween(Long value1, Long value2) { + addCriterion("map_id between", value1, value2, "mapId"); + return (Criteria) this; + } + + public Criteria andMapIdNotBetween(Long value1, Long value2) { + addCriterion("map_id not between", value1, value2, "mapId"); + return (Criteria) this; + } + public Criteria andLessonIdIsNull() { addCriterion("lesson_id is null"); return (Criteria) this; diff --git a/src/main/java/club/joylink/rtss/entity/OrgExam.java b/src/main/java/club/joylink/rtss/entity/OrgExam.java index d543ceb52..402dd1923 100644 --- a/src/main/java/club/joylink/rtss/entity/OrgExam.java +++ b/src/main/java/club/joylink/rtss/entity/OrgExam.java @@ -1,18 +1,33 @@ package club.joylink.rtss.entity; import java.io.Serializable; +import java.time.LocalDateTime; /** - * org_exam - * @author + * @author + * 学生的试卷和班级关系 */ public class OrgExam implements Serializable { + private Long id; + private Long examId; private Long orgId; + private Long creatorId; + + private LocalDateTime createTime; + private static final long serialVersionUID = 1L; + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public Long getExamId() { return examId; } @@ -29,6 +44,22 @@ public class OrgExam implements Serializable { this.orgId = orgId; } + public Long getCreatorId() { + return creatorId; + } + + public void setCreatorId(Long creatorId) { + this.creatorId = creatorId; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -41,16 +72,22 @@ public class OrgExam implements Serializable { return false; } OrgExam other = (OrgExam) that; - return (this.getExamId() == null ? other.getExamId() == null : this.getExamId().equals(other.getExamId())) - && (this.getOrgId() == null ? other.getOrgId() == null : this.getOrgId().equals(other.getOrgId())); + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getExamId() == null ? other.getExamId() == null : this.getExamId().equals(other.getExamId())) + && (this.getOrgId() == null ? other.getOrgId() == null : this.getOrgId().equals(other.getOrgId())) + && (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); } @Override public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getExamId() == null) ? 0 : getExamId().hashCode()); result = prime * result + ((getOrgId() == null) ? 0 : getOrgId().hashCode()); + result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); return result; } @@ -60,10 +97,13 @@ public class OrgExam implements Serializable { sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); sb.append(", examId=").append(examId); sb.append(", orgId=").append(orgId); + sb.append(", creatorId=").append(creatorId); + sb.append(", createTime=").append(createTime); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } -} +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/OrgExamExample.java b/src/main/java/club/joylink/rtss/entity/OrgExamExample.java index d3ff9c0dc..5841b351f 100644 --- a/src/main/java/club/joylink/rtss/entity/OrgExamExample.java +++ b/src/main/java/club/joylink/rtss/entity/OrgExamExample.java @@ -1,5 +1,6 @@ package club.joylink.rtss.entity; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -124,6 +125,66 @@ public class OrgExamExample { criteria.add(new Criterion(condition, value1, value2)); } + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + public Criteria andExamIdIsNull() { addCriterion("exam_id is null"); return (Criteria) this; @@ -194,55 +255,175 @@ public class OrgExamExample { return (Criteria) this; } - public Criteria andOrgIdEqualTo(Integer value) { + public Criteria andOrgIdEqualTo(Long value) { addCriterion("org_id =", value, "orgId"); return (Criteria) this; } - public Criteria andOrgIdNotEqualTo(Integer value) { + public Criteria andOrgIdNotEqualTo(Long value) { addCriterion("org_id <>", value, "orgId"); return (Criteria) this; } - public Criteria andOrgIdGreaterThan(Integer value) { + public Criteria andOrgIdGreaterThan(Long value) { addCriterion("org_id >", value, "orgId"); return (Criteria) this; } - public Criteria andOrgIdGreaterThanOrEqualTo(Integer value) { + public Criteria andOrgIdGreaterThanOrEqualTo(Long value) { addCriterion("org_id >=", value, "orgId"); return (Criteria) this; } - public Criteria andOrgIdLessThan(Integer value) { + public Criteria andOrgIdLessThan(Long value) { addCriterion("org_id <", value, "orgId"); return (Criteria) this; } - public Criteria andOrgIdLessThanOrEqualTo(Integer value) { + public Criteria andOrgIdLessThanOrEqualTo(Long value) { addCriterion("org_id <=", value, "orgId"); return (Criteria) this; } - public Criteria andOrgIdIn(List values) { + public Criteria andOrgIdIn(List values) { addCriterion("org_id in", values, "orgId"); return (Criteria) this; } - public Criteria andOrgIdNotIn(List values) { + public Criteria andOrgIdNotIn(List values) { addCriterion("org_id not in", values, "orgId"); return (Criteria) this; } - public Criteria andOrgIdBetween(Integer value1, Integer value2) { + public Criteria andOrgIdBetween(Long value1, Long value2) { addCriterion("org_id between", value1, value2, "orgId"); return (Criteria) this; } - public Criteria andOrgIdNotBetween(Integer value1, Integer value2) { + public Criteria andOrgIdNotBetween(Long value1, Long value2) { addCriterion("org_id not between", value1, value2, "orgId"); return (Criteria) this; } + + public Criteria andCreatorIdIsNull() { + addCriterion("creator_id is null"); + return (Criteria) this; + } + + public Criteria andCreatorIdIsNotNull() { + addCriterion("creator_id is not null"); + return (Criteria) this; + } + + public Criteria andCreatorIdEqualTo(Long value) { + addCriterion("creator_id =", value, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdNotEqualTo(Long value) { + addCriterion("creator_id <>", value, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdGreaterThan(Long value) { + addCriterion("creator_id >", value, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) { + addCriterion("creator_id >=", value, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdLessThan(Long value) { + addCriterion("creator_id <", value, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdLessThanOrEqualTo(Long value) { + addCriterion("creator_id <=", value, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdIn(List values) { + addCriterion("creator_id in", values, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdNotIn(List values) { + addCriterion("creator_id not in", values, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdBetween(Long value1, Long value2) { + addCriterion("creator_id between", value1, value2, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreatorIdNotBetween(Long value1, Long value2) { + addCriterion("creator_id not between", value1, value2, "creatorId"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(LocalDateTime value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(LocalDateTime value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(LocalDateTime value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(LocalDateTime value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } } /** diff --git a/src/main/java/club/joylink/rtss/services/ExamService.java b/src/main/java/club/joylink/rtss/services/ExamService.java index 02a0035ac..d7142f84f 100644 --- a/src/main/java/club/joylink/rtss/services/ExamService.java +++ b/src/main/java/club/joylink/rtss/services/ExamService.java @@ -11,9 +11,11 @@ import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.*; +import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.org.DepartmentVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; +import lombok.NonNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -76,26 +78,23 @@ public class ExamService implements IExamService { */ @Override public void create(ExamDefinitionVO examDefinitionVO, UserVO userVO) { - examDefinitionVO.setCreatorId(userVO.getId()); //检查分数是否合理 BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO)); - //检查考试名称和考试规则是否唯一 - checkName(examDefinitionVO); + //检查考试名称是否唯一 + confirmNameUnique(examDefinitionVO.getMapId(), examDefinitionVO.getPrdType(), examDefinitionVO.getName()); //插入考试定义表数据 ExamDefinition examDefinition = examDefinitionVO.toDB(); + examDefinition.setCreatorId(userVO.getId()); examDefinition.setCreateTime(LocalDateTime.now()); examDefinition.setStatus(BusinessConsts.STATUS_USE); - // 判断是否是管理员并设置试用 - if (this.iSysUserService.isAdmin(userVO) && examDefinitionVO.getTrial()) { - examDefinition.setTrial(true); - } else { - examDefinition.setTrial(false); + if (examDefinitionVO.getTrial() != null) { + examDefinition.setTrial(examDefinition.getTrial()); } examDefinitionDAO.insert(examDefinition); - //插入试卷班级关系 - if (!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { - examDefinitionVO.getClasses().forEach(departmentVO -> iOrgUserService.addDepartExam(examDefinition.getId(), departmentVO.getId())); - } +// //插入试卷班级关系 +// if (!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { +// examDefinitionVO.getClasses().forEach(departmentVO -> iOrgUserService.addDepartExam(examDefinition.getId(), departmentVO.getId())); +// } //插入试题规则表数据 List examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> { @@ -152,47 +151,19 @@ public class ExamService implements IExamService { } } - // /** -// * GZB创建考试定义 -// */ -// @Transactional -// @Override -// public void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO) { -// examDefinitionVO.setCreatorId(userVO.getId()); -// -// //检查分数是否合理 -// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO)); -// //检查考试名称和考试规则是否唯一 -// checkName(examDefinitionVO); -// //插入考试定义表数据 -// ExamDefinition examDefinition = examDefinitionVO.toDB(); -// examDefinition.setCreateTime(LocalDateTime.now()); -// examDefinition.setStatus(BusinessConsts.STATUS_USE); -// // 判断是否是管理员并设置试用 -// if(this.iSysUserService.isAdmin(userVO) && examDefinitionVO.getTrial()) { -// examDefinition.setTrial(true); -// }else { -// examDefinition.setTrial(false); -// } -// examDefinitionDAO.insert(examDefinition); -// //插入试卷班级关系 -// if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { -// examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(examDefinition.getId(),departmentVO.getId())); -// } -// //插入试题规则表数据 -// List examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); -// examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> { -// ExamDefinitionRules examDefinitionRules = examDefinitionRulesVO.toDB(); -// examDefinitionRules.setExamId(examDefinition.getId()); -// definitionRulesDAO.insert(examDefinitionRules); -// }); -// } - private void checkName(ExamDefinitionVO examDefinitionVO) { - //一个课程下考试名称查重 - ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); - examDefinitionExample.createCriteria().andLessonIdEqualTo(examDefinitionVO.getLessonId()).andNameEqualTo(examDefinitionVO.getName()); - List examDefinitionList = examDefinitionDAO.selectByExample(examDefinitionExample); - BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList); + /** + * 确认名称唯一 + */ + private void confirmNameUnique(@NonNull Long mapId, @NonNull String type, @NonNull String name) { +// //一个课程下考试名称查重 +// ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); +// examDefinitionExample.createCriteria().andLessonIdEqualTo(examDefinitionVO.getLessonId()).andNameEqualTo(examDefinitionVO.getName()); +// List examDefinitionList = examDefinitionDAO.selectByExample(examDefinitionExample); +// BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList); + ExamDefinitionExample example = new ExamDefinitionExample(); + example.createCriteria().andMapIdEqualTo(mapId).andTypeEqualTo(type).andNameEqualTo(name); + BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(examDefinitionDAO.countByExample(example) == 0, + "名称重复"); } /** @@ -217,38 +188,6 @@ public class ExamService implements IExamService { return defineFullScore == realFullScore; } -// /** -// * 查询课程下有实训的章节信息 -// * @param lessonId -// * @return -// */ -// @Override -// public List queryChapterInfo(String lessonId) { -// //返回的结果 -// List examChapterInfoVOList = new ArrayList<>(); -// -// //查询数据 -// List lessonIds = new ArrayList<>(); -// lessonIds.add(Long.valueOf(lessonId)); -// List chapterVos = this.lsLessonChapterMapper.selectChapterTrainingByLessonIds(lessonIds); -// -// //检测章节是否为空 -// if (chapterVos.size() == 0) { -// throw new DBException(ExceptionMapping.DATA_NOT_EXIST); -// } -// -// //转换为VO对象 -// chapterVos.forEach(lessonChapterVO -> { -// ExamChapterInfoVO examChapterInfoVO = new ExamChapterInfoVO(); -// examChapterInfoVO.setId(lessonChapterVO.getId()); -// examChapterInfoVO.setName(lessonChapterVO.getName()); -// -// examChapterInfoVOList.add(examChapterInfoVO); -// }); -// -// return examChapterInfoVOList; -// } - @Override public List queryTrainingTypes(Long lessonId) { // 获取课程,课程所属产品编码 @@ -265,8 +204,6 @@ public class ExamService implements IExamService { /** * 查询试题定义的详细信息 - * - * @param examId */ @Override public ExamDefinitionVO queryExamInfo(Long examId) { @@ -301,37 +238,10 @@ public class ExamService implements IExamService { //查询课程信息 LessonVO lessonVO = iLessonService.getLessonInfo(lessonId); -// MapVO mapVO = iMapService.findMapBaseInfoById(lessonVO.getMapId()); -// BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(lessonVO.getPrdType()); -// String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.getName()); -// lessonVO.setSystemFault(Objects.equals(lessonVO.getName(),defaultLessonName)); - // 如果用户关联班级 查找班级关联试卷 - List examIds = null; -// List userDepartRelVOS = this.iOrgUserService.getDepartRefByUserId(userVO.getId()); -// if (!CollectionUtils.isEmpty(userDepartRelVOS)) { -// examIds = new ArrayList<>(); -// for (UserDepartRelVO udr : userDepartRelVOS) { -// examIds.addAll(iOrgUserService.getExamIdsByDepartId(udr.getDepartmentId())); -// } -// } //查询课程下的试题信息 ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); examDefinitionExample.createCriteria().andLessonIdEqualTo(lessonId).andStatusEqualTo(BusinessConsts.STATUS_USE); List examDefinitionList = examDefinitionDAO.selectByExample(examDefinitionExample); - // 检测试题是否有效 - LocalDateTime now = LocalDateTime.now(); - Iterator iterator = examDefinitionList.iterator(); - while (iterator.hasNext()) { - ExamDefinition exam = iterator.next(); - if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) { - this.forceOffline(exam); - iterator.remove(); - } else if (!lessonVO.isSystemFault() && Objects.nonNull(examIds) -// && !Objects.equals(exam.getName(),defaultLessonName+"试卷") - && !examIds.contains(exam.getId())) { - iterator.remove(); - } - } //转换为VO ExamsLessonVO examsLessonVO = new ExamsLessonVO(lessonVO); List examDefinitionVOList = new ArrayList<>(); @@ -444,27 +354,6 @@ public class ExamService implements IExamService { examDefinitionDAO.deleteByPrimaryKey(Long.parseLong(id)); } - -// /** -// * 查询章节下允许创建的最多题目数量 -// * -// * @param lessonId -// * @param chapterId -// * @return -// */ -// @Override -// public int queryTrainingNum(String lessonId, String chapterId) { -// Long chapterIdLong = ConvertUtil.str2Long(chapterId); -// Long lessonIdLong = ConvertUtil.str2Long(lessonId); -// -// //查询课程章节实训映射表信息 -// LsRelChapterTrainingExample example = new LsRelChapterTrainingExample(); -// example.setDistinct(true); -// example.createCriteria().andChapterIdEqualTo(chapterIdLong).andLessonIdEqualTo(lessonIdLong); -// List lsRelChapterTrainingList = lsRelChapterTrainingMapper.selectByExample(example); -// -// return lsRelChapterTrainingList.size(); -// } @Override public Long queryTrainingNum(Long lessonId, String trainingType, String operateType) { // 获取课程数据 @@ -523,18 +412,8 @@ public class ExamService implements IExamService { public void update(Long id, ExamDefinitionVO examDefinitionVO) { ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition); - if (!CollectionUtils.isEmpty(iOrgUserService.getDepartsByExamId(id))) { - iOrgUserService.deleteDepartsExam(id); - } - if (!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { - examDefinitionVO.getClasses().forEach(departmentVO -> iOrgUserService.addDepartExam(id, departmentVO.getId())); - } //考试名称查重 - String name = examDefinitionVO.getName(); - ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); - examDefinitionExample.createCriteria().andNameEqualTo(name).andIdNotEqualTo(id); - List examDefinitionList = examDefinitionDAO.selectByExample(examDefinitionExample); - BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList); + confirmNameUnique(examDefinition.getMapId(), examDefinition.getType(), examDefinitionVO.getName()); examDefinition.setName(examDefinitionVO.getName()); examDefinition.setTrial(examDefinitionVO.getTrial()); examDefinition.setStartTime(examDefinitionVO.getStartTime()); @@ -565,34 +444,6 @@ public class ExamService implements IExamService { examDefinitionRulesDAO.insertSelective(rules); } } - -// ExamDefinitionExample examExample = new ExamDefinitionExample(); -// examExample.createCriteria() -// .andLessonIdEqualTo(sourceLessonId); -// List definitionList = this.examDefinitionDAO.selectByExample(examExample); -// if(!CollectionUtils.isEmpty(definitionList)) { -// definitionList.forEach(definition -> { -// // 拷贝考试定义 -// Long oldId = definition.getId(); -// definition.setId(null); -// definition.setLessonId(targetLessonId); -// definition.setCreatorId(user.getId()); -// this.examDefinitionDAO.insert(definition); -// Long newId = definition.getId(); -// // 拷贝考试规则 -// ExamDefinitionRulesExample example = new ExamDefinitionRulesExample(); -// example.createCriteria() -// .andExamIdEqualTo(oldId); -// List ruleList = this.definitionRulesDAO.selectByExample(example); -// if(!CollectionUtils.isEmpty(ruleList)) { -// ruleList.forEach(rules -> { -// rules.setId(null); -// rules.setExamId(newId); -// this.definitionRulesDAO.insert(rules); -// }); -// } -// }); -// } } @Override @@ -604,43 +455,28 @@ public class ExamService implements IExamService { @Override public PageVO pagedQueryByLoginProject(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo) { - List lessonIds; - if (queryVO.getLessonId() != null) { - lessonIds = List.of(queryVO.getLessonId()); - } else { - List lessonVOS = iLessonService.queryNonDefaultLessons(null, loginInfo.getProject(), BusinessConsts.STATUS_USE); - lessonIds = lessonVOS.stream().map(LessonVO::getId).collect(Collectors.toList()); - } - if (CollectionUtils.isEmpty(lessonIds)) { - return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>()); - } else { - List orgLessons = iOrgLessonService.findEntitiesByLessonIds(lessonIds); - Map> lessonOrgMap = orgLessons.stream() - .collect(Collectors.groupingBy(OrgLesson::getLessonId, Collectors.mapping(OrgLesson::getOrgId, Collectors.toList()))); - ExamDefinitionExample example = new ExamDefinitionExample(); - ExamDefinitionExample.Criteria criteria = example.createCriteria().andLessonIdIn(lessonIds); - if (StringUtils.hasText(queryVO.getName())) { - criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); - } - if (StringUtils.hasText(queryVO.getCreatorName())) { - List creatorIds = iSysUserService.findUserByName(queryVO.getCreatorName()).stream().map(UserVO::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(creatorIds)) { - return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>()); - } else { - criteria.andCreatorIdIn(creatorIds); - } - } - PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); - Page page = (Page) examDefinitionDAO.selectByExample(example); - Map creatorMap = iSysUserService.findEntity(page.stream().map(ExamDefinition::getCreatorId).collect(Collectors.toList()), null) - .stream().collect(Collectors.toMap(SysUser::getId, Function.identity())); - List list = page.getResult().stream().map(examDefinition -> { - ExamDefinitionVO vo = new ExamDefinitionVO(examDefinition, creatorMap.get(examDefinition.getCreatorId())); - vo.setClsIds(lessonOrgMap.get(vo.getLessonId())); - return vo; - }).collect(Collectors.toList()); - return PageVO.convert(page, list); + PageVO empty = new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>()); + List creatorIds = null; + Map creatorMap = null; + if (StringUtils.hasText(queryVO.getCreatorName())) { + iSysUserService. + List creators = iSysUserService.findUserByName(queryVO.getCreatorName()); + if (CollectionUtils.isEmpty(creators)) + return empty; + creatorIds = creators.stream().map(UserVO::getId).collect(Collectors.toList()); } + List mapIds = iMapService.findOnlineMapByProjectCode(loginInfo.getProject().name()) + .stream().map(MapVO::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(mapIds)) + return empty; + ExamDefinitionExample example = new ExamDefinitionExample(); + ExamDefinitionExample.Criteria criteria = example.createCriteria().andMapIdIn(mapIds); + if (!CollectionUtils.isEmpty(creatorIds)) + criteria.andCreatorIdIn(creatorIds); + if (StringUtils.hasText(queryVO.getName())) + criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); + List exams = examDefinitionDAO.selectByExample(example); + exams.stream().map() } @Override @@ -650,7 +486,7 @@ public class ExamService implements IExamService { Org topOrg = iOrgService.getEntity(loginInfo.getProject(), BusinessConsts.Org.Status.VALID); List clsList = iOrgService.findEntitiesByParentId(topOrg.getId(), "id", BusinessConsts.Org.Status.VALID); List clsIds = clsList.stream().map(Org::getId).collect(Collectors.toList()); - lessonIds = iOrgLessonService.findEntitiesByOrgIds(clsIds).stream().map(OrgLesson::getLessonId).collect(Collectors.toList()); + lessonIds = iOrgLessonService.findEntitiesByOrgIds(clsIds).stream().map(OrgLesson::getLessonId).collect(Collectors.toList()); } else { lessonIds = iOrgLessonService.findEntitiesByOrgId(clsId, null).stream().map(OrgLesson::getLessonId).collect(Collectors.toList()); } diff --git a/src/main/java/club/joylink/rtss/services/IExamService.java b/src/main/java/club/joylink/rtss/services/IExamService.java index c508a4057..753b53645 100644 --- a/src/main/java/club/joylink/rtss/services/IExamService.java +++ b/src/main/java/club/joylink/rtss/services/IExamService.java @@ -17,8 +17,6 @@ public interface IExamService { */ void create(ExamDefinitionVO examDefinitionVO, UserVO userVO); -// void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO); - /** * 检查分数定义是否合理 */ @@ -49,11 +47,6 @@ public interface IExamService { */ void deleteExam(String id, UserVO userVO); - -// /** -// * 查询章节下允许创建的最多题目数量 -// */ -// int queryTrainingNum(String lessonId, String chapterId); /** * 根据课程和实训类型查询实训数量 */ diff --git a/src/main/java/club/joylink/rtss/services/MapService.java b/src/main/java/club/joylink/rtss/services/MapService.java index ac894a784..2d14a0936 100644 --- a/src/main/java/club/joylink/rtss/services/MapService.java +++ b/src/main/java/club/joylink/rtss/services/MapService.java @@ -173,9 +173,12 @@ public class MapService implements IMapService { Objects.requireNonNull(projectCode, "项目编号不能为空"); MapInfoExample example = new MapInfoExample(); example.setOrderByClause("order_number"); - example.createCriteria() - .andStatusEqualTo(MapStatus.Online.getCode()) - .andProjectCodeEqualTo(projectCode); + MapInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(MapStatus.Online.getCode()); + if (Project.DEFAULT.name().equals(projectCode)) { + criteria.andProjectCodeIsNull(); + } else { + criteria.andProjectCodeEqualTo(projectCode); + } List list = mapInfoDAO.selectByExample(example); return MapVO.convert2VOList(list); } diff --git a/src/main/java/club/joylink/rtss/services/org/IOrgExamService.java b/src/main/java/club/joylink/rtss/services/org/IOrgExamService.java new file mode 100644 index 000000000..e0399680c --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/org/IOrgExamService.java @@ -0,0 +1,10 @@ +package club.joylink.rtss.services.org; + +import club.joylink.rtss.vo.UserVO; + +import java.util.List; + +public interface IOrgExamService { + + void create(Long clsId, List examIds, UserVO user); +} diff --git a/src/main/java/club/joylink/rtss/services/org/IOrgUserService.java b/src/main/java/club/joylink/rtss/services/org/IOrgUserService.java index b1ed5d39e..1a1833a55 100644 --- a/src/main/java/club/joylink/rtss/services/org/IOrgUserService.java +++ b/src/main/java/club/joylink/rtss/services/org/IOrgUserService.java @@ -17,8 +17,6 @@ public interface IOrgUserService { */ CompanyVO userScanCodeBindCompanyManager(Long userId, Long companyId); - boolean isCompanyUser(Long userId); - DepartmentVO createDepart(DepartmentVO departmentVO); void updateDepartInfo(Long id, DepartmentVO departmentVO); @@ -33,8 +31,6 @@ public interface IOrgUserService { List getDepartAndChild(Long companyId, Long deptId); - List getDepartRefByUserId(Long userId); - void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); void updateDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); @@ -52,8 +48,6 @@ public interface IOrgUserService { List getDepartsByExamId(Long examId); - void deleteDepartsExam(Long examId); - void addDepartExam(Long examId, Long departId); List getDepartLessonRefs(Long departId); diff --git a/src/main/java/club/joylink/rtss/services/org/OrgExamService.java b/src/main/java/club/joylink/rtss/services/org/OrgExamService.java new file mode 100644 index 000000000..718c79439 --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/org/OrgExamService.java @@ -0,0 +1,56 @@ +package club.joylink.rtss.services.org; + +import club.joylink.rtss.constants.BusinessConsts; +import club.joylink.rtss.dao.OrgExamDAO; +import club.joylink.rtss.entity.Org; +import club.joylink.rtss.entity.OrgExam; +import club.joylink.rtss.entity.OrgExamExample; +import club.joylink.rtss.vo.UserVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +@Service +public class OrgExamService implements IOrgExamService { + @Autowired + private IOrgService iOrgService; + + @Autowired + private IOrgUserService iOrgUserService; + + @Autowired + private OrgExamDAO orgExamDAO; + + @Override + public void create(Long clsId, List examIds, UserVO user) { + Org topOrg = iOrgService.getTopOrgEntity(clsId, BusinessConsts.Org.Status.VALID); + iOrgUserService.confirmIsTheRoleInThisOrg(user.getId(), topOrg.getId(), BusinessConsts.OrgRole.Admin); + delete(clsId, user.getId()); + LocalDateTime createTime = LocalDateTime.now(); + examIds.forEach(examId -> { + OrgExam orgExam = new OrgExam(); + orgExam.setOrgId(clsId); + orgExam.setExamId(examId); + orgExam.setCreatorId(user.getId()); + orgExam.setCreateTime(createTime); + orgExamDAO.insert(orgExam); + }); + } + + private List findEntities(long orgId, Long creatorId) { + OrgExamExample example = new OrgExamExample(); + OrgExamExample.Criteria criteria = example.createCriteria().andOrgIdEqualTo(orgId); + if (creatorId != null) { + criteria.andCreatorIdEqualTo(creatorId); + } + return orgExamDAO.selectByExample(example); + } + + private void delete(long orgId, long creatorId) { + OrgExamExample example = new OrgExamExample(); + example.createCriteria().andOrgIdEqualTo(orgId).andCreatorIdEqualTo(creatorId); + orgExamDAO.deleteByExample(example); + } +} diff --git a/src/main/java/club/joylink/rtss/services/org/OrgService.java b/src/main/java/club/joylink/rtss/services/org/OrgService.java index 6ca999ed5..f80ae43d5 100644 --- a/src/main/java/club/joylink/rtss/services/org/OrgService.java +++ b/src/main/java/club/joylink/rtss/services/org/OrgService.java @@ -123,7 +123,7 @@ public class OrgService implements IOrgService { } @Override - public Org findEntity(Project project, String status) { + public Org findEntity(@NonNull Project project, String status) { OrgExample example = new OrgExample(); OrgExample.Criteria criteria = example.createCriteria().andProjectCodeEqualTo(project.name()); if (StringUtils.hasText(status)) { @@ -164,7 +164,7 @@ public class OrgService implements IOrgService { } @Override - public List findEntitiesByParentId(Long parentId, String orderBy, String status) { + public List findEntitiesByParentId(@NonNull Long parentId, String orderBy, String status) { OrgExample example = new OrgExample(); if (StringUtils.hasText(orderBy)) { example.setOrderByClause(orderBy); @@ -273,7 +273,7 @@ public class OrgService implements IOrgService { /** * 创建非顶级组织 */ - private Org createNonTopOrg(@NonNull String name, @NonNull Long parentId, @NonNull Long rootId, Long creatorId) { + private Org createNonTopOrg(@NonNull String name, @NonNull Long parentId, @NonNull Long rootId, @NonNull Long creatorId) { //检查顶级组织 confirmIsTopOrg(rootId); //检查同级同名组织 diff --git a/src/main/java/club/joylink/rtss/services/org/OrgUserService.java b/src/main/java/club/joylink/rtss/services/org/OrgUserService.java index bc38edb31..2a13d51cf 100644 --- a/src/main/java/club/joylink/rtss/services/org/OrgUserService.java +++ b/src/main/java/club/joylink/rtss/services/org/OrgUserService.java @@ -80,13 +80,6 @@ public class OrgUserService implements IOrgUserService { // companyUserDAO.updateByExampleSelective(cu,e); // } - @Override - public boolean isCompanyUser(Long userId) { - OrgUserExample e = new OrgUserExample(); - e.createCriteria().andUserIdEqualTo(userId); - return orgUserDAO.countByExample(e) > 0; - } - //************************************部门管理********************************************** /** @@ -115,6 +108,7 @@ public class OrgUserService implements IOrgUserService { /** * 查询部门信息 + * * @param deptId */ @Override @@ -128,6 +122,7 @@ public class OrgUserService implements IOrgUserService { /** * 根据单位id查询部门及其子部门信息 + * * @param companyId */ @Override @@ -194,14 +189,6 @@ public class OrgUserService implements IOrgUserService { return ucrs.get(0); } - @Override - public List getDepartRefByUserId(Long userId) { - OrgUserExample e = new OrgUserExample(); - e.createCriteria().andUserIdEqualTo(userId).andRoleNotEqualTo(BusinessConsts.OrgRole.Admin.name()); - List departmentUserRefs = this.orgUserDAO.selectByExample(e); - return UserDepartRelVO.convert2VOList(departmentUserRefs); - } - /** * 添加部门-职位-用户关系 */ @@ -338,7 +325,8 @@ public class OrgUserService implements IOrgUserService { /** * 导入组织用户 - * @param topOrg 导入的组织所属的顶级组织 + * + * @param topOrg 导入的组织所属的顶级组织 * @param orgId * @param orgUserIdSet 导入的组织当前已有的成员 */ @@ -384,13 +372,6 @@ public class OrgUserService implements IOrgUserService { return DepartmentVO.convert2VOList(classes); } - @Override - public void deleteDepartsExam(Long examId) { - OrgExamExample example = new OrgExamExample(); - example.createCriteria().andExamIdEqualTo(examId); - orgExamDAO.deleteByExample(example); - } - //TODO 判是否存在 @Override public void addDepartExam(Long examId, Long departId) { @@ -451,7 +432,7 @@ public class OrgUserService implements IOrgUserService { * 该用户在该组织中是否是这个角色 */ @Override - public boolean isTheRoleInThisOrg(Long userId, Long orgId, BusinessConsts.OrgRole role) { + public boolean isTheRoleInThisOrg(@NonNull Long userId, @NonNull Long orgId, @NonNull BusinessConsts.OrgRole role) { OrgUserExample example = new OrgUserExample(); example.createCriteria() .andUserIdEqualTo(userId) diff --git a/src/main/java/club/joylink/rtss/services/training/ITrainingV1Service.java b/src/main/java/club/joylink/rtss/services/training/ITrainingV1Service.java index 960a71535..049964536 100644 --- a/src/main/java/club/joylink/rtss/services/training/ITrainingV1Service.java +++ b/src/main/java/club/joylink/rtss/services/training/ITrainingV1Service.java @@ -190,4 +190,10 @@ public interface ITrainingV1Service { List findEntities(Long mapId, String prdType); List findEntities(@NonNull Long mapId); + + /** + * 查询实训类型及其数量 + * @return + */ + Map> queryTrainingTypeAndQuantity(Long mapId, String prdType); } diff --git a/src/main/java/club/joylink/rtss/services/training/TrainingV1Service.java b/src/main/java/club/joylink/rtss/services/training/TrainingV1Service.java index 5ba070933..420b18616 100644 --- a/src/main/java/club/joylink/rtss/services/training/TrainingV1Service.java +++ b/src/main/java/club/joylink/rtss/services/training/TrainingV1Service.java @@ -36,11 +36,12 @@ import org.springframework.util.StringUtils; import java.time.LocalDateTime; import java.util.*; +import java.util.stream.Collectors; /** * 实训 服务 - * @author sheng * + * @author sheng */ @Service @Slf4j @@ -207,7 +208,7 @@ public class TrainingV1Service implements ITrainingV1Service { public void nextStep(Long id, String group, TrainingStepVO step) { Assert.hasText(group, "group不能为空!"); TrainingNewVO trainingVO = this.groupTrainingDataCache.getTrainingByGroup(group); - if(Objects.nonNull(trainingVO)) { + if (Objects.nonNull(trainingVO)) { trainingVO.nextStep(step); } } @@ -218,7 +219,7 @@ public class TrainingV1Service implements ITrainingV1Service { Assert.hasText(group, "group不能为空!"); int time = Integer.parseInt(usedTime); TrainingResultVO result = this.score(group, mode, time); - if(lessonId != 0) { + if (lessonId != 0) { // 不是从演示进入,保存数据,用于统计 UserTrainingStats userTraining = new UserTrainingStats(); userTraining.setUserId(userVO.getId()); @@ -239,11 +240,11 @@ public class TrainingV1Service implements ITrainingV1Service { private TrainingResultVO score(String group, String mode, int usedTime) { TrainingNewVO training = this.groupTrainingDataCache.getTrainingByGroup(group); - if(this.isOperateCorrect(training)) { + if (this.isOperateCorrect(training)) { // 测验/考试模式 - if(mode.equals(BusinessConsts.Training.Mode.Mode04) || mode.equals(BusinessConsts.Training.Mode.Mode05)) { + if (mode.equals(BusinessConsts.Training.Mode.Mode04) || mode.equals(BusinessConsts.Training.Mode.Mode05)) { float score = 0f; - if(training.getMaxDuration() >= usedTime) { + if (training.getMaxDuration() >= usedTime) { score = calculateScore(training, usedTime, 5L, false); return new TrainingResultVO(true, score); } @@ -256,18 +257,19 @@ public class TrainingV1Service implements ITrainingV1Service { /** * 实训操作是否正确 + * * @return */ private boolean isOperateCorrect(TrainingNewVO training) { List steps = training.getSteps(); List actualSteps = training.getActualSteps(); boolean correct = true; - if(!CollectionUtils.isEmpty(steps) && !CollectionUtils.isEmpty(actualSteps) + if (!CollectionUtils.isEmpty(steps) && !CollectionUtils.isEmpty(actualSteps) && steps.size() == actualSteps.size()) { - for(int i=0; i= 5) { + } else { + score = (current.getMaxDuration() - usedTime + 1) * point / (current.getMaxDuration() - current.getMinDuration() + 1); + if (isFloat) { + long mod = (current.getMaxDuration() - usedTime + 1) * point % (current.getMaxDuration() - current.getMinDuration() + 1); + if (mod >= 5) { score += 0.5f; } } @@ -408,16 +411,16 @@ public class TrainingV1Service implements ITrainingV1Service { public TrainingResultVO judgeAndCalculate(Long id, String group, String mode, int usedTime, long point, boolean isFloat) { TrainingNewVO current = this.groupTrainingDataCache.getTrainingByGroup(group); - if(isOperateCorrect(current)) { + if (isOperateCorrect(current)) { // 测验/考试模式 - if(mode.equals(BusinessConsts.Training.Mode.Mode04) || mode.equals(BusinessConsts.Training.Mode.Mode05)) { + if (mode.equals(BusinessConsts.Training.Mode.Mode04) || mode.equals(BusinessConsts.Training.Mode.Mode05)) { float score = 0f; - if(current.getMaxDuration() >= usedTime) { + if (current.getMaxDuration() >= usedTime) { score = calculateScore(current, usedTime, point, isFloat); - }else{ + } else { return new TrainingResultVO(false, BusinessConsts.Exam.QuestionCause.OVERTIME); } - if(score == point ){ + if (score == point) { return new TrainingResultVO(true, score, BusinessConsts.Exam.QuestionCause.PERFECT); } return new TrainingResultVO(true, score, BusinessConsts.Exam.QuestionCause.CORRECT); @@ -431,7 +434,7 @@ public class TrainingV1Service implements ITrainingV1Service { @Override @Transactional public void batchSaveAutoGenerateTrainings(List trainingVOList) { - if(!CollectionUtils.isEmpty(trainingVOList)) { + if (!CollectionUtils.isEmpty(trainingVOList)) { LocalDateTime now = LocalDateTime.now(); Long userId = UserVO.system().getId(); List list = new ArrayList<>(); @@ -444,12 +447,12 @@ public class TrainingV1Service implements ITrainingV1Service { training.setScenes(JsonUtils.writeValueAsString(trainingVO.getScenes())); list.add(training); //防止数据包溢出 - if(list.size()>5){ + if (list.size() > 5) { trainingDAO.batchInsert(list); list.clear(); } }); - if(list.size()>0){ + if (list.size() > 0) { trainingDAO.batchInsert(list); } } @@ -485,19 +488,20 @@ public class TrainingV1Service implements ITrainingV1Service { @Override public void deleteAutoGenerateTrainingBy(Long mapId) { - TrainingExample example = new TrainingExample(); - example.createCriteria().andMapIdEqualTo(mapId); - List ids = this.trainingDAO.selectIdsByExample(example); - this.batchDeleteTrainingAndReferenceData(ids); + TrainingExample example = new TrainingExample(); + example.createCriteria().andMapIdEqualTo(mapId); + List ids = this.trainingDAO.selectIdsByExample(example); + this.batchDeleteTrainingAndReferenceData(ids); } /** * 批量删除实训 + * * @param ids */ @Transactional public void batchDeleteTrainingAndReferenceData(List ids) { - if(!CollectionUtils.isEmpty(ids)) { + if (!CollectionUtils.isEmpty(ids)) { // 删除实训=章节关系 this.iLessonDraftService.deleteChapterRelByTrainingIdList(ids); this.iLessonService.deleteChapterRelByTrainingIdList(ids); @@ -519,17 +523,17 @@ public class TrainingV1Service implements ITrainingV1Service { Integer maxDuration = config.getMaxDuration(); String remarks = config.getRemarks(); TrainingWithBLOBs update = new TrainingWithBLOBs(); - if((Objects.nonNull(minDuration) - || Objects.nonNull(maxDuration) - || StringUtils.hasText(remarks)) + if ((Objects.nonNull(minDuration) + || Objects.nonNull(maxDuration) + || StringUtils.hasText(remarks)) && !CollectionUtils.isEmpty(config.getOperateType())) { - if(Objects.nonNull(minDuration)) { + if (Objects.nonNull(minDuration)) { update.setMinDuration(minDuration); } - if(Objects.nonNull(maxDuration)) { + if (Objects.nonNull(maxDuration)) { update.setMaxDuration(maxDuration); } - if(StringUtils.hasText(remarks)) { + if (StringUtils.hasText(remarks)) { update.setRemarks(remarks); } config.getOperateType().forEach(operateType -> { @@ -567,7 +571,7 @@ public class TrainingV1Service implements ITrainingV1Service { .andMapIdEqualTo(sourceMapId); List trainings = this.trainingDAO.selectByExampleWithBLOBs(example); Map relMap = new HashMap<>(); - if(!CollectionUtils.isEmpty(trainings)) { + if (!CollectionUtils.isEmpty(trainings)) { trainings.forEach(training -> { Long oldId = training.getId(); training.setId(null); @@ -582,6 +586,7 @@ public class TrainingV1Service implements ITrainingV1Service { /** * 删除实训-关联删除 + * * @param training */ @Transactional @@ -603,6 +608,7 @@ public class TrainingV1Service implements ITrainingV1Service { /** * 根据实训id删除用户实训记录 + * * @param trainingId */ private void deleteUserTrainingRecordByTrainingId(Long trainingId) { @@ -613,6 +619,7 @@ public class TrainingV1Service implements ITrainingV1Service { /** * 根据实训id列表删除用户实训记录 + * * @param trainingIdList */ private void deleteUserTrainingRecordByTrainingIds(List trainingIdList) { @@ -624,39 +631,39 @@ public class TrainingV1Service implements ITrainingV1Service { @Override public PageVO pagedQueryTrainings(TrainingQueryVO trainingQueryVO) { MapInfo mapInfo = null; - if (!ObjectUtils.isEmpty(trainingQueryVO.getMapId())){ + if (!ObjectUtils.isEmpty(trainingQueryVO.getMapId())) { mapInfo = mapInfoDAO.selectByPrimaryKey(trainingQueryVO.getMapId()); } PageHelper.startPage(trainingQueryVO.getPageNum(), trainingQueryVO.getPageSize()); TrainingExample example = new TrainingExample(); example.setOrderByClause("id desc"); TrainingExample.Criteria criteria = example.createCriteria(); - if(StringUtils.hasText(trainingQueryVO.getName())) { + if (StringUtils.hasText(trainingQueryVO.getName())) { criteria.andNameLike(String.format("%%%s%%", trainingQueryVO.getName())); } - if(StringUtils.hasText(trainingQueryVO.getGenerateType())) { - if(BusinessConsts.Training.GenerateType.GenerateType01.equals(trainingQueryVO.getGenerateType())) { + if (StringUtils.hasText(trainingQueryVO.getGenerateType())) { + if (BusinessConsts.Training.GenerateType.GenerateType01.equals(trainingQueryVO.getGenerateType())) { criteria.andAuthorIdEqualTo(UserVO.system().getId()); - }else if(BusinessConsts.Training.GenerateType.GenerateType02.equals(trainingQueryVO.getGenerateType())) { + } else if (BusinessConsts.Training.GenerateType.GenerateType02.equals(trainingQueryVO.getGenerateType())) { criteria.andAuthorIdNotEqualTo(UserVO.system().getId()); } } // if(StringUtils.hasText(trainingQueryVO.getSkinCode())) { // criteria.andSkinCodeEqualTo(trainingQueryVO.getSkinCode()); // } - if (!ObjectUtils.isEmpty(mapInfo)){ + if (!ObjectUtils.isEmpty(mapInfo)) { criteria.andMapIdEqualTo(mapInfo.getId()); } - if(StringUtils.hasText(trainingQueryVO.getPrdType())) { + if (StringUtils.hasText(trainingQueryVO.getPrdType())) { criteria.andPrdTypeEqualTo(trainingQueryVO.getPrdType()); } - if(StringUtils.hasText(trainingQueryVO.getType())) { + if (StringUtils.hasText(trainingQueryVO.getType())) { criteria.andTypeEqualTo(trainingQueryVO.getType()); } - if(StringUtils.hasText(trainingQueryVO.getOperateType())) { + if (StringUtils.hasText(trainingQueryVO.getOperateType())) { criteria.andOperateTypeEqualTo(trainingQueryVO.getOperateType()); } - if(StringUtils.hasText(trainingQueryVO.getStatus())) { + if (StringUtils.hasText(trainingQueryVO.getStatus())) { criteria.andStatusEqualTo(trainingQueryVO.getStatus()); } Page trainings = (Page) this.trainingDAO.selectByExample(example); @@ -690,9 +697,12 @@ public class TrainingV1Service implements ITrainingV1Service { } @Override - public List findEntities(@NonNull Long mapId, @NonNull String prdType) { + public List findEntities(@NonNull Long mapId, String prdType) { TrainingExample example = new TrainingExample(); - example.createCriteria().andMapIdEqualTo(mapId).andPrdTypeEqualTo(prdType); + TrainingExample.Criteria criteria = example.createCriteria().andMapIdEqualTo(mapId); + if (StringUtils.hasText(prdType)) { + criteria.andPrdTypeEqualTo(prdType); + } return trainingDAO.selectByExample(example); } @@ -702,4 +712,13 @@ public class TrainingV1Service implements ITrainingV1Service { example.createCriteria().andMapIdEqualTo(mapId); return trainingDAO.selectByExample(example); } + + @Override + public Map> queryTrainingTypeAndQuantity(Long mapId, String prdType) { + List trainings = findEntities(mapId, prdType); + return trainings.stream().collect( + Collectors.groupingBy(Training::getType, + Collectors.groupingBy(Training::getOperateType, + Collectors.counting()))); + } } diff --git a/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java b/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java index 3794c4d5e..1f4e8a5cf 100644 --- a/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java @@ -5,7 +5,6 @@ import club.joylink.rtss.entity.SysUser; import club.joylink.rtss.vo.client.org.DepartmentVO; import club.joylink.rtss.vo.client.validGroup.ExamDefinitionCheck; import club.joylink.rtss.vo.client.validGroup.ExamDefinitionRulesCheck; -import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; @@ -13,13 +12,13 @@ import io.swagger.annotations.ApiModel; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.springframework.format.annotation.DateTimeFormat; import springfox.documentation.annotations.ApiIgnore; import javax.validation.Valid; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import javax.validation.groups.Default; import java.time.LocalDateTime; import java.util.List; @@ -34,41 +33,39 @@ public class ExamDefinitionVO { /** * 所属课程ID */ - @NotNull(message = "课程ID不能为空", groups = {ExamDefinitionCheck.class}) private Long lessonId; private String lessonName; + @NotNull(message = "地图id不能为空") + private Long mapId; + /** * 考试名称 */ - @NotBlank(message = "考试名称不能为空", groups = {ExamDefinitionCheck.class}) + @NotBlank(message = "考试名称不能为空", groups = {Default.class, ExamDefinitionCheck.class}) private String name; /** * 考试类型:数据字典值 */ @NotBlank(message = "考试类型不能为空") - private String type; + private String prdType; /** * 考试时长:单位s */ - @Min(value = 1, groups = {ExamDefinitionCheck.class}) + @Min(value = 1, groups = {Default.class, ExamDefinitionCheck.class}) private Integer duration; /** * 考试开始时间 */ - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; /** * 考试结束时间 */ - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endTime; /** @@ -140,8 +137,9 @@ public class ExamDefinitionVO { public ExamDefinitionVO(ExamDefinition examDefinition) { this.id = examDefinition.getId(); this.lessonId = examDefinition.getLessonId(); + this.mapId = examDefinition.getMapId(); this.name = examDefinition.getName(); - this.type = examDefinition.getType(); + this.prdType = examDefinition.getType(); this.duration = examDefinition.getDuration(); this.startTime = examDefinition.getStartTime(); this.endTime = examDefinition.getEndTime(); @@ -163,17 +161,15 @@ public class ExamDefinitionVO { public ExamDefinition toDB() { ExamDefinition definition = new ExamDefinition(); definition.setLessonId(this.getLessonId()); + definition.setMapId(this.mapId); definition.setName(this.getName()); - definition.setType(this.getType()); + definition.setType(this.getPrdType()); definition.setDuration(this.getDuration()); definition.setStartTime(this.getStartTime()); definition.setEndTime(this.getEndTime()); definition.setFullPoint(this.getFullPoint()); definition.setPassingPoint(this.getPassingPoint()); - definition.setCreatorId(this.getCreatorId()); - definition.setCreateTime(this.getCreateTime()); definition.setRemarks(this.getRemarks()); - definition.setStatus(this.getStatus()); return definition; } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/MapVO.java b/src/main/java/club/joylink/rtss/vo/client/map/MapVO.java index 6f6e834e9..4e37acdb7 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/MapVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/MapVO.java @@ -18,6 +18,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.time.LocalDate; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -131,7 +132,7 @@ public class MapVO { if (!CollectionUtils.isEmpty(list)) { return list.stream().map(MapVO::new).collect(Collectors.toList()); } - return null; + return new ArrayList<>(); } diff --git a/src/main/java/club/joylink/rtss/vo/client/org/DepartmentVO.java b/src/main/java/club/joylink/rtss/vo/client/org/DepartmentVO.java index 99a729444..9c553e022 100644 --- a/src/main/java/club/joylink/rtss/vo/client/org/DepartmentVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/org/DepartmentVO.java @@ -74,9 +74,11 @@ public class DepartmentVO { public DepartmentVO(Org entity, Integer numberOfPeople, SysUser creator) { this(entity, numberOfPeople); - this.creatorId = creator.getId(); - this.creatorName = creator.getName(); - this.creatorNickName = creator.getNickname(); + if (creator != null) { + this.creatorId = creator.getId(); + this.creatorName = creator.getName(); + this.creatorNickName = creator.getNickname(); + } } public static List convert2VOList(List dataList) { diff --git a/src/main/resources/mybatis/mapper/ExamDefinitionDAO.xml b/src/main/resources/mybatis/mapper/ExamDefinitionDAO.xml index f47e4b600..7ff1fba62 100644 --- a/src/main/resources/mybatis/mapper/ExamDefinitionDAO.xml +++ b/src/main/resources/mybatis/mapper/ExamDefinitionDAO.xml @@ -3,6 +3,7 @@ + @@ -15,7 +16,7 @@ - + @@ -76,8 +77,8 @@ - id, lesson_id, `name`, `type`, duration, start_time, end_time, full_point, passing_point, - creator_id, create_time, remarks, `status`, trial + id, map_id, lesson_id, `name`, `type`, duration, start_time, end_time, full_point, + passing_point, creator_id, create_time, remarks, `status`, trial select @@ -88,17 +91,29 @@ + + + delete from org_exam + where id = #{id,jdbcType=BIGINT} + delete from org_exam - - insert into org_exam (exam_id, org_id) - values (#{examId,jdbcType=BIGINT}, #{orgId,jdbcType=INTEGER}) + + insert into org_exam (exam_id, org_id, creator_id, + create_time) + values (#{examId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT}, #{creatorId,jdbcType=BIGINT}, + #{createTime,jdbcType=TIMESTAMP}) - + insert into org_exam @@ -107,13 +122,25 @@ org_id, + + creator_id, + + + create_time, + #{examId,jdbcType=BIGINT}, - #{orgId,jdbcType=INTEGER}, + #{orgId,jdbcType=BIGINT}, + + + #{creatorId,jdbcType=BIGINT}, + + + #{createTime,jdbcType=TIMESTAMP}, @@ -126,11 +153,20 @@ update org_exam + + id = #{record.id,jdbcType=BIGINT}, + exam_id = #{record.examId,jdbcType=BIGINT}, - org_id = #{record.orgId,jdbcType=INTEGER}, + org_id = #{record.orgId,jdbcType=BIGINT}, + + + creator_id = #{record.creatorId,jdbcType=BIGINT}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, @@ -139,10 +175,39 @@ update org_exam - set exam_id = #{record.examId,jdbcType=BIGINT}, - org_id = #{record.orgId,jdbcType=INTEGER} + set id = #{record.id,jdbcType=BIGINT}, + exam_id = #{record.examId,jdbcType=BIGINT}, + org_id = #{record.orgId,jdbcType=BIGINT}, + creator_id = #{record.creatorId,jdbcType=BIGINT}, + create_time = #{record.createTime,jdbcType=TIMESTAMP} + + update org_exam + + + exam_id = #{examId,jdbcType=BIGINT}, + + + org_id = #{orgId,jdbcType=BIGINT}, + + + creator_id = #{creatorId,jdbcType=BIGINT}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=BIGINT} + + + update org_exam + set exam_id = #{examId,jdbcType=BIGINT}, + org_id = #{orgId,jdbcType=BIGINT}, + creator_id = #{creatorId,jdbcType=BIGINT}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + \ No newline at end of file