理论试题管理

This commit is contained in:
tiger_zhou 2022-09-22 14:23:21 +08:00
parent 226d5d62b1
commit 2d2d0fc459
13 changed files with 308 additions and 214 deletions

View File

@ -817,4 +817,12 @@ public interface BusinessConsts {
/** 关闭自动调度 */ /** 关闭自动调度 */
REGULATION_OFF, REGULATION_OFF,
} }
/**
* 数据库数据逻辑删除标识
*/
enum DBLogicDelete{
NORMAL,
DELETE,
}
} }

View File

@ -6,24 +6,23 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.question.QuestionQueryVO; import club.joylink.rtss.vo.client.question.QuestionQueryVO;
import club.joylink.rtss.vo.client.question.v2.QuestionVO2; import club.joylink.rtss.vo.client.question.v2.PaperQuestionVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
*题库管理接口 *题库管理接口
*/ */
@RestController @RestController
@RequestMapping(path = "/api/questionBank2") @RequestMapping(path = "/api/pager_question")
public class QuestionBankController2 { public class TheoryQuestionBankController2 {
/*@Autowired
private IQuestionBankService iQuestionBankService;*/
@Autowired @Autowired
private QuestionBankService2 questionBankService; private QuestionBankService2 questionBankService;
@ -31,7 +30,7 @@ public class QuestionBankController2 {
*分页查询题目 *分页查询题目
*/ */
@GetMapping(path = "/questions/paging") @GetMapping(path = "/questions/paging")
public PageVO<QuestionVO2> pagingQueryQuestions(@RequestAttribute LoginUserInfoVO loginInfo, QuestionQueryVO queryVO) { public PageVO<PaperQuestionVO> pagingQueryQuestions(@RequestAttribute LoginUserInfoVO loginInfo, QuestionQueryVO queryVO) {
queryVO.setProjectCode(loginInfo.getProject().name()); queryVO.setProjectCode(loginInfo.getProject().name());
return questionBankService.pagingQueryQuestions(queryVO); return questionBankService.pagingQueryQuestions(queryVO);
} }
@ -40,7 +39,7 @@ public class QuestionBankController2 {
*查询题目列表 *查询题目列表
*/ */
@GetMapping(path = "/questions") @GetMapping(path = "/questions")
public List<QuestionVO2> queryQuestions(@RequestAttribute LoginUserInfoVO loginInfo,QuestionQueryVO queryVO) { public List<PaperQuestionVO> queryQuestions(@RequestAttribute LoginUserInfoVO loginInfo, QuestionQueryVO queryVO) {
queryVO.setProjectCode(loginInfo.getProject().name()); queryVO.setProjectCode(loginInfo.getProject().name());
return questionBankService.queryQuestions(queryVO); return questionBankService.queryQuestions(queryVO);
} }
@ -49,7 +48,7 @@ public class QuestionBankController2 {
*获取题目信息 *获取题目信息
*/ */
@GetMapping(path = "/questions/{questionId}") @GetMapping(path = "/questions/{questionId}")
public QuestionVO2 getQuestion(@PathVariable Long questionId) { public PaperQuestionVO getQuestion(@PathVariable Long questionId) {
return questionBankService.getQuestion(questionId); return questionBankService.getQuestion(questionId);
} }
@ -57,7 +56,7 @@ public class QuestionBankController2 {
*添加题目 *添加题目
*/ */
@PostMapping(path = "/questions") @PostMapping(path = "/questions")
public void addQuestion(@Validated @RequestBody QuestionVO2 questionVO, @RequestAttribute LoginUserInfoVO loginInfo, public void addQuestion(@Validated @RequestBody PaperQuestionVO questionVO, @RequestAttribute LoginUserInfoVO loginInfo,
@RequestAttribute AccountVO user) { @RequestAttribute AccountVO user) {
questionVO.setProjectCode(loginInfo.getProject().name()); questionVO.setProjectCode(loginInfo.getProject().name());
questionBankService.saveOrUpdate(questionVO, user); questionBankService.saveOrUpdate(questionVO, user);
@ -67,7 +66,7 @@ public class QuestionBankController2 {
*导入项目或单位试题库 *导入项目或单位试题库
*/ */
@PostMapping(path = "/questions/import") @PostMapping(path = "/questions/import")
public void importProjectQuestion(@Validated @RequestBody List<QuestionVO2> questions, @RequestAttribute LoginUserInfoVO loginInfo, public void importProjectQuestion(@Validated @RequestBody List<PaperQuestionVO> questions, @RequestAttribute LoginUserInfoVO loginInfo,
@RequestAttribute AccountVO user, @RequestParam(required = false, name = "id") Long companyId) { @RequestAttribute AccountVO user, @RequestParam(required = false, name = "id") Long companyId) {
questionBankService.importProjectQuestion(questions, loginInfo.getProject().name(), companyId,user); questionBankService.importProjectQuestion(questions, loginInfo.getProject().name(), companyId,user);
@ -84,14 +83,14 @@ public class QuestionBankController2 {
} }
/** /**
* 根据标签查询所有的题型 * 根据标签查询所有的题型
* @param companyId * @param companyId
* @param raceLable * @param raceMap
* @return * @return
*/ */
@GetMapping(path="/questions/{companyId}/question") @PostMapping(path="/questions/{companyId}/question")
public List<QuestionVO2> findByLable(@PathVariable Long companyId, @RequestParam(value = "raceLable") String raceLable){ public List<PaperQuestionVO> findByLable(@PathVariable Long companyId, @RequestBody Map<String,String> raceMap){
return this.questionBankService.queryQuestionsForRaceLable(companyId,raceLable); return this.questionBankService.queryQuestionsForRaceLable(companyId,raceMap);
} }
@ -103,7 +102,7 @@ public class QuestionBankController2 {
* @param user * @param user
*/ */
@PutMapping(path = "/questions/{questionId}") @PutMapping(path = "/questions/{questionId}")
public void updateQuestion(@PathVariable Long questionId, @RequestAttribute LoginUserInfoVO loginInfo,@RequestBody QuestionVO2 questionVO,@RequestAttribute AccountVO user) { public void updateQuestion(@PathVariable Long questionId, @RequestAttribute LoginUserInfoVO loginInfo, @RequestBody PaperQuestionVO questionVO, @RequestAttribute AccountVO user) {
questionVO.setId(questionId); questionVO.setId(questionId);
questionVO.setProjectCode(loginInfo.getProject().name()); questionVO.setProjectCode(loginInfo.getProject().name());
questionBankService.saveOrUpdate(questionVO,user); questionBankService.saveOrUpdate(questionVO,user);
@ -112,8 +111,8 @@ public class QuestionBankController2 {
/** /**
*删除题目 *删除题目
*/ */
@DeleteMapping(path = "/questions/{questionId}") @DeleteMapping(path = "/questions")
public void deleteQuestion(@PathVariable Long questionId) { public void deleteQuestion(@RequestBody List<Long> questionId) {
questionBankService.deleteQuestion(questionId); questionBankService.deleteQuestion(questionId);
} }

View File

@ -0,0 +1,28 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.entity.question.PaperQuestion;
import club.joylink.rtss.entity.question.PaperQuestionExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface PagerQuestionDAO extends MyBatisBaseDao<PaperQuestion, Long, PaperQuestionExample>{
@Select("<script>" +
"select race_lable from paper_question where company_id = #{companyId,jdbcType=BIGINT} group by race_lable" +
"</script>")
List<String> findAllLableByCompanyId(Long companyId);
@Select("<script>" +
"select * from paper_question where company_id = #{companyId,jdbcType=BIGINT} and is_del= #{isDelete,jdbcType=INTEGER}" +
" and <foreach collection=\"lable\" open=\"(\" close=\")\" item=\"d\" separator=\"or\"> "+
" find_in_set(#{d},race_lable) > 0 "+
"</foreach></script>")
List<PaperQuestion> findByCompanyIdAndRaceLable(Long companyId,int isDelete, List<String> lable);
}

View File

@ -1,27 +0,0 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.race2.RaceQuestion2;
import club.joylink.rtss.entity.race2.RaceQuestion2Example;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface RaceQuestion2DAO extends MyBatisBaseDao<RaceQuestion2, Long, RaceQuestion2Example>{
@Select(" <select>" +
"select count(id) from race_question2 where id = #{id,jdbcType=BIGINT}" +
" </select>")
Long checkExistByPK(Long id);
@Select("<script>" +
"select race_lable from race_question2 where company_id = #{companyId,jdbcType=BIGINT} group by race_lable" +
"</script>")
List<String> findAllLableByCompanyId(Long companyId);
@Select("<script>" +
"select * from race_question2 where company_id = #{companyId,jdbcType=BIGINT} and find_in_set(#{lable,jdbcType=VARCHAR},race_lable) > 0" +
"</script>")
List<RaceQuestion2> findByCompanyIdAndRaceLable(Long companyId,String lable);
}

View File

@ -1,4 +1,4 @@
package club.joylink.rtss.entity.race2; package club.joylink.rtss.entity.question;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -7,11 +7,10 @@ import lombok.Data;
/** /**
* @author * @author
* *
*/ */
@Data @Data
public class RaceQuestion2 implements Serializable { public class PaperQuestion implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
@ -46,7 +45,13 @@ public class RaceQuestion2 implements Serializable {
* 标签 * 标签
*/ */
private String raceLable; private String raceLable;
/**
* 是否删除0=1=
*/
private Integer isDel;
private String topic; private String topic;
private String questions; private String questions;
private static final long serialVersionUID = 1L;
} }

View File

@ -1,10 +1,10 @@
package club.joylink.rtss.entity.race2; package club.joylink.rtss.entity.question;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
public class RaceQuestion2Example { public class PaperQuestionExample {
protected String orderByClause; protected String orderByClause;
protected boolean distinct; protected boolean distinct;
@ -15,7 +15,7 @@ public class RaceQuestion2Example {
private Long offset; private Long offset;
public RaceQuestion2Example() { public PaperQuestionExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }
@ -224,6 +224,7 @@ public class RaceQuestion2Example {
addCriterion("`type` <=", value, "type"); addCriterion("`type` <=", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTopicLike(String value) { public Criteria andTopicLike(String value) {
addCriterion("`topic` like", value, "topic"); addCriterion("`topic` like", value, "topic");
return (Criteria) this; return (Criteria) this;
@ -577,6 +578,66 @@ public class RaceQuestion2Example {
addCriterion("race_lable not between", value1, value2, "raceLable"); addCriterion("race_lable not between", value1, value2, "raceLable");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsDelIsNull() {
addCriterion("is_del is null");
return (Criteria) this;
}
public Criteria andIsDelIsNotNull() {
addCriterion("is_del is not null");
return (Criteria) this;
}
public Criteria andIsDelEqualTo(Integer value) {
addCriterion("is_del =", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotEqualTo(Integer value) {
addCriterion("is_del <>", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThan(Integer value) {
addCriterion("is_del >", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThanOrEqualTo(Integer value) {
addCriterion("is_del >=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThan(Integer value) {
addCriterion("is_del <", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThanOrEqualTo(Integer value) {
addCriterion("is_del <=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelIn(List<Integer> values) {
addCriterion("is_del in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotIn(List<Integer> values) {
addCriterion("is_del not in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelBetween(Integer value1, Integer value2) {
addCriterion("is_del between", value1, value2, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotBetween(Integer value1, Integer value2) {
addCriterion("is_del not between", value1, value2, "isDel");
return (Criteria) this;
}
} }
/** /**

View File

@ -1,4 +1,4 @@
package club.joylink.rtss.entity.race2; package club.joylink.rtss.entity.question;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
@ -8,7 +8,7 @@ import lombok.Data;
* *
*/ */
@Data @Data
public class RaceQuestion2WithBLOBs extends RaceQuestion2 implements Serializable { public class PaperQuestionWithBLOBs extends PaperQuestion implements Serializable {
/** /**
* 问题内容 * 问题内容
*/ */
@ -17,4 +17,4 @@ public class RaceQuestion2WithBLOBs extends RaceQuestion2 implements Serializabl
private String questions; private String questions;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -2,17 +2,19 @@ package club.joylink.rtss.services.completition.question;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.Project; import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.RaceQuestion2DAO; import club.joylink.rtss.dao.PagerQuestionDAO;
import club.joylink.rtss.entity.race2.RaceQuestion2; import club.joylink.rtss.entity.question.PaperQuestion;
import club.joylink.rtss.entity.race2.RaceQuestion2Example; import club.joylink.rtss.entity.question.PaperQuestionExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
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.client.question.QuestionQueryVO; import club.joylink.rtss.vo.client.question.QuestionQueryVO;
import club.joylink.rtss.vo.client.question.v2.QuestionOptionVO2; import club.joylink.rtss.vo.client.question.v2.PaperQuestionOptionVO2;
import club.joylink.rtss.vo.client.question.v2.QuestionVO2; import club.joylink.rtss.vo.client.question.v2.PaperQuestionVO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
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;
@ -26,21 +28,21 @@ import java.util.stream.Collectors;
@Service @Service
public class QuestionBankService2 { public class QuestionBankService2 {
@Resource @Resource
private RaceQuestion2DAO questionDAO; private PagerQuestionDAO questionDAO;
private Object queryQuestions(QuestionQueryVO queryVO,boolean isPaging){ private Object queryQuestions(QuestionQueryVO queryVO,boolean isPaging){
if(isPaging){ if(isPaging){
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
} }
RaceQuestion2Example example = new RaceQuestion2Example(); PaperQuestionExample example = new PaperQuestionExample();
RaceQuestion2Example.Criteria criteria = example.createCriteria(); PaperQuestionExample.Criteria criteria = example.createCriteria();
if (StringUtils.hasText(queryVO.getTopic())) { if (StringUtils.hasText(queryVO.getTopic())) {
criteria.andTopicLike(String.format("%%%s%%", queryVO.getTopic())); criteria.andTopicLike(String.format("%%%s%%", queryVO.getTopic()));
} }
if (StringUtils.hasText(queryVO.getType())) { if (StringUtils.hasText(queryVO.getType())) {
criteria.andTypeEqualTo(queryVO.getType()); criteria.andTypeEqualTo(queryVO.getType());
} }
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
boolean isDefault = Project.isDefault(Project.valueOf(queryVO.getProjectCode())); boolean isDefault = Project.isDefault(Project.valueOf(queryVO.getProjectCode()));
if (isDefault) { if (isDefault) {
criteria.andProjectCodeIsNull(); criteria.andProjectCodeIsNull();
@ -60,9 +62,9 @@ public class QuestionBankService2 {
* @param queryVO * @param queryVO
* @return * @return
*/ */
public PageVO<QuestionVO2> pagingQueryQuestions(QuestionQueryVO queryVO) { public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO) {
Page<RaceQuestion2> page = (Page<RaceQuestion2>) this.queryQuestions(queryVO,true); Page<PaperQuestion> page = (Page<PaperQuestion>) this.queryQuestions(queryVO,true);
List<QuestionVO2> questionVOS = QuestionVO2.convert2VOList(page.getResult()); List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(page.getResult());
return PageVO.convert(page, questionVOS); return PageVO.convert(page, questionVOS);
} }
@ -72,9 +74,9 @@ public class QuestionBankService2 {
* @param queryVO * @param queryVO
* @return * @return
*/ */
public List<QuestionVO2> queryQuestions(QuestionQueryVO queryVO) { public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO) {
List<RaceQuestion2> list = (List<RaceQuestion2>) this.queryQuestions(queryVO,true); List<PaperQuestion> list = (List<PaperQuestion>) this.queryQuestions(queryVO,true);
List<QuestionVO2> questionVOS = QuestionVO2.convert2VOList(list); List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
return questionVOS; return questionVOS;
} }
@ -84,10 +86,11 @@ public class QuestionBankService2 {
* @param questionId * @param questionId
* @return * @return
*/ */
public QuestionVO2 getQuestion(Long questionId) { public PaperQuestionVO getQuestion(Long questionId) {
RaceQuestion2 question = questionDAO.selectByPrimaryKey(questionId); PaperQuestion question = questionDAO.selectByPrimaryKey(questionId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(question);
QuestionVO2 questionVO = new QuestionVO2(question); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(question) || question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal());
PaperQuestionVO questionVO = new PaperQuestionVO(question);
return questionVO; return questionVO;
} }
@ -96,18 +99,26 @@ public class QuestionBankService2 {
* @param companyId * @param companyId
*/ */
public Collection<String> findAllLable(Long companyId){ public Collection<String> findAllLable(Long companyId){
List<String> lableList = this.questionDAO.findAllLableByCompanyId(companyId); PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
criteria.andCompanyIdEqualTo(companyId);
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
List<PaperQuestion> lableList = this.questionDAO.selectByExample(example);
if(CollectionUtils.isEmpty(lableList)){ if(CollectionUtils.isEmpty(lableList)){
return Collections.emptyList(); return Collections.emptyList();
} }
return lableList.stream().filter(Objects::nonNull).flatMap(d-> Arrays.stream(d.split(","))).collect(Collectors.toSet()); return lableList.stream().map(PaperQuestion::getRaceLable).filter(Objects::nonNull).flatMap(d-> Splitter.on(",").omitEmptyStrings()
.trimResults().splitToStream(d)).collect(Collectors.toSet());
} }
public List<QuestionVO2> queryQuestionsForRaceLable(Long companyId,String raceLable) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(raceLable)
,"查询标签不能为空"); public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, Map<String,String> raceMap) {
List<RaceQuestion2> list = this.questionDAO.findByCompanyIdAndRaceLable(companyId,raceLable); String raceLableStr = Objects.isNull(raceMap) ? null :raceMap.get("raceLable");
List<QuestionVO2> questionVOS = QuestionVO2.convert2VOList(list); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!Strings.isNullOrEmpty(raceLableStr),"查询标签不能为空");
List<String> raceLableList = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(raceLableStr);
List<PaperQuestion> list = this.questionDAO.findByCompanyIdAndRaceLable(companyId,BusinessConsts.DBLogicDelete.NORMAL.ordinal(),raceLableList);
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
return questionVOS; return questionVOS;
} }
/** /**
@ -115,7 +126,7 @@ public class QuestionBankService2 {
* @param questionVO * @param questionVO
* @param accountVO * @param accountVO
*/ */
public void saveOrUpdate(QuestionVO2 questionVO, AccountVO accountVO) { public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue((Objects.equals(BusinessConsts.TheoryType.select.name(),questionVO.getType()) BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue((Objects.equals(BusinessConsts.TheoryType.select.name(),questionVO.getType())
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),questionVO.getType()) || Objects.equals(BusinessConsts.TheoryType.multi.name(),questionVO.getType())) || Objects.equals(BusinessConsts.TheoryType.judge.name(),questionVO.getType()) || Objects.equals(BusinessConsts.TheoryType.multi.name(),questionVO.getType()))
,"题库目前只支持单选,多选和判断"); ,"题库目前只支持单选,多选和判断");
@ -123,19 +134,23 @@ public class QuestionBankService2 {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
(Objects.equals(BusinessConsts.TheoryType.select.name(), questionVO.getType()) || (Objects.equals(BusinessConsts.TheoryType.select.name(), questionVO.getType()) ||
Objects.equals(BusinessConsts.TheoryType.judge.name(), questionVO.getType())) && Objects.equals(BusinessConsts.TheoryType.judge.name(), questionVO.getType())) &&
questionVO.getOptionList().stream().filter(QuestionOptionVO2::getCorrect).count() == 1, questionVO.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count() == 1,
"单选或判断题正确答案有且只有一个!"); "单选或判断题正确答案有且只有一个!");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(
(Objects.equals(BusinessConsts.TheoryType.multi.name(), questionVO.getType())) && (Objects.equals(BusinessConsts.TheoryType.multi.name(), questionVO.getType())) &&
questionVO.getOptionList().stream().filter(QuestionOptionVO2::getCorrect).count() <= 1, questionVO.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count() <= 1,
"多选题正确答案必须是2个以上"); "多选题正确答案必须是2个以上");
RaceQuestion2 question = questionVO.convert2DB(); PaperQuestion question = questionVO.convert2DB();
question.setCreateUserId(accountVO.getId()); question.setCreateUserId(accountVO.getId());
question.setCreateTime(LocalDateTime.now()); question.setCreateTime(LocalDateTime.now());
question.setIsDel(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
if(Objects.nonNull(questionVO.getId())){ if(Objects.nonNull(questionVO.getId())){
Long exist = this.questionDAO.checkExistByPK(questionVO.getId()); PaperQuestionExample example = new PaperQuestionExample();
if(Objects.isNull(exist)){ PaperQuestionExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(questionVO.getId());
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
Long exist = this.questionDAO.countByExample(example);
if(Objects.isNull(exist) || exist <= 0){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(true, BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(true,
"未找到要修改的数据!"); "未找到要修改的数据!");
} }
@ -147,9 +162,8 @@ public class QuestionBankService2 {
} }
@Transactional @Transactional
public void importProjectQuestion(List<QuestionVO2> questions, String projectCode, Long companyId, AccountVO accountVO) { public void importProjectQuestion(List<PaperQuestionVO> questions, String projectCode, Long companyId, AccountVO accountVO) {
questions.forEach(questionVO -> { questions.forEach(questionVO -> {
String topic = questionVO.getTopic(); String topic = questionVO.getTopic();
@ -157,7 +171,7 @@ public class QuestionBankService2 {
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),questionVO.getType()) || Objects.equals(BusinessConsts.TheoryType.multi.name(),questionVO.getType())) || Objects.equals(BusinessConsts.TheoryType.judge.name(),questionVO.getType()) || Objects.equals(BusinessConsts.TheoryType.multi.name(),questionVO.getType()))
,String.format("题库目前只支持单选,多选和判断,题序[%s]",questionVO.getId())); ,String.format("题库目前只支持单选,多选和判断,题序[%s]",questionVO.getId()));
long answerCount = questionVO.getOptionList().stream().filter(QuestionOptionVO2::getCorrect).count(); long answerCount = questionVO.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
if (questionVO.isSelect() || questionVO.isJudge()) { if (questionVO.isSelect() || questionVO.isJudge()) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1, BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1,
String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic)); String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
@ -170,8 +184,8 @@ public class QuestionBankService2 {
boolean isDefault = Project.isDefault(Project.valueOf(projectCode)); boolean isDefault = Project.isDefault(Project.valueOf(projectCode));
//默认项目导入题考虑是否有单位关联 //默认项目导入题考虑是否有单位关联
if (isDefault) { if (isDefault) {
RaceQuestion2Example example = new RaceQuestion2Example(); PaperQuestionExample example = new PaperQuestionExample();
RaceQuestion2Example.Criteria criteria = example.createCriteria(); PaperQuestionExample.Criteria criteria = example.createCriteria();
criteria.andProjectCodeIsNull(); criteria.andProjectCodeIsNull();
if (Objects.nonNull(companyId)) { if (Objects.nonNull(companyId)) {
criteria.andCompanyIdEqualTo(companyId); criteria.andCompanyIdEqualTo(companyId);
@ -181,25 +195,27 @@ public class QuestionBankService2 {
questionDAO.deleteByExample(example); questionDAO.deleteByExample(example);
questions.forEach(questionVO -> { questions.forEach(questionVO -> {
questionVO.setProjectCode(projectCode); questionVO.setProjectCode(projectCode);
RaceQuestion2 question = questionVO.convert2DB(); PaperQuestion question = questionVO.convert2DB();
question.setProjectCode(null); question.setProjectCode(null);
question.setCreateUserId(accountVO.getId()); question.setCreateUserId(accountVO.getId());
question.setCreateTime(LocalDateTime.now()); question.setCreateTime(LocalDateTime.now());
question.setCompanyId(companyId); question.setCompanyId(companyId);
question.setIsDel(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
questionDAO.insert(question); questionDAO.insert(question);
}); });
} else { } else {
//非默认项目导入题 //非默认项目导入题
RaceQuestion2Example example = new RaceQuestion2Example(); PaperQuestionExample example = new PaperQuestionExample();
example.createCriteria().andProjectCodeEqualTo(projectCode); example.createCriteria().andProjectCodeEqualTo(projectCode);
questionDAO.deleteByExample(example); questionDAO.deleteByExample(example);
questions.forEach(questionVO -> { questions.forEach(questionVO -> {
questionVO.setProjectCode(projectCode); questionVO.setProjectCode(projectCode);
RaceQuestion2 question = questionVO.convert2DB(); PaperQuestion question = questionVO.convert2DB();
question.setProjectCode(projectCode); question.setProjectCode(projectCode);
question.setCreateUserId(accountVO.getId()); question.setCreateUserId(accountVO.getId());
question.setCreateTime(LocalDateTime.now()); question.setCreateTime(LocalDateTime.now());
question.setIsDel(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
questionDAO.insert(question); questionDAO.insert(question);
}); });
} }
@ -208,7 +224,11 @@ public class QuestionBankService2 {
public void deleteQuestion(Long questionId) { public void deleteQuestion(List<Long> questionId) {
questionDAO.deleteByPrimaryKey(questionId); PaperQuestionExample example = new PaperQuestionExample();
example.createCriteria().andIdIn(questionId);
PaperQuestion pq = new PaperQuestion();
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
questionDAO.updateByExampleSelective(pq,example);
} }
} }

View File

@ -17,7 +17,7 @@ import java.util.List;
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
public class QuestionOptionVO2 implements Cloneable { public class PaperQuestionOptionVO2 implements Cloneable {
private Long id; private Long id;
private Long questionId; private Long questionId;
@ -32,7 +32,7 @@ public class QuestionOptionVO2 implements Cloneable {
@NotNull(message = "题目没有设置正确选项") @NotNull(message = "题目没有设置正确选项")
private Boolean correct; private Boolean correct;
public QuestionOptionVO2(RaceQuestionOption questionOption) { public PaperQuestionOptionVO2(RaceQuestionOption questionOption) {
this.id = questionOption.getId(); this.id = questionOption.getId();
this.questionId = questionOption.getQuestionId(); this.questionId = questionOption.getQuestionId();
this.content = questionOption.getContent(); this.content = questionOption.getContent();
@ -49,10 +49,10 @@ public class QuestionOptionVO2 implements Cloneable {
return questionOption; return questionOption;
} }
public static List<QuestionOptionVO2> convert2VOList(List<RaceQuestionOption> options){ public static List<PaperQuestionOptionVO2> convert2VOList(List<RaceQuestionOption> options){
List<QuestionOptionVO2> voList = new ArrayList<>(); List<PaperQuestionOptionVO2> voList = new ArrayList<>();
if(!CollectionUtils.isEmpty(options)) { if(!CollectionUtils.isEmpty(options)) {
options.forEach(option -> voList.add(new QuestionOptionVO2(option))); options.forEach(option -> voList.add(new PaperQuestionOptionVO2(option)));
} }
return voList; return voList;
} }

View File

@ -2,10 +2,8 @@ package club.joylink.rtss.vo.client.question.v2;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.Project; import club.joylink.rtss.constants.Project;
import club.joylink.rtss.entity.RaceQuestion; import club.joylink.rtss.entity.question.PaperQuestion;
import club.joylink.rtss.entity.race2.RaceQuestion2;
import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.question.QuestionOptionVO;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -23,7 +21,7 @@ import java.util.stream.Collectors;
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
public class QuestionVO2 implements Cloneable { public class PaperQuestionVO implements Cloneable {
private Long id; private Long id;
@ -43,7 +41,7 @@ public class QuestionVO2 implements Cloneable {
/** /**
*选项列表 *选项列表
*/ */
private List<QuestionOptionVO2> optionList; private List<PaperQuestionOptionVO2> optionList;
private Long createUserId; private Long createUserId;
@ -57,43 +55,45 @@ public class QuestionVO2 implements Cloneable {
*/ */
private Float score = 1f; private Float score = 1f;
public QuestionVO2(RaceQuestion2 question) { public PaperQuestionVO(PaperQuestion question) {
this.id = question.getId(); this.id = question.getId();
this.type = question.getType(); this.type = question.getType();
this.topic = question.getTopic(); this.topic = question.getTopic();
this.projectCode = question.getProjectCode(); this.projectCode = question.getProjectCode();
this.companyId = question.getCompanyId(); this.companyId = question.getCompanyId();
this.raceLable = question.getRaceLable(); this.raceLable = question.getRaceLable();
this.optionList = JsonUtils.readCollection(question.getQuestions(),ArrayList.class,QuestionOptionVO2.class); this.optionList = JsonUtils.readCollection(question.getQuestions(),ArrayList.class, PaperQuestionOptionVO2.class);
} }
public RaceQuestion2 convert2DB() { public PaperQuestion convert2DB() {
RaceQuestion2 question = new RaceQuestion2(); PaperQuestion question = new PaperQuestion();
question.setId(this.id);
question.setType(type); question.setType(type);
question.setTopic(topic); question.setTopic(topic);
question.setProjectCode(Project.isDefault(Project.valueOf(projectCode)) ? null : projectCode); question.setProjectCode(Project.isDefault(Project.valueOf(projectCode)) ? null : projectCode);
question.setCompanyId(companyId); question.setCompanyId(companyId);
question.setQuestions(JsonUtils.writeValueAsString(this.optionList)); question.setQuestions(JsonUtils.writeValueAsString(this.optionList));
question.setRaceLable(this.raceLable); question.setRaceLable(this.raceLable);
return question; return question;
} }
public static List<QuestionVO2> convert2VOList(List<RaceQuestion2> questions){ public static List<PaperQuestionVO> convert2VOList(List<PaperQuestion> questions){
List<QuestionVO2> voList = new ArrayList<>(); List<PaperQuestionVO> voList = new ArrayList<>();
if(!CollectionUtils.isEmpty(questions)) { if(!CollectionUtils.isEmpty(questions)) {
questions.forEach(e -> voList.add(new QuestionVO2(e))); questions.forEach(e -> voList.add(new PaperQuestionVO(e)));
} }
return voList; return voList;
} }
@Override @Override
public QuestionVO2 clone() throws CloneNotSupportedException { public PaperQuestionVO clone() throws CloneNotSupportedException {
QuestionVO2 clone = (QuestionVO2) super.clone(); PaperQuestionVO clone = (PaperQuestionVO) super.clone();
AtomicBoolean error = new AtomicBoolean(false); AtomicBoolean error = new AtomicBoolean(false);
List<QuestionOptionVO2> cloneList = optionList.stream().map(questionOption -> { List<PaperQuestionOptionVO2> cloneList = optionList.stream().map(questionOption -> {
try { try {
return (QuestionOptionVO2) questionOption.clone(); return (PaperQuestionOptionVO2) questionOption.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -1,22 +0,0 @@
package club.joylink.rtss.vo.client.question.v2;
import java.io.Serializable;
import club.joylink.rtss.entity.race2.RaceQuestion2;
import lombok.Data;
/**
* @author
*
*/
@Data
public class RaceQuestion2WithBLOBs extends RaceQuestion2 implements Serializable {
/**
* 问题内容
*/
private String topic;
private String questions;
private static final long serialVersionUID = 1L;
}

View File

@ -50,6 +50,8 @@ spring:
mybatis: mybatis:
mapper-locations: classpath:mybatis/mapper/*.xml mapper-locations: classpath:mybatis/mapper/*.xml
type-aliases-package: club.joylink.rtss.entity type-aliases-package: club.joylink.rtss.entity
configuration:
map-underscore-to-camel-case: true
pagehelper: pagehelper:
helper-dialect: mysql helper-dialect: mysql

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.RaceQuestion2DAO"> <mapper namespace="club.joylink.rtss.dao.PagerQuestionDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.race2.RaceQuestion2"> <resultMap id="BaseResultMap" type="club.joylink.rtss.entity.question.PaperQuestion">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="type" jdbcType="VARCHAR" property="type" /> <result column="type" jdbcType="VARCHAR" property="type" />
<result column="create_user_id" jdbcType="BIGINT" property="createUserId" /> <result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
@ -9,11 +9,13 @@
<result column="project_code" jdbcType="VARCHAR" property="projectCode" /> <result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="company_id" jdbcType="BIGINT" property="companyId" /> <result column="company_id" jdbcType="BIGINT" property="companyId" />
<result column="race_lable" jdbcType="VARCHAR" property="raceLable" /> <result column="race_lable" jdbcType="VARCHAR" property="raceLable" />
<result column="is_del" jdbcType="INTEGER" property="isDel" />
<result column="topic" jdbcType="LONGVARCHAR" property="topic" /> <result column="topic" jdbcType="LONGVARCHAR" property="topic" />
<result column="questions" jdbcType="LONGVARCHAR" property="questions" /> <result column="questions" jdbcType="LONGVARCHAR" property="questions" />
</resultMap> </resultMap>
<!-- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.race2.RaceQuestion2WithBLOBs"> <!-- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.race2.PaperQuestionWithBLOBs">
<result column="topic" jdbcType="LONGVARCHAR" property="topic" />
<result column="questions" jdbcType="LONGVARCHAR" property="questions" />
</resultMap>--> </resultMap>-->
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -74,12 +76,12 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `type`, create_user_id, create_time, project_code, company_id, race_lable,topic, questions id, `type`, create_user_id, create_time, project_code, company_id, race_lable, is_del
</sql> </sql>
<!--<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
topic, questions topic, questions
</sql>--> </sql>
<!-- <select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2Example" resultMap="ResultMapWithBLOBs"> <!--<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.race2.PaperQuestionExample" resultMap="ResultMapWithBLOBs">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -87,7 +89,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
, ,
<include refid="Blob_Column_List" /> <include refid="Blob_Column_List" />
from race_question2 from paper_question
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
@ -103,15 +105,15 @@
</if> </if>
</if> </if>
</select>--> </select>-->
<select id="selectByExample" parameterType="club.joylink.rtss.entity.question.PaperQuestionExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2Example" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from race_question2 ,
<include refid="Blob_Column_List" />
from paper_question
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
@ -128,34 +130,35 @@
</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 race_question2 <include refid="Blob_Column_List" />
from paper_question
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from race_question2 delete from paper_question
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2Example"> <delete id="deleteByExample" parameterType="club.joylink.rtss.entity.question.PaperQuestionExample">
delete from race_question2 delete from paper_question
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2"> <insert id="insert" parameterType="club.joylink.rtss.entity.question.PaperQuestionWithBLOBs">
insert into race_question2 (id, `type`, create_user_id, insert into paper_question (id, `type`, create_user_id,
create_time, project_code, company_id, create_time, project_code, company_id,
race_lable, topic, questions race_lable, is_del, topic,
) questions)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{createUserId,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{createUserId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{projectCode,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{projectCode,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT},
#{raceLable,jdbcType=VARCHAR}, #{topic,jdbcType=LONGVARCHAR}, #{questions,jdbcType=LONGVARCHAR} #{raceLable,jdbcType=VARCHAR}, #{isDel,jdbcType=INTEGER}, #{topic,jdbcType=LONGVARCHAR},
) #{questions,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2WithBLOBs"> <insert id="insertSelective" parameterType="club.joylink.rtss.entity.question.PaperQuestionWithBLOBs">
insert into race_question2 insert into paper_question
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
@ -178,6 +181,9 @@
<if test="raceLable != null"> <if test="raceLable != null">
race_lable, race_lable,
</if> </if>
<if test="isDel != null">
is_del,
</if>
<if test="topic != null"> <if test="topic != null">
topic, topic,
</if> </if>
@ -207,6 +213,9 @@
<if test="raceLable != null"> <if test="raceLable != null">
#{raceLable,jdbcType=VARCHAR}, #{raceLable,jdbcType=VARCHAR},
</if> </if>
<if test="isDel != null">
#{isDel,jdbcType=INTEGER},
</if>
<if test="topic != null"> <if test="topic != null">
#{topic,jdbcType=LONGVARCHAR}, #{topic,jdbcType=LONGVARCHAR},
</if> </if>
@ -215,14 +224,14 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2Example" resultType="java.lang.Long"> <select id="countByExample" parameterType="club.joylink.rtss.entity.question.PaperQuestionExample" resultType="java.lang.Long">
select count(*) from race_question2 select count(*) from paper_question
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update race_question2 update paper_question
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
@ -245,6 +254,9 @@
<if test="record.raceLable != null"> <if test="record.raceLable != null">
race_lable = #{record.raceLable,jdbcType=VARCHAR}, race_lable = #{record.raceLable,jdbcType=VARCHAR},
</if> </if>
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=INTEGER},
</if>
<if test="record.topic != null"> <if test="record.topic != null">
topic = #{record.topic,jdbcType=LONGVARCHAR}, topic = #{record.topic,jdbcType=LONGVARCHAR},
</if> </if>
@ -257,37 +269,40 @@
</if> </if>
</update> </update>
<!-- <update id="updateByExampleWithBLOBs" parameterType="map"> <!-- <update id="updateByExampleWithBLOBs" parameterType="map">
update race_question2 update paper_question
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=BIGINT}, create_user_id = #{record.createUserId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
project_code = #{record.projectCode,jdbcType=VARCHAR}, project_code = #{record.projectCode,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=BIGINT}, company_id = #{record.companyId,jdbcType=BIGINT},
race_lable = #{record.raceLable,jdbcType=VARCHAR}, race_lable = #{record.raceLable,jdbcType=VARCHAR},
topic = #{record.topic,jdbcType=LONGVARCHAR}, is_del = #{record.isDel,jdbcType=INTEGER},
questions = #{record.questions,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>-->
<update id="updateByExample" parameterType="map">
update race_question2
set id = #{record.id,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
project_code = #{record.projectCode,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=BIGINT},
race_lable = #{record.raceLable,jdbcType=VARCHAR},
topic = #{record.topic,jdbcType=LONGVARCHAR}, topic = #{record.topic,jdbcType=LONGVARCHAR},
questions = #{record.questions,jdbcType=LONGVARCHAR} questions = #{record.questions,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>-->
<update id="updateByExample" parameterType="map">
update paper_question
set id = #{record.id,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
project_code = #{record.projectCode,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=BIGINT},
race_lable = #{record.raceLable,jdbcType=VARCHAR},
is_del = #{record.isDel,jdbcType=INTEGER},
topic = #{record.topic,jdbcType=LONGVARCHAR},
questions = #{record.questions,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2WithBLOBs"> <update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.question.PaperQuestionWithBLOBs">
update race_question2 update paper_question
<set> <set>
<if test="type != null"> <if test="type != null">
`type` = #{type,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR},
@ -307,6 +322,9 @@
<if test="raceLable != null"> <if test="raceLable != null">
race_lable = #{raceLable,jdbcType=VARCHAR}, race_lable = #{raceLable,jdbcType=VARCHAR},
</if> </if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=INTEGER},
</if>
<if test="topic != null"> <if test="topic != null">
topic = #{topic,jdbcType=LONGVARCHAR}, topic = #{topic,jdbcType=LONGVARCHAR},
</if> </if>
@ -316,26 +334,28 @@
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<!-- <update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2WithBLOBs"> <!-- <update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.question.PaperQuestionWithBLOBs">
update race_question2 update paper_question
set `type` = #{type,jdbcType=VARCHAR}, set `type` = #{type,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=BIGINT}, create_user_id = #{createUserId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
project_code = #{projectCode,jdbcType=VARCHAR}, project_code = #{projectCode,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=BIGINT}, company_id = #{companyId,jdbcType=BIGINT},
race_lable = #{raceLable,jdbcType=VARCHAR}, race_lable = #{raceLable,jdbcType=VARCHAR},
topic = #{topic,jdbcType=LONGVARCHAR}, is_del = #{isDel,jdbcType=INTEGER},
questions = #{questions,jdbcType=LONGVARCHAR} topic = #{topic,jdbcType=LONGVARCHAR},
questions = #{questions,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update>--> </update>-->
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.race2.RaceQuestion2"> <update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.question.PaperQuestion">
update race_question2 update paper_question
set `type` = #{type,jdbcType=VARCHAR}, set `type` = #{type,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=BIGINT}, create_user_id = #{createUserId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
project_code = #{projectCode,jdbcType=VARCHAR}, project_code = #{projectCode,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=BIGINT}, company_id = #{companyId,jdbcType=BIGINT},
race_lable = #{raceLable,jdbcType=VARCHAR}, race_lable = #{raceLable,jdbcType=VARCHAR},
is_del = #{isDel,jdbcType=INTEGER},
topic = #{topic,jdbcType=LONGVARCHAR}, topic = #{topic,jdbcType=LONGVARCHAR},
questions = #{questions,jdbcType=LONGVARCHAR} questions = #{questions,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}