暂时提交
This commit is contained in:
parent
4801d11b3b
commit
5167575dde
17
sql/20210326-zhangsai.sql
Normal file
17
sql/20210326-zhangsai.sql
Normal file
@ -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`);
|
||||
|
||||
|
||||
|
@ -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<DepartmentVO> pagedQuerySelfCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iOrgService.pagedQueryCls(queryVO, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation("查询班级")
|
||||
@ApiOperation("查询当前登录项目所属组织下的班级")
|
||||
@GetMapping("/list/cls")
|
||||
public List<DepartmentVO> querySelfCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
public List<DepartmentVO> queryCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iOrgService.queryCls(queryVO, loginInfo);
|
||||
}
|
||||
|
||||
@ -257,4 +257,11 @@ public class OrgController {
|
||||
public PageVO<DepartmentVO> adminPagedQueryOrg(OrgQueryVO queryVO) {
|
||||
return iOrgService.adminPagedQueryOrg(queryVO);
|
||||
}
|
||||
|
||||
@ApiOperation("给班级安排考试")
|
||||
@PostMapping("/orgExam/{clsId}")
|
||||
public void createOrgExam(@PathVariable Long clsId, @RequestBody List<Long> examIds, @RequestAttribute UserVO user) {
|
||||
iOrgExamService.create(clsId, examIds, user);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<String> 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) {
|
||||
|
@ -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<String, Map<String, Long>> queryTrainingTypeAndQuantity(Long mapId, String prdType) {
|
||||
return iTrainingService.queryTrainingTypeAndQuantity(mapId, prdType);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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<Long> values) {
|
||||
addCriterion("map_id in", values, "mapId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapIdNotIn(List<Long> 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;
|
||||
|
@ -1,18 +1,33 @@
|
||||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* org_exam
|
||||
* @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,8 +97,11 @@ 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();
|
||||
|
@ -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<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Long> 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<Integer> values) {
|
||||
public Criteria andOrgIdIn(List<Long> values) {
|
||||
addCriterion("org_id in", values, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotIn(List<Integer> values) {
|
||||
public Criteria andOrgIdNotIn(List<Long> 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<Long> values) {
|
||||
addCriterion("creator_id in", values, "creatorId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorIdNotIn(List<Long> 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<LocalDateTime> values) {
|
||||
addCriterion("create_time in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotIn(List<LocalDateTime> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<ExamDefinitionRulesVO> 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<ExamDefinitionRulesVO> 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<ExamDefinition> 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<ExamDefinition> 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<ExamChapterInfoVO> queryChapterInfo(String lessonId) {
|
||||
// //返回的结果
|
||||
// List<ExamChapterInfoVO> examChapterInfoVOList = new ArrayList<>();
|
||||
//
|
||||
// //查询数据
|
||||
// List<Long> lessonIds = new ArrayList<>();
|
||||
// lessonIds.add(Long.valueOf(lessonId));
|
||||
// List<LessonChapterVO> 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<String> 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<Long> examIds = null;
|
||||
// List<UserDepartRelVO> 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<ExamDefinition> examDefinitionList = examDefinitionDAO.selectByExample(examDefinitionExample);
|
||||
// 检测试题是否有效
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Iterator<ExamDefinition> 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<ExamDefinitionVO> 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<LsRelChapterTraining> 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<ExamDefinition> 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<ExamDefinition> 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<ExamDefinitionRules> 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<ExamDefinitionVO> pagedQueryByLoginProject(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
List<Long> lessonIds;
|
||||
if (queryVO.getLessonId() != null) {
|
||||
lessonIds = List.of(queryVO.getLessonId());
|
||||
} else {
|
||||
List<LessonVO> 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<OrgLesson> orgLessons = iOrgLessonService.findEntitiesByLessonIds(lessonIds);
|
||||
Map<Long, List<Long>> 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<Long> 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<ExamDefinition> page = (Page<ExamDefinition>) examDefinitionDAO.selectByExample(example);
|
||||
Map<Long, SysUser> creatorMap = iSysUserService.findEntity(page.stream().map(ExamDefinition::getCreatorId).collect(Collectors.toList()), null)
|
||||
.stream().collect(Collectors.toMap(SysUser::getId, Function.identity()));
|
||||
List<ExamDefinitionVO> 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<ExamDefinitionVO> empty = new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
|
||||
List<Long> creatorIds = null;
|
||||
Map<Long, UserVO> creatorMap = null;
|
||||
if (StringUtils.hasText(queryVO.getCreatorName())) {
|
||||
iSysUserService.
|
||||
List<UserVO> creators = iSysUserService.findUserByName(queryVO.getCreatorName());
|
||||
if (CollectionUtils.isEmpty(creators))
|
||||
return empty;
|
||||
creatorIds = creators.stream().map(UserVO::getId).collect(Collectors.toList());
|
||||
}
|
||||
List<Long> 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<ExamDefinition> 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<Org> clsList = iOrgService.findEntitiesByParentId(topOrg.getId(), "id", BusinessConsts.Org.Status.VALID);
|
||||
List<Long> 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());
|
||||
}
|
||||
|
@ -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);
|
||||
/**
|
||||
* 根据课程和实训类型查询实训数量
|
||||
*/
|
||||
|
@ -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<MapInfo> list = mapInfoDAO.selectByExample(example);
|
||||
return MapVO.convert2VOList(list);
|
||||
}
|
||||
|
@ -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<Long> examIds, UserVO user);
|
||||
}
|
@ -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<DepartmentVO> getDepartAndChild(Long companyId, Long deptId);
|
||||
|
||||
List<UserDepartRelVO> getDepartRefByUserId(Long userId);
|
||||
|
||||
void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
|
||||
|
||||
void updateDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
|
||||
@ -52,8 +48,6 @@ public interface IOrgUserService {
|
||||
|
||||
List<DepartmentVO> getDepartsByExamId(Long examId);
|
||||
|
||||
void deleteDepartsExam(Long examId);
|
||||
|
||||
void addDepartExam(Long examId, Long departId);
|
||||
|
||||
List<OrgLesson> getDepartLessonRefs(Long departId);
|
||||
|
@ -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<Long> 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<OrgExam> 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);
|
||||
}
|
||||
}
|
@ -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<Org> findEntitiesByParentId(Long parentId, String orderBy, String status) {
|
||||
public List<Org> 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);
|
||||
//检查同级同名组织
|
||||
|
@ -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<UserDepartRelVO> getDepartRefByUserId(Long userId) {
|
||||
OrgUserExample e = new OrgUserExample();
|
||||
e.createCriteria().andUserIdEqualTo(userId).andRoleNotEqualTo(BusinessConsts.OrgRole.Admin.name());
|
||||
List<OrgUser> 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)
|
||||
|
@ -190,4 +190,10 @@ public interface ITrainingV1Service {
|
||||
List<Training> findEntities(Long mapId, String prdType);
|
||||
|
||||
List<Training> findEntities(@NonNull Long mapId);
|
||||
|
||||
/**
|
||||
* 查询实训类型及其数量
|
||||
* @return
|
||||
*/
|
||||
Map<String, Map<String, Long>> queryTrainingTypeAndQuantity(Long mapId, String prdType);
|
||||
}
|
||||
|
@ -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<TrainingStepVO> steps = training.getSteps();
|
||||
List<TrainingStepVO> 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<steps.size(); ++i) {
|
||||
for (int i = 0; i < steps.size(); ++i) {
|
||||
TrainingStepVO step = steps.get(i);
|
||||
TrainingStepVO actualStep = actualSteps.get(i);
|
||||
if(!step.isCorrect(actualStep)) {
|
||||
if (!step.isCorrect(actualStep)) {
|
||||
correct = false;
|
||||
break;
|
||||
}
|
||||
@ -375,19 +377,20 @@ public class TrainingV1Service implements ITrainingV1Service {
|
||||
|
||||
/**
|
||||
* 计算分数
|
||||
*
|
||||
* @param current
|
||||
* @param usedTime
|
||||
* @return
|
||||
*/
|
||||
private float calculateScore(TrainingNewVO current, int usedTime, long point, boolean isFloat) {
|
||||
float score = 0f;
|
||||
if(usedTime <= current.getMinDuration()) {
|
||||
if (usedTime <= current.getMinDuration()) {
|
||||
score = point;
|
||||
}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) {
|
||||
} 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<TrainingNewVO> trainingVOList) {
|
||||
if(!CollectionUtils.isEmpty(trainingVOList)) {
|
||||
if (!CollectionUtils.isEmpty(trainingVOList)) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Long userId = UserVO.system().getId();
|
||||
List<TrainingWithBLOBs> 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<Long> ids = this.trainingDAO.selectIdsByExample(example);
|
||||
this.batchDeleteTrainingAndReferenceData(ids);
|
||||
TrainingExample example = new TrainingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<Long> ids = this.trainingDAO.selectIdsByExample(example);
|
||||
this.batchDeleteTrainingAndReferenceData(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除实训
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
@Transactional
|
||||
public void batchDeleteTrainingAndReferenceData(List<Long> 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<TrainingWithBLOBs> trainings = this.trainingDAO.selectByExampleWithBLOBs(example);
|
||||
Map<Long, Long> 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<Long> trainingIdList) {
|
||||
@ -624,39 +631,39 @@ public class TrainingV1Service implements ITrainingV1Service {
|
||||
@Override
|
||||
public PageVO<TrainingNewVO> 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<Training> trainings = (Page<Training>) this.trainingDAO.selectByExample(example);
|
||||
@ -690,9 +697,12 @@ public class TrainingV1Service implements ITrainingV1Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Training> findEntities(@NonNull Long mapId, @NonNull String prdType) {
|
||||
public List<Training> 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<String, Map<String, Long>> queryTrainingTypeAndQuantity(Long mapId, String prdType) {
|
||||
List<Training> trainings = findEntities(mapId, prdType);
|
||||
return trainings.stream().collect(
|
||||
Collectors.groupingBy(Training::getType,
|
||||
Collectors.groupingBy(Training::getOperateType,
|
||||
Collectors.counting())));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<DepartmentVO> convert2VOList(List<Org> dataList) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
<mapper namespace="club.joylink.rtss.dao.ExamDefinitionDAO">
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.ExamDefinition">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="map_id" jdbcType="BIGINT" property="mapId" />
|
||||
<result column="lesson_id" jdbcType="BIGINT" property="lessonId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
@ -15,7 +16,7 @@
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="trial" jdbcType="BIT" property="trial" />
|
||||
<result column="trial" jdbcType="TINYINT" property="trial" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -76,8 +77,8 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
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
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.ExamDefinitionExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -118,20 +119,23 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.ExamDefinition" useGeneratedKeys="true">
|
||||
insert into exam_definition (lesson_id, `name`, `type`,
|
||||
duration, start_time, end_time,
|
||||
full_point, passing_point, creator_id,
|
||||
create_time, remarks, `status`,
|
||||
trial)
|
||||
values (#{lessonId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||
#{duration,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
|
||||
#{fullPoint,jdbcType=INTEGER}, #{passingPoint,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{trial,jdbcType=BIT})
|
||||
insert into exam_definition (map_id, lesson_id, `name`,
|
||||
`type`, duration, start_time,
|
||||
end_time, full_point, passing_point,
|
||||
creator_id, create_time, remarks,
|
||||
`status`, trial)
|
||||
values (#{mapId,jdbcType=BIGINT}, #{lessonId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{duration,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
|
||||
#{endTime,jdbcType=TIMESTAMP}, #{fullPoint,jdbcType=INTEGER}, #{passingPoint,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{trial,jdbcType=TINYINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.ExamDefinition" useGeneratedKeys="true">
|
||||
insert into exam_definition
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="mapId != null">
|
||||
map_id,
|
||||
</if>
|
||||
<if test="lessonId != null">
|
||||
lesson_id,
|
||||
</if>
|
||||
@ -173,6 +177,9 @@
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mapId != null">
|
||||
#{mapId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="lessonId != null">
|
||||
#{lessonId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -210,7 +217,7 @@
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="trial != null">
|
||||
#{trial,jdbcType=BIT},
|
||||
#{trial,jdbcType=TINYINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@ -226,6 +233,9 @@
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.mapId != null">
|
||||
map_id = #{record.mapId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.lessonId != null">
|
||||
lesson_id = #{record.lessonId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -263,7 +273,7 @@
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.trial != null">
|
||||
trial = #{record.trial,jdbcType=BIT},
|
||||
trial = #{record.trial,jdbcType=TINYINT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
@ -273,6 +283,7 @@
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update exam_definition
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
map_id = #{record.mapId,jdbcType=BIGINT},
|
||||
lesson_id = #{record.lessonId,jdbcType=BIGINT},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
@ -285,7 +296,7 @@
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
remarks = #{record.remarks,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
trial = #{record.trial,jdbcType=BIT}
|
||||
trial = #{record.trial,jdbcType=TINYINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -293,6 +304,9 @@
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.ExamDefinition">
|
||||
update exam_definition
|
||||
<set>
|
||||
<if test="mapId != null">
|
||||
map_id = #{mapId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="lessonId != null">
|
||||
lesson_id = #{lessonId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -330,14 +344,15 @@
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="trial != null">
|
||||
trial = #{trial,jdbcType=BIT},
|
||||
trial = #{trial,jdbcType=TINYINT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.ExamDefinition">
|
||||
update exam_definition
|
||||
set lesson_id = #{lessonId,jdbcType=BIGINT},
|
||||
set map_id = #{mapId,jdbcType=BIGINT},
|
||||
lesson_id = #{lessonId,jdbcType=BIGINT},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
duration = #{duration,jdbcType=INTEGER},
|
||||
@ -349,7 +364,7 @@
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
remarks = #{remarks,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
trial = #{trial,jdbcType=BIT}
|
||||
trial = #{trial,jdbcType=TINYINT}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
@ -2,8 +2,11 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="club.joylink.rtss.dao.OrgExamDAO">
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.OrgExam">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="exam_id" jdbcType="BIGINT" property="examId" />
|
||||
<result column="org_id" jdbcType="INTEGER" property="orgId" />
|
||||
<result column="org_id" jdbcType="BIGINT" property="orgId" />
|
||||
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -64,7 +67,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
exam_id, org_id
|
||||
id, exam_id, org_id, creator_id, create_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.OrgExamExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -88,17 +91,29 @@
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from org_exam
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from org_exam
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.OrgExamExample">
|
||||
delete from org_exam
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="club.joylink.rtss.entity.OrgExam">
|
||||
insert into org_exam (exam_id, org_id)
|
||||
values (#{examId,jdbcType=BIGINT}, #{orgId,jdbcType=INTEGER})
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.OrgExam" useGeneratedKeys="true">
|
||||
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>
|
||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.OrgExam">
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.OrgExam" useGeneratedKeys="true">
|
||||
insert into org_exam
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="examId != null">
|
||||
@ -107,13 +122,25 @@
|
||||
<if test="orgId != null">
|
||||
org_id,
|
||||
</if>
|
||||
<if test="creatorId != null">
|
||||
creator_id,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="examId != null">
|
||||
#{examId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
#{orgId,jdbcType=INTEGER},
|
||||
#{orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="creatorId != null">
|
||||
#{creatorId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@ -126,11 +153,20 @@
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update org_exam
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.examId != null">
|
||||
exam_id = #{record.examId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.orgId != null">
|
||||
org_id = #{record.orgId,jdbcType=INTEGER},
|
||||
org_id = #{record.orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.creatorId != null">
|
||||
creator_id = #{record.creatorId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
@ -139,10 +175,39 @@
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
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}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.OrgExam">
|
||||
update org_exam
|
||||
<set>
|
||||
<if test="examId != null">
|
||||
exam_id = #{examId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
org_id = #{orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="creatorId != null">
|
||||
creator_id = #{creatorId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.OrgExam">
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user