Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2

This commit is contained in:
weizhihong 2022-09-28 16:32:58 +08:00
commit 63f23cf14e
31 changed files with 672 additions and 263 deletions

View File

@ -1,7 +1,9 @@
package club.joylink.rtss.controller.paper; package club.joylink.rtss.controller.paper;
import club.joylink.rtss.services.paper.PaperUserCreateService; import club.joylink.rtss.services.paper.PaperUserCreateService;
import club.joylink.rtss.services.paper.PaperUserLoadQuestionService;
import club.joylink.rtss.services.paper.PaperUserService; import club.joylink.rtss.services.paper.PaperUserService;
import club.joylink.rtss.services.paper.PaperUserSubmitAnswerService;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.paper.*; import club.joylink.rtss.vo.paper.*;
@ -20,6 +22,10 @@ public class PaperUserController {
private PaperUserService paperUserService; private PaperUserService paperUserService;
@Autowired @Autowired
private PaperUserCreateService paperUserCreateService; private PaperUserCreateService paperUserCreateService;
@Autowired
private PaperUserLoadQuestionService paperUserLoadQuestionService;
@Autowired
private PaperUserSubmitAnswerService paperUserSubmitAnswerService;
/** /**
* 根据试卷蓝图生成用户的试卷 * 根据试卷蓝图生成用户的试卷
@ -71,7 +77,7 @@ public class PaperUserController {
public PaperQuestionLoadRspVo loadQuestion(@PathVariable("groupType") Integer groupType, @PathVariable("qId") Long qId, @RequestAttribute AccountVO user) { public PaperQuestionLoadRspVo loadQuestion(@PathVariable("groupType") Integer groupType, @PathVariable("qId") Long qId, @RequestAttribute AccountVO user) {
PaperQType.GroupType pgType = PaperQType.GroupType.getItem(groupType); PaperQType.GroupType pgType = PaperQType.GroupType.getItem(groupType);
return null; return this.paperUserLoadQuestionService.loadQuestion(pgType, qId, user);
} }
/** /**
@ -79,8 +85,7 @@ public class PaperUserController {
*/ */
@PostMapping("/user/question/answer") @PostMapping("/user/question/answer")
public PaperSubmitAnswerRspVo submitAnswer(@RequestBody PaperSubmitAnswerReqVo req, @RequestAttribute AccountVO user) { public PaperSubmitAnswerRspVo submitAnswer(@RequestBody PaperSubmitAnswerReqVo req, @RequestAttribute AccountVO user) {
return this.paperUserSubmitAnswerService.submitAnswer(req, user);
return null;
} }
/** /**

View File

@ -31,4 +31,4 @@ public interface PaperCompositionDAO {
int updateByPrimaryKeySelective(PaperComposition record); int updateByPrimaryKeySelective(PaperComposition record);
int updateByPrimaryKey(PaperComposition record); int updateByPrimaryKey(PaperComposition record);
} }

View File

@ -5,8 +5,8 @@ import java.time.LocalDateTime;
import lombok.Data; import lombok.Data;
/** /**
* @author * @author
* *
*/ */
@Data @Data
public class PaperComposition implements Serializable { public class PaperComposition implements Serializable {
@ -26,9 +26,9 @@ public class PaperComposition implements Serializable {
private String profile; private String profile;
/** /**
* 项目code * 组织id
*/ */
private String projectCode; private String companyId;
/** /**
* 启用起始时间 * 启用起始时间
@ -66,9 +66,9 @@ public class PaperComposition implements Serializable {
private LocalDateTime updateTime; private LocalDateTime updateTime;
/** /**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除) * 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)定于见PaperCompositionState
*/ */
private Integer state; private Integer state;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -325,73 +325,73 @@ public class PaperCompositionExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIsNull() { public Criteria andCompanyIdIsNull() {
addCriterion("project_code is null"); addCriterion("company_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIsNotNull() { public Criteria andCompanyIdIsNotNull() {
addCriterion("project_code is not null"); addCriterion("company_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeEqualTo(String value) { public Criteria andCompanyIdEqualTo(String value) {
addCriterion("project_code =", value, "projectCode"); addCriterion("company_id =", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotEqualTo(String value) { public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode"); addCriterion("company_id <>", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeGreaterThan(String value) { public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode"); addCriterion("company_id >", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) { public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode"); addCriterion("company_id >=", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLessThan(String value) { public Criteria andCompanyIdLessThan(String value) {
addCriterion("project_code <", value, "projectCode"); addCriterion("company_id <", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLessThanOrEqualTo(String value) { public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode"); addCriterion("company_id <=", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLike(String value) { public Criteria andCompanyIdLike(String value) {
addCriterion("project_code like", value, "projectCode"); addCriterion("company_id like", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotLike(String value) { public Criteria andCompanyIdNotLike(String value) {
addCriterion("project_code not like", value, "projectCode"); addCriterion("company_id not like", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIn(List<String> values) { public Criteria andCompanyIdIn(List<String> values) {
addCriterion("project_code in", values, "projectCode"); addCriterion("company_id in", values, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotIn(List<String> values) { public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode"); addCriterion("company_id not in", values, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeBetween(String value1, String value2) { public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode"); addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotBetween(String value1, String value2) { public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode"); addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this; return (Criteria) this;
} }
@ -970,4 +970,4 @@ public class PaperCompositionExample {
this(condition, value, secondValue, null); this(condition, value, secondValue, null);
} }
} }
} }

View File

@ -30,7 +30,7 @@ public class PaperRule implements Serializable {
private Integer subtype; private Integer subtype;
/** /**
* 筛选题目的标签即根据标签来筛选题目 * 筛选题目的标签即根据标签来筛选题目;List<String>的json
*/ */
private String tags; private String tags;

View File

@ -26,9 +26,9 @@ public class PaperUser implements Serializable {
private Long pcId; private Long pcId;
/** /**
* 项目code * 组织id
*/ */
private String projectCode; private String companyId;
/** /**
* 用户最终得分 * 用户最终得分

View File

@ -305,73 +305,73 @@ public class PaperUserExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIsNull() { public Criteria andCompanyIdIsNull() {
addCriterion("project_code is null"); addCriterion("company_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIsNotNull() { public Criteria andCompanyIdIsNotNull() {
addCriterion("project_code is not null"); addCriterion("company_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeEqualTo(String value) { public Criteria andCompanyIdEqualTo(String value) {
addCriterion("project_code =", value, "projectCode"); addCriterion("company_id =", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotEqualTo(String value) { public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode"); addCriterion("company_id <>", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeGreaterThan(String value) { public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode"); addCriterion("company_id >", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) { public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode"); addCriterion("company_id >=", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLessThan(String value) { public Criteria andCompanyIdLessThan(String value) {
addCriterion("project_code <", value, "projectCode"); addCriterion("company_id <", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLessThanOrEqualTo(String value) { public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode"); addCriterion("company_id <=", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLike(String value) { public Criteria andCompanyIdLike(String value) {
addCriterion("project_code like", value, "projectCode"); addCriterion("company_id like", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotLike(String value) { public Criteria andCompanyIdNotLike(String value) {
addCriterion("project_code not like", value, "projectCode"); addCriterion("company_id not like", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIn(List<String> values) { public Criteria andCompanyIdIn(List<String> values) {
addCriterion("project_code in", values, "projectCode"); addCriterion("company_id in", values, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotIn(List<String> values) { public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode"); addCriterion("company_id not in", values, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeBetween(String value1, String value2) { public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode"); addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotBetween(String value1, String value2) { public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode"); addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -20,9 +20,9 @@ public class PaperUserQuestion implements Serializable {
private Long puId; private Long puId;
/** /**
* 项目code * 组织id
*/ */
private String projectCode; private String companyId;
/** /**
* 试题类型1-理论题2-实训题 * 试题类型1-理论题2-实训题

View File

@ -244,73 +244,73 @@ public class PaperUserQuestionExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIsNull() { public Criteria andCompanyIdIsNull() {
addCriterion("project_code is null"); addCriterion("company_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIsNotNull() { public Criteria andCompanyIdIsNotNull() {
addCriterion("project_code is not null"); addCriterion("company_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeEqualTo(String value) { public Criteria andCompanyIdEqualTo(String value) {
addCriterion("project_code =", value, "projectCode"); addCriterion("company_id =", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotEqualTo(String value) { public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode"); addCriterion("company_id <>", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeGreaterThan(String value) { public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode"); addCriterion("company_id >", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) { public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode"); addCriterion("company_id >=", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLessThan(String value) { public Criteria andCompanyIdLessThan(String value) {
addCriterion("project_code <", value, "projectCode"); addCriterion("company_id <", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLessThanOrEqualTo(String value) { public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode"); addCriterion("company_id <=", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeLike(String value) { public Criteria andCompanyIdLike(String value) {
addCriterion("project_code like", value, "projectCode"); addCriterion("company_id like", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotLike(String value) { public Criteria andCompanyIdNotLike(String value) {
addCriterion("project_code not like", value, "projectCode"); addCriterion("company_id not like", value, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeIn(List<String> values) { public Criteria andCompanyIdIn(List<String> values) {
addCriterion("project_code in", values, "projectCode"); addCriterion("company_id in", values, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotIn(List<String> values) { public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode"); addCriterion("company_id not in", values, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeBetween(String value1, String value2) { public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode"); addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectCodeNotBetween(String value1, String value2) { public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode"); addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -37,12 +37,12 @@ public class PaperCompositionService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CreatePaperCompositionRspVo createPaperComposition(CreatePaperCompositionReqVo req, AccountVO user) { public CreatePaperCompositionRspVo createPaperComposition(CreatePaperCompositionReqVo req, AccountVO user) {
//根据项目和名称来查如果存在则结束 //根据项目和名称来查如果存在则结束
List<PaperComposition> pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName()); List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:projectCode=" + req.getProjectCode() + " name=" + req.getName()); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:companyId=" + req.getCompanyId() + " name=" + req.getName());
// //
PaperComposition newPc = new PaperComposition(); PaperComposition newPc = new PaperComposition();
newPc.setName(req.getName()); newPc.setName(req.getName());
newPc.setProjectCode(req.getProjectCode()); newPc.setCompanyId(req.getCompanyId());
newPc.setProfile(req.getProfile()); newPc.setProfile(req.getProfile());
newPc.setCreateTime(LocalDateTime.now()); newPc.setCreateTime(LocalDateTime.now());
newPc.setUpdateTime(LocalDateTime.now()); newPc.setUpdateTime(LocalDateTime.now());
@ -51,14 +51,14 @@ public class PaperCompositionService {
int newRt = compositionDAO.insertSelective(newPc); int newRt = compositionDAO.insertSelective(newPc);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(newRt > 0, "存储试卷定义失败"); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(newRt > 0, "存储试卷定义失败");
// //
pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName()); pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
newPc = pcList.get(0); newPc = pcList.get(0);
// //
CreatePaperCompositionRspVo rsp = new CreatePaperCompositionRspVo(); CreatePaperCompositionRspVo rsp = new CreatePaperCompositionRspVo();
rsp.setId(newPc.getId()); rsp.setId(newPc.getId());
rsp.setName(newPc.getName()); rsp.setName(newPc.getName());
rsp.setProfile(newPc.getProfile()); rsp.setProfile(newPc.getProfile());
rsp.setProjectCode(newPc.getProjectCode()); rsp.setCompanyId(newPc.getCompanyId());
return rsp; return rsp;
} }
@ -70,17 +70,17 @@ public class PaperCompositionService {
PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId()); PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId());
assertPaperCompositionCanModify(curPc); assertPaperCompositionCanModify(curPc);
// //
List<PaperComposition> pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName()); List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
if (!CollectionUtils.isEmpty(pcList)) { if (!CollectionUtils.isEmpty(pcList)) {
boolean exist = pcList.stream().anyMatch(c -> { boolean exist = pcList.stream().anyMatch(c -> {
return c.getId().compareTo(curPc.getId()) != 0; return c.getId().compareTo(curPc.getId()) != 0;
}); });
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(exist, "试卷定义已经存在:projectCode=" + req.getProjectCode() + " name=" + req.getName()); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(exist, "试卷定义已经存在:companyId=" + req.getCompanyId() + " name=" + req.getName());
} }
// //
curPc.setName(req.getName()); curPc.setName(req.getName());
curPc.setProfile(req.getProfile()); curPc.setProfile(req.getProfile());
curPc.setProjectCode(req.getProjectCode()); curPc.setCompanyId(req.getCompanyId());
curPc.setUpdateTime(LocalDateTime.now()); curPc.setUpdateTime(LocalDateTime.now());
compositionDAO.updateByPrimaryKeySelective(curPc); compositionDAO.updateByPrimaryKeySelective(curPc);
} }
@ -193,11 +193,11 @@ public class PaperCompositionService {
pcExCriteria.andNameEqualTo(req.getName()); pcExCriteria.andNameEqualTo(req.getName());
} }
} }
if (null != req.getProjectCode()) { if (null != req.getCompanyId()) {
if (req.getProjectCodeLike()) { if (req.getProjectCodeLike()) {
pcExCriteria.andProjectCodeLike(req.getProjectCode()); pcExCriteria.andCompanyIdLike(String.format("%%%s%%",req.getCompanyId()));
} else { } else {
pcExCriteria.andProjectCodeEqualTo(req.getProjectCode()); pcExCriteria.andCompanyIdEqualTo(req.getCompanyId());
} }
} }
if (null != req.getProfile()) { if (null != req.getProfile()) {
@ -272,9 +272,9 @@ public class PaperCompositionService {
* 根据试卷蓝图的项目和名称查找项目 * 根据试卷蓝图的项目和名称查找项目
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<PaperComposition> findCompositionByProjectAndName(String projectCode, String name) { public List<PaperComposition> findCompositionByCompanyIdAndName(String companyId, String name) {
PaperCompositionExample example = new PaperCompositionExample(); PaperCompositionExample example = new PaperCompositionExample();
example.createCriteria().andProjectCodeEqualTo(projectCode).andNameEqualTo(name); example.createCriteria().andCompanyIdEqualTo(companyId).andNameEqualTo(name);
List<PaperComposition> list = compositionDAO.selectByExample(example); List<PaperComposition> list = compositionDAO.selectByExample(example);
return list; return list;
} }

View File

@ -5,17 +5,25 @@ import club.joylink.rtss.dao.paper.*;
import club.joylink.rtss.entity.paper.PaperComposition; import club.joylink.rtss.entity.paper.PaperComposition;
import club.joylink.rtss.entity.paper.PaperRule; import club.joylink.rtss.entity.paper.PaperRule;
import club.joylink.rtss.entity.paper.PaperUser; import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.entity.paper.PaperUserQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample; import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.CreatePaperRspVo; import club.joylink.rtss.vo.paper.CreatePaperRspVo;
import club.joylink.rtss.vo.paper.PaperCompositionState; import club.joylink.rtss.vo.paper.PaperCompositionState;
import club.joylink.rtss.vo.paper.PaperQType; import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperQuestionState;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -36,7 +44,7 @@ public class PaperUserCreateService {
@Autowired @Autowired
private PaperCompositionService compositionService; private PaperCompositionService compositionService;
@Autowired @Autowired
private PaperQuestionDAO pagerQuestionDAO; private PaperQuestionDAO questionDAO;
@Autowired @Autowired
private PublishedTraining2DAO trainingDAO; private PublishedTraining2DAO trainingDAO;
@ -60,14 +68,14 @@ public class PaperUserCreateService {
List<PaperRule> ruleList = compositionService.findRuleByPcId(pcId); List<PaperRule> ruleList = compositionService.findRuleByPcId(pcId);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionNotEmpty(ruleList, "试卷定义没有规则定义无法生成用户试卷pcId = " + pcId); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionNotEmpty(ruleList, "试卷定义没有规则定义无法生成用户试卷pcId = " + pcId);
// //
String projectCode = composition.getProjectCode(); String companyId = composition.getCompanyId();
// 标记封存的试卷蓝图已使用 // 标记封存的试卷蓝图已使用
compositionService.usePaperComposition(pcId); compositionService.usePaperComposition(pcId);
// 创建用户试卷 // 创建用户试卷
PaperUser paper = new PaperUser(); PaperUser paper = new PaperUser();
paper.setUserId(user.getId()); paper.setUserId(user.getId());
paper.setPcId(pcId); paper.setPcId(pcId);
paper.setProjectCode(projectCode); paper.setCompanyId(companyId);
paper.setCreateTime(LocalDateTime.now()); paper.setCreateTime(LocalDateTime.now());
paperUserDAO.insertSelective(paper); paperUserDAO.insertSelective(paper);
paper = paperUserService.findByUserIdAndPcId(user.getId(), pcId); paper = paperUserService.findByUserIdAndPcId(user.getId(), pcId);
@ -76,7 +84,7 @@ public class PaperUserCreateService {
// //
CreatePaperRspVo rsp = new CreatePaperRspVo(); CreatePaperRspVo rsp = new CreatePaperRspVo();
rsp.setPaperName(composition.getName()); rsp.setPaperName(composition.getName());
rsp.setProjectCode(projectCode); rsp.setCompanyId(companyId);
rsp.setId(paper.getId()); rsp.setId(paper.getId());
return rsp; return rsp;
} }
@ -92,35 +100,188 @@ public class PaperUserCreateService {
this.dispatcherCommonQuestion(pu, pc, rule); this.dispatcherCommonQuestion(pu, pc, rule);
break; break;
case Training: case Training:
this.dispatcherTrainingQuestion(pu, pc, rule);
break;
} }
}); });
} }
/**
* 随机选择理论题目
*/
private void dispatcherCommonQuestion(PaperUser pu, PaperComposition pc, PaperRule rule) { private void dispatcherCommonQuestion(PaperUser pu, PaperComposition pc, PaperRule rule) {
String tags = rule.getTags();//规则标签逗号分隔 final int qSum = rule.getSum();//该类型问题个数
String[] tagArray = null != tags && tags.length() > 0 ? tags.split(",") : null; //
PaperQuestionExample questionExample = this.commonQuestionExample(pu, pc, rule, null, null);
//符合条件的题目数目
long count = questionDAO.countByExample(questionExample);
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的理论题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " companyId = " + pc.getCompanyId() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页记录数
final int pageSize = 5;
//页数
final long pageSum = count / pageSize + count % pageSize > 0 ? 1 : 0;
//随机生成页码
int pageNum = (int) (Math.random() * pageSum) + 1;
//在页内随机选择一条在该条前后连续取够qSum个问题
long startIndex = (pageNum - 1) * pageSize;
final String orderBy = "id";
questionExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, pageSize));
List<PaperQuestion> page = questionDAO.selectByExample(questionExample);
final int randomIndex = (int) (Math.random() * page.size());
//选择该题目后边连续qSum个
PaperQuestion randomQuestion = page.get(randomIndex);
final List<PaperQuestion> questionList = new ArrayList<>(qSum);
questionList.add(randomQuestion);
final int questionSum = qSum - 1;
PaperQuestionExample greaterExample = this.commonQuestionExample(pu, pc, rule, true, randomQuestion.getId());
greaterExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, questionSum));
List<PaperQuestion> greaterList = questionDAO.selectByExample(greaterExample);
if (!CollectionUtils.isEmpty(greaterList)) {
questionList.addAll(greaterList);
}
final int lessSum = questionSum - questionList.size();
if (lessSum > 0) {
PaperQuestionExample lessExample = this.commonQuestionExample(pu, pc, rule, false, randomQuestion.getId());
lessExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, lessSum));
List<PaperQuestion> lessList = questionDAO.selectByExample(lessExample);
questionList.addAll(lessList);
}
//校验最终查询到的题目数目
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(questionList.size() == qSum, "没有足够的符合条件的理论题目");
//将题目与试卷关联
questionList.forEach(q -> {
PaperUserQuestion puq = new PaperUserQuestion();
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setCompanyId(pc.getCompanyId());
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
puq.setQuestionId(q.getId());
paperUserQuestionDAO.insertSelective(puq);
});
}
/**
* 随机选择实训题目
*/
private void dispatcherTrainingQuestion(PaperUser pu, PaperComposition pc, PaperRule rule) {
final int qSum = rule.getSum();//该类型问题个数
//
PublishedTraining2Example questionExample = this.trainingQuestionExample(pu, pc, rule, null, null);
//符合条件的题目数目
long count = trainingDAO.countByExample(questionExample);
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的实训题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " companyId = " + pc.getCompanyId() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页记录数
final int pageSize = 5;
//页数
final long pageSum = count / pageSize + count % pageSize > 0 ? 1 : 0;
//随机生成页码
int pageNum = (int) (Math.random() * pageSum) + 1;
//在页内随机选择一条在该条前后连续取够qSum个问题
long startIndex = (pageNum - 1) * pageSize;
final String orderBy = "id";
questionExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, pageSize));
List<PublishedTraining2> page = trainingDAO.selectByExample(questionExample);
final int randomIndex = (int) (Math.random() * page.size());
//选择该题目后边连续qSum个
PublishedTraining2 randomQuestion = page.get(randomIndex);
final List<PublishedTraining2> questionList = new ArrayList<>(qSum);
questionList.add(randomQuestion);
final int questionSum = qSum - 1;
PublishedTraining2Example greaterExample = this.trainingQuestionExample(pu, pc, rule, true, randomQuestion.getId());
greaterExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, questionSum));
List<PublishedTraining2> greaterList = trainingDAO.selectByExample(greaterExample);
if (!CollectionUtils.isEmpty(greaterList)) {
questionList.addAll(greaterList);
}
final int lessSum = questionSum - questionList.size();
if (lessSum > 0) {
PublishedTraining2Example lessExample = this.trainingQuestionExample(pu, pc, rule, false, randomQuestion.getId());
lessExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, lessSum));
List<PublishedTraining2> lessList = trainingDAO.selectByExample(lessExample);
questionList.addAll(lessList);
}
//校验最终查询到的题目数目
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(questionList.size() == qSum, "没有足够的符合条件的实训题目");
//将题目与试卷关联
questionList.forEach(q -> {
PaperUserQuestion puq = new PaperUserQuestion();
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setCompanyId(pc.getCompanyId());
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
puq.setQuestionId(q.getId());
paperUserQuestionDAO.insertSelective(puq);
});
}
/**
* 生成根据tag查询的条件
*/
private PublishedTraining2Example trainingQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule, Boolean isGreaterThan, Long id) {
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
//
PublishedTraining2Example questionExample = new PublishedTraining2Example();
if (null == tagArray) {
PublishedTraining2Example.Criteria c = questionExample.createCriteria().andTypeEqualTo(this.paperUserService.getTrainingType(subType)).andStateEqualTo(1);//1-上架
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
} else {
for (String tag : tagArray) {
PublishedTraining2Example.Criteria c = questionExample.or().andTypeEqualTo(this.paperUserService.getTrainingType(subType)).andStateEqualTo(1).andLabelJsonLike(String.format("%%%s%%", tag));
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
}
}
return questionExample;
}
/**
* 生成根据tag查询的条件
*/
private PaperQuestionExample commonQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule, Boolean isGreaterThan, Long id) {
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype()); PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
int qSum = rule.getSum();//该类型问题个数
// //
PaperQuestionExample questionExample = new PaperQuestionExample(); PaperQuestionExample questionExample = new PaperQuestionExample();
if (null == tagArray) { if (null == tagArray) {
questionExample.createCriteria().andProjectCodeEqualTo(pc.getProjectCode()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0); PaperQuestionExample.Criteria c = questionExample.createCriteria().andProjectCodeEqualTo(pc.getCompanyId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0);
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
} else { } else {
for (String tag : tagArray) { for (String tag : tagArray) {
questionExample.or().andProjectCodeEqualTo(pc.getProjectCode()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andRaceLableLike(tag); PaperQuestionExample.Criteria c = questionExample.or().andProjectCodeEqualTo(pc.getCompanyId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andRaceLableLike(String.format("%%%s%%", tag));
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
} }
} }
//符合条件的题目数目 return questionExample;
long count = pagerQuestionDAO.countByExample(questionExample);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的理论题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " projectCode = " + pc.getProjectCode() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页10条一共页数
long pageSum = count/10+count%10>0?1:0;
//随机生成页码
int pageNum = (int) (Math.random()*pageSum);
//在页内随机选择一条在该条前后连续取够qSum个问题
} }
} }

View File

@ -0,0 +1,76 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.dao.paper.PaperQuestionDAO;
import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.PaperCommonQuestionVo;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperQuestionLoadRspVo;
import club.joylink.rtss.vo.paper.PaperTrainingQuestionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
@Service
public class PaperUserLoadQuestionService {
@Autowired
private PaperUserService paperUserService;
@Autowired
private PaperQuestionDAO questionDAO;
@Autowired
private PublishedTraining2DAO trainingDAO;
/**
* 加载用户试卷试题
*
* @param groupType 试卷试题大类型:1-理论题2-实训题
* @param qId 试题id
*/
@Transactional(readOnly = true)
public PaperQuestionLoadRspVo loadQuestion(PaperQType.GroupType groupType, Long qId, AccountVO user) {
PaperQuestionLoadRspVo rsp = new PaperQuestionLoadRspVo();
rsp.setId(qId);
rsp.setType(groupType);
switch (groupType) {
case Training:
rsp.setTraining(loadTrainingQuestion(qId, user));
break;
case Common:
rsp.setCommon(loadCommonQuestion(qId, user));
break;
}
return rsp;
}
private PaperTrainingQuestionVo loadTrainingQuestion(Long qId, AccountVO user) {
PublishedTraining2Example example = new PublishedTraining2Example();
example.createCriteria().andIdEqualTo(qId);
PublishedTraining2 training = trainingDAO.selectByExample(example).get(0);
PaperTrainingQuestionVo rt = new PaperTrainingQuestionVo();
rt.setId(training.getId());
rt.setType(paperUserService.getTrainingType(training));
rt.setName(training.getName());
rt.setDescription(training.getDescription());
return rt;
}
private PaperCommonQuestionVo loadCommonQuestion(Long qId, AccountVO user) {
PaperCommonQuestionVo q = new PaperCommonQuestionVo();
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(qId);
q.setId(question.getId());
q.setType(paperUserService.getPaperQuestionType(question));
q.setCreateUserId(question.getCreateUserId());
q.setCreateTime(question.getCreateTime());
q.setProjectCode(question.getProjectCode());
q.setCompanyId(question.getCompanyId());
q.setRaceLable(question.getRaceLable());
q.setQuestion(question.getQuestion());
q.setOptionList(JsonUtils.readCollection(question.getQuestionOption(), ArrayList.class, PaperCommonQuestionVo.OptionVo.class));
return q;
}
}

View File

@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -46,10 +49,6 @@ public class PaperUserService {
@Autowired @Autowired
private PublishedTraining2DAO trainingDAO; private PublishedTraining2DAO trainingDAO;
/** /**
* 获取用户试卷完整信息 * 获取用户试卷完整信息
* *
@ -73,19 +72,6 @@ public class PaperUserService {
return rsp; return rsp;
} }
/**
* 加载用户试卷试题
*
* @param groupType 试卷试题大类型:1-理论题2-实训题
* @param qId 试题id
*/
@Transactional(readOnly = true)
public PaperQuestionLoadRspVo loadQuestion(PaperQType.GroupType groupType, Long qId, AccountVO user) {
return null;
}
/** /**
* 开始答题 * 开始答题
* *
@ -142,7 +128,7 @@ public class PaperUserService {
PaperSubmitRspVo rsp = new PaperSubmitRspVo(); PaperSubmitRspVo rsp = new PaperSubmitRspVo();
rsp.setPuId(puId); rsp.setPuId(puId);
rsp.setName(composition.getName()); rsp.setName(composition.getName());
rsp.setProjectCode(composition.getProjectCode()); rsp.setCompanyId(composition.getCompanyId());
rsp.setDuration(paperTime); rsp.setDuration(paperTime);
rsp.setScore(scoreCommon + scoreTraining); rsp.setScore(scoreCommon + scoreTraining);
rsp.setCommonScore(scoreCommon); rsp.setCommonScore(scoreCommon);
@ -159,14 +145,13 @@ public class PaperUserService {
example.createCriteria().andIdEqualTo(puq.getQuestionId()); example.createCriteria().andIdEqualTo(puq.getQuestionId());
PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0); PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时 if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
PaperRule rule = ruleMap.get(this.getPaperQuestionType(question)); PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
return rule.getScore(); return rule.getScore();
} }
return 0; return 0;
} }
/** /**
* 获取题的最终得分 * 获取题的最终得分
*/ */
@ -231,36 +216,50 @@ public class PaperUserService {
return list.get(0); return list.get(0);
} }
} }
public PaperQType.SubType getPaperQuestionType(PaperQuestion question) { public PaperQType.SubType getPaperQuestionType(PaperQuestion question) {
switch (question.getType()) { switch (question.getType()) {
case "select": return PaperQType.SubType.Select; case "select":
case "judge":return PaperQType.SubType.Judge; return PaperQType.SubType.Select;
case "multi":return PaperQType.SubType.Multi; case "judge":
return PaperQType.SubType.Judge;
case "multi":
return PaperQType.SubType.Multi;
} }
return null; return null;
} }
public String getPaperQuestionType(PaperQType.SubType qt){
switch (qt){ public String getPaperQuestionType(PaperQType.SubType qt) {
case Judge:return "judge"; switch (qt) {
case Select:return "select"; case Judge:
case Multi:return "multi"; return "judge";
case Select:
return "select";
case Multi:
return "multi";
} }
return null; return null;
} }
/** /**
* 实训类型单操 single场景scene * 实训类型单操 single场景scene
*/ */
public PaperQType.SubType getTrainingType(PublishedTraining2 training){ public PaperQType.SubType getTrainingType(PublishedTraining2 training) {
switch (training.getType()){ switch (training.getType()) {
case "single":return PaperQType.SubType.Single; case "single":
case "scene":return PaperQType.SubType.Scene; return PaperQType.SubType.Single;
case "scene":
return PaperQType.SubType.Scene;
} }
return null; return null;
} }
public String getTrainingType(PaperQType.SubType training){
switch(training){ public String getTrainingType(PaperQType.SubType training) {
case Single:return "single"; switch (training) {
case Scene:return "scene"; case Single:
return "single";
case Scene:
return "scene";
} }
return null; return null;
} }

View File

@ -0,0 +1,34 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.dao.paper.PaperUserQuestionDAO;
import club.joylink.rtss.entity.paper.PaperUserQuestionExample;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.PaperSubmitAnswerReqVo;
import club.joylink.rtss.vo.paper.PaperSubmitAnswerRspVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 用户提交答案业务处理
*/
@Service
public class PaperUserSubmitAnswerService {
@Autowired
private PaperUserQuestionDAO paperUserQuestionDAO;
/**
* 用户提交答案
*/
@Transactional(rollbackFor = Exception.class)
public PaperSubmitAnswerRspVo submitAnswer(PaperSubmitAnswerReqVo req, AccountVO user) {
PaperUserQuestionExample example = new PaperUserQuestionExample();
example.createCriteria().andPuIdEqualTo(req.getPuId()).andQuestionIdEqualTo(req.getPqId());
PaperSubmitAnswerRspVo rsp = new PaperSubmitAnswerRspVo();
return null;
}
private void submitCommonAnswer(PaperSubmitAnswerReqVo req){
}
}

View File

@ -18,8 +18,8 @@ public class CreatePaperCompositionReqVo {
private String profile; private String profile;
/** /**
* 项目code * 组织id
*/ */
@NotNull @NotNull
private String projectCode; private String companyId;
} }

View File

@ -22,7 +22,7 @@ public class CreatePaperCompositionRspVo {
private String profile; private String profile;
/** /**
* 项目code * 组织id
*/ */
private String projectCode; private String companyId;
} }

View File

@ -18,9 +18,9 @@ public class CreatePaperRspVo {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
/** /**
* 项目code * 组织id
*/ */
private String projectCode; private String companyId;
/** /**
* 试卷名称 * 试卷名称
*/ */

View File

@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@Data @Data
public class CreatePaperRuleReqVo { public class CreatePaperRuleReqVo {
@ -28,7 +30,7 @@ public class CreatePaperRuleReqVo {
/** /**
* 筛选题目的标签即根据标签来筛选题目 * 筛选题目的标签即根据标签来筛选题目
*/ */
private String tags; private List<String> tags;
/** /**
* 该类型题目数量 * 该类型题目数量

View File

@ -32,10 +32,10 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
*/ */
private Boolean nameLike = true; private Boolean nameLike = true;
/** /**
* 项目code<br> * 组织id<br>
* 选填<br> * 选填<br>
*/ */
private String projectCode; private String companyId;
/** /**
* 项目code--是否模糊查询,默认false<br> * 项目code--是否模糊查询,默认false<br>
* 选填<br> * 选填<br>

View File

@ -0,0 +1,71 @@
package club.joylink.rtss.vo.paper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class PaperCommonQuestionVo {
/**
* 理论题id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 类型 选择题=select,判断题=judge,多选题=multi
*/
private PaperQType.SubType type;
/**
* 创建者id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long createUserId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 项目code
*/
private String projectCode;
/**
* 公司组织id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long companyId;
/**
* 标签
*/
private String raceLable;
/**
*题目
*/
private String question;
/**
*选项列表
*/
private List<OptionVo> optionList;
/**
* 题目选项
*/
@Data
public static class OptionVo{
/**
* 选项编号
*/
private int id;
/**
* 选项内容
*/
private String content;
}
}

View File

@ -25,7 +25,7 @@ public class PaperCompositionBasicVo {
private String profile; private String profile;
/** /**
* 项目code * 组织id
*/ */
private String projectCode; private String companyId;
} }

View File

@ -21,6 +21,14 @@ public class PaperQuestionLoadRspVo {
* 试题类型1-理论题2-实训题 * 试题类型1-理论题2-实训题
*/ */
private PaperQType.GroupType type; private PaperQType.GroupType type;
/**
* 加载到的实训试题
*/
private PaperTrainingQuestionVo training;
/**
* 加载到的理论试题
*/
private PaperCommonQuestionVo common;
} }

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List;
@Data @Data
public class PaperRuleVo { public class PaperRuleVo {
@ -35,7 +36,7 @@ public class PaperRuleVo {
/** /**
* 筛选题目的标签即根据标签来筛选题目 * 筛选题目的标签即根据标签来筛选题目
*/ */
private String tags; private List<String> tags;
/** /**
* 该类型题目数量 * 该类型题目数量

View File

@ -8,12 +8,18 @@ import javax.validation.constraints.NotNull;
@Data @Data
public class PaperSubmitAnswerReqVo { public class PaperSubmitAnswerReqVo {
/**
* 用户试卷id
*/
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long puId;
/** /**
* 用户试卷试题id * 用户试卷试题id
*/ */
@NotNull @NotNull
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long pqId;
/** /**
* 试题类型1-理论题2-实训题 * 试题类型1-理论题2-实训题
*/ */

View File

@ -8,12 +8,18 @@ import javax.validation.constraints.NotNull;
@Data @Data
public class PaperSubmitAnswerRspVo { public class PaperSubmitAnswerRspVo {
/**
* 用户试卷id
*/
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long puId;
/** /**
* 用户试卷试题id * 用户试卷试题id
*/ */
@NotNull @NotNull
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long pqId;
/** /**
* 试题类型1-理论题2-实训题 * 试题类型1-理论题2-实训题
*/ */

View File

@ -23,9 +23,9 @@ public class PaperSubmitRspVo {
*/ */
private String name; private String name;
/** /**
* 项目code * 组织id
*/ */
private String projectCode; private String companyId;
/** /**
* 及格分 * 及格分
*/ */

View File

@ -0,0 +1,26 @@
package club.joylink.rtss.vo.paper;
import lombok.Data;
/**
* 响应实训试题
*/
@Data
public class PaperTrainingQuestionVo {
/**
* 已发布的实训的id
*/
private Long id;
/**
* 实训名称
*/
private String name;
/**
* 实训类型单操 single场景scene
*/
private PaperQType.SubType type;
/**
* 实训描述
*/
private String description;
}

View File

@ -1,40 +1,54 @@
package club.joylink.rtss.vo.paper.convertor; package club.joylink.rtss.vo.paper.convertor;
import club.joylink.rtss.entity.paper.PaperRule; import club.joylink.rtss.entity.paper.PaperRule;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.paper.CreatePaperRuleReqVo; import club.joylink.rtss.vo.paper.CreatePaperRuleReqVo;
import club.joylink.rtss.vo.paper.PaperQType; import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperRuleVo; import club.joylink.rtss.vo.paper.PaperRuleVo;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
public class PaperRuleConvertor { public class PaperRuleConvertor {
public static PaperRuleVo convert(PaperRule from){ public static PaperRuleVo convert(PaperRule from) {
PaperRuleVo to = new PaperRuleVo(); PaperRuleVo to = new PaperRuleVo();
to.setId(from.getId()); to.setId(from.getId());
to.setPcId(from.getPcId()); to.setPcId(from.getPcId());
to.setType(PaperQType.GroupType.getItem(from.getType())); to.setType(PaperQType.GroupType.getItem(from.getType()));
to.setSubtype(PaperQType.SubType.getItem(from.getSubtype())); to.setSubtype(PaperQType.SubType.getItem(from.getSubtype()));
to.setTags(from.getTags()); to.setTags(JsonUtils.readCollection(from.getTags(),ArrayList.class,String.class));
to.setScore(from.getScore()); to.setScore(from.getScore());
to.setSum(from.getSum()); to.setSum(from.getSum());
return to; return to;
} }
public static PaperRule convert(PaperRuleVo from){
public static PaperRule convert(PaperRuleVo from) {
PaperRule to = new PaperRule(); PaperRule to = new PaperRule();
to.setId(from.getId()); to.setId(from.getId());
to.setPcId(from.getPcId()); to.setPcId(from.getPcId());
to.setType(from.getType().getValue()); to.setType(from.getType().getValue());
to.setSubtype(from.getSubtype().getValue()); to.setSubtype(from.getSubtype().getValue());
to.setTags(from.getTags()); if (!CollectionUtils.isEmpty(from.getTags())) {
to.setTags(JsonUtils.writeValueAsString(from.getTags()));
} else {
to.setTags(JsonUtils.writeValueAsString(new ArrayList<String>()));
}
to.setScore(from.getScore()); to.setScore(from.getScore());
to.setSum(from.getSum()); to.setSum(from.getSum());
return to; return to;
} }
public static PaperRule convert(CreatePaperRuleReqVo from){
public static PaperRule convert(CreatePaperRuleReqVo from) {
PaperRule to = new PaperRule(); PaperRule to = new PaperRule();
to.setPcId(from.getPcId()); to.setPcId(from.getPcId());
to.setType(from.getType().getValue()); to.setType(from.getType().getValue());
to.setSubtype(from.getSubtype().getValue()); to.setSubtype(from.getSubtype().getValue());
to.setTags(from.getTags()); if (!CollectionUtils.isEmpty(from.getTags())) {
to.setTags(JsonUtils.writeValueAsString(from.getTags()));
} else {
to.setTags(JsonUtils.writeValueAsString(new ArrayList<String>()));
}
to.setScore(from.getScore()); to.setScore(from.getScore());
to.setSum(from.getSum()); to.setSum(from.getSum());
return to; return to;

View File

@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="profile" jdbcType="VARCHAR" property="profile" /> <result column="profile" jdbcType="VARCHAR" property="profile" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" /> <result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" /> <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="valid_duration" jdbcType="INTEGER" property="validDuration" /> <result column="valid_duration" jdbcType="INTEGER" property="validDuration" />
@ -74,7 +74,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `name`, profile, project_code, start_time, end_time, valid_duration, pass_score, id, `name`, profile, company_id, start_time, end_time, valid_duration, pass_score,
creator_id, create_time, update_time, `state` creator_id, create_time, update_time, `state`
</sql> </sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperCompositionExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperCompositionExample" resultMap="BaseResultMap">
@ -100,7 +100,7 @@
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from paper_composition from paper_composition
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
@ -116,16 +116,16 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperComposition"> <insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
insert into paper_composition (id, `name`, profile, insert into paper_composition (id, `name`, profile,
project_code, start_time, end_time, company_id, start_time, end_time,
valid_duration, pass_score, creator_id, valid_duration, pass_score, creator_id,
create_time, update_time, `state` create_time, update_time, `state`
) )
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR},
#{projectCode,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{companyId,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{validDuration,jdbcType=INTEGER}, #{passScore,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT}, #{validDuration,jdbcType=INTEGER}, #{passScore,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER} #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.PaperComposition"> <insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
insert into paper_composition insert into paper_composition
@ -139,8 +139,8 @@
<if test="profile != null"> <if test="profile != null">
profile, profile,
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
project_code, company_id,
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
start_time, start_time,
@ -177,8 +177,8 @@
<if test="profile != null"> <if test="profile != null">
#{profile,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR},
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
#{projectCode,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP}, #{startTime,jdbcType=TIMESTAMP},
@ -224,8 +224,8 @@
<if test="record.profile != null"> <if test="record.profile != null">
profile = #{record.profile,jdbcType=VARCHAR}, profile = #{record.profile,jdbcType=VARCHAR},
</if> </if>
<if test="record.projectCode != null"> <if test="record.companyId != null">
project_code = #{record.projectCode,jdbcType=VARCHAR}, company_id = #{record.companyId,jdbcType=VARCHAR},
</if> </if>
<if test="record.startTime != null"> <if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP}, start_time = #{record.startTime,jdbcType=TIMESTAMP},
@ -259,17 +259,17 @@
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update paper_composition update paper_composition
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
profile = #{record.profile,jdbcType=VARCHAR}, profile = #{record.profile,jdbcType=VARCHAR},
project_code = #{record.projectCode,jdbcType=VARCHAR}, company_id = #{record.companyId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=TIMESTAMP}, start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP}, end_time = #{record.endTime,jdbcType=TIMESTAMP},
valid_duration = #{record.validDuration,jdbcType=INTEGER}, valid_duration = #{record.validDuration,jdbcType=INTEGER},
pass_score = #{record.passScore,jdbcType=INTEGER}, pass_score = #{record.passScore,jdbcType=INTEGER},
creator_id = #{record.creatorId,jdbcType=BIGINT}, creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER} `state` = #{record.state,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -283,8 +283,8 @@
<if test="profile != null"> <if test="profile != null">
profile = #{profile,jdbcType=VARCHAR}, profile = #{profile,jdbcType=VARCHAR},
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
project_code = #{projectCode,jdbcType=VARCHAR}, company_id = #{companyId,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP}, start_time = #{startTime,jdbcType=TIMESTAMP},
@ -316,16 +316,16 @@
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperComposition"> <update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
update paper_composition update paper_composition
set `name` = #{name,jdbcType=VARCHAR}, set `name` = #{name,jdbcType=VARCHAR},
profile = #{profile,jdbcType=VARCHAR}, profile = #{profile,jdbcType=VARCHAR},
project_code = #{projectCode,jdbcType=VARCHAR}, company_id = #{companyId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP}, start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP}, end_time = #{endTime,jdbcType=TIMESTAMP},
valid_duration = #{validDuration,jdbcType=INTEGER}, valid_duration = #{validDuration,jdbcType=INTEGER},
pass_score = #{passScore,jdbcType=INTEGER}, pass_score = #{passScore,jdbcType=INTEGER},
creator_id = #{creatorId,jdbcType=BIGINT}, creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER} `state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>

View File

@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" /> <result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="pc_id" jdbcType="BIGINT" property="pcId" /> <result column="pc_id" jdbcType="BIGINT" property="pcId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" /> <result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="score" jdbcType="INTEGER" property="score" /> <result column="score" jdbcType="INTEGER" property="score" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" /> <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
@ -71,7 +71,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, pc_id, project_code, score, start_time, end_time, cause, create_time id, user_id, pc_id, company_id, score, start_time, end_time, cause, create_time
</sql> </sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserExample" resultMap="BaseResultMap">
select select
@ -113,11 +113,11 @@
</delete> </delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUser"> <insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUser">
insert into paper_user (id, user_id, pc_id, insert into paper_user (id, user_id, pc_id,
project_code, score, start_time, company_id, score, start_time,
end_time, cause, create_time end_time, cause, create_time
) )
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{pcId,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{pcId,jdbcType=BIGINT},
#{projectCode,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, #{companyId,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{cause,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP} #{endTime,jdbcType=TIMESTAMP}, #{cause,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
) )
</insert> </insert>
@ -133,8 +133,8 @@
<if test="pcId != null"> <if test="pcId != null">
pc_id, pc_id,
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
project_code, company_id,
</if> </if>
<if test="score != null"> <if test="score != null">
score, score,
@ -162,8 +162,8 @@
<if test="pcId != null"> <if test="pcId != null">
#{pcId,jdbcType=BIGINT}, #{pcId,jdbcType=BIGINT},
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
#{projectCode,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR},
</if> </if>
<if test="score != null"> <if test="score != null">
#{score,jdbcType=INTEGER}, #{score,jdbcType=INTEGER},
@ -200,8 +200,8 @@
<if test="record.pcId != null"> <if test="record.pcId != null">
pc_id = #{record.pcId,jdbcType=BIGINT}, pc_id = #{record.pcId,jdbcType=BIGINT},
</if> </if>
<if test="record.projectCode != null"> <if test="record.companyId != null">
project_code = #{record.projectCode,jdbcType=VARCHAR}, company_id = #{record.companyId,jdbcType=VARCHAR},
</if> </if>
<if test="record.score != null"> <if test="record.score != null">
score = #{record.score,jdbcType=INTEGER}, score = #{record.score,jdbcType=INTEGER},
@ -228,7 +228,7 @@
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
pc_id = #{record.pcId,jdbcType=BIGINT}, pc_id = #{record.pcId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR}, company_id = #{record.companyId,jdbcType=VARCHAR},
score = #{record.score,jdbcType=INTEGER}, score = #{record.score,jdbcType=INTEGER},
start_time = #{record.startTime,jdbcType=TIMESTAMP}, start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP}, end_time = #{record.endTime,jdbcType=TIMESTAMP},
@ -247,8 +247,8 @@
<if test="pcId != null"> <if test="pcId != null">
pc_id = #{pcId,jdbcType=BIGINT}, pc_id = #{pcId,jdbcType=BIGINT},
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
project_code = #{projectCode,jdbcType=VARCHAR}, company_id = #{companyId,jdbcType=VARCHAR},
</if> </if>
<if test="score != null"> <if test="score != null">
score = #{score,jdbcType=INTEGER}, score = #{score,jdbcType=INTEGER},
@ -272,7 +272,7 @@
update paper_user update paper_user
set user_id = #{userId,jdbcType=BIGINT}, set user_id = #{userId,jdbcType=BIGINT},
pc_id = #{pcId,jdbcType=BIGINT}, pc_id = #{pcId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR}, company_id = #{companyId,jdbcType=VARCHAR},
score = #{score,jdbcType=INTEGER}, score = #{score,jdbcType=INTEGER},
start_time = #{startTime,jdbcType=TIMESTAMP}, start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP}, end_time = #{endTime,jdbcType=TIMESTAMP},

View File

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUserQuestion"> <resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUserQuestion">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="pu_id" jdbcType="BIGINT" property="puId" /> <result column="pu_id" jdbcType="BIGINT" property="puId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" /> <result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="type" jdbcType="INTEGER" property="type" /> <result column="type" jdbcType="INTEGER" property="type" />
<result column="question_id" jdbcType="BIGINT" property="questionId" /> <result column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="state" jdbcType="INTEGER" property="state" /> <result column="state" jdbcType="INTEGER" property="state" />
@ -68,7 +68,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, pu_id, project_code, `type`, question_id, `state` id, pu_id, company_id, `type`, question_id, `state`
</sql> </sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestionExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestionExample" resultMap="BaseResultMap">
select select
@ -109,10 +109,10 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion"> <insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
insert into paper_user_question (id, pu_id, project_code, insert into paper_user_question (id, pu_id, company_id,
`type`, question_id, `state` `type`, question_id, `state`
) )
values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{projectCode,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{companyId,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT}, #{state,jdbcType=INTEGER} #{type,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT}, #{state,jdbcType=INTEGER}
) )
</insert> </insert>
@ -125,8 +125,8 @@
<if test="puId != null"> <if test="puId != null">
pu_id, pu_id,
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
project_code, company_id,
</if> </if>
<if test="type != null"> <if test="type != null">
`type`, `type`,
@ -145,8 +145,8 @@
<if test="puId != null"> <if test="puId != null">
#{puId,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT},
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
#{projectCode,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR},
</if> </if>
<if test="type != null"> <if test="type != null">
#{type,jdbcType=INTEGER}, #{type,jdbcType=INTEGER},
@ -174,8 +174,8 @@
<if test="record.puId != null"> <if test="record.puId != null">
pu_id = #{record.puId,jdbcType=BIGINT}, pu_id = #{record.puId,jdbcType=BIGINT},
</if> </if>
<if test="record.projectCode != null"> <if test="record.companyId != null">
project_code = #{record.projectCode,jdbcType=VARCHAR}, company_id = #{record.companyId,jdbcType=VARCHAR},
</if> </if>
<if test="record.type != null"> <if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER}, `type` = #{record.type,jdbcType=INTEGER},
@ -195,7 +195,7 @@
update paper_user_question update paper_user_question
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
pu_id = #{record.puId,jdbcType=BIGINT}, pu_id = #{record.puId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR}, company_id = #{record.companyId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=INTEGER}, `type` = #{record.type,jdbcType=INTEGER},
question_id = #{record.questionId,jdbcType=BIGINT}, question_id = #{record.questionId,jdbcType=BIGINT},
`state` = #{record.state,jdbcType=INTEGER} `state` = #{record.state,jdbcType=INTEGER}
@ -209,8 +209,8 @@
<if test="puId != null"> <if test="puId != null">
pu_id = #{puId,jdbcType=BIGINT}, pu_id = #{puId,jdbcType=BIGINT},
</if> </if>
<if test="projectCode != null"> <if test="companyId != null">
project_code = #{projectCode,jdbcType=VARCHAR}, company_id = #{companyId,jdbcType=VARCHAR},
</if> </if>
<if test="type != null"> <if test="type != null">
`type` = #{type,jdbcType=INTEGER}, `type` = #{type,jdbcType=INTEGER},
@ -227,7 +227,7 @@
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion"> <update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
update paper_user_question update paper_user_question
set pu_id = #{puId,jdbcType=BIGINT}, set pu_id = #{puId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR}, company_id = #{companyId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=INTEGER}, `type` = #{type,jdbcType=INTEGER},
question_id = #{questionId,jdbcType=BIGINT}, question_id = #{questionId,jdbcType=BIGINT},
`state` = #{state,jdbcType=INTEGER} `state` = #{state,jdbcType=INTEGER}