diff --git a/src/main/java/com/sztzjy/fund_investment/entity/TopicRecord.java b/src/main/java/com/sztzjy/fund_investment/entity/TopicRecord.java index 9f4d773..c90117d 100644 --- a/src/main/java/com/sztzjy/fund_investment/entity/TopicRecord.java +++ b/src/main/java/com/sztzjy/fund_investment/entity/TopicRecord.java @@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModelProperty; * topic_record */ public class TopicRecord { - private String id; + private Integer id; @ApiModelProperty("题目ID") private String topicId; @@ -41,12 +41,12 @@ public class TopicRecord { @ApiModelProperty("正确答案") private String answer; - public String getId() { + public Integer getId() { return id; } - public void setId(String id) { - this.id = id == null ? null : id.trim(); + public void setId(Integer id) { + this.id = id; } public String getTopicId() { diff --git a/src/main/java/com/sztzjy/fund_investment/entity/TopicRecordExample.java b/src/main/java/com/sztzjy/fund_investment/entity/TopicRecordExample.java index ffcbea6..7e1eb45 100644 --- a/src/main/java/com/sztzjy/fund_investment/entity/TopicRecordExample.java +++ b/src/main/java/com/sztzjy/fund_investment/entity/TopicRecordExample.java @@ -114,62 +114,52 @@ public class TopicRecordExample { return (Criteria) this; } - public Criteria andIdEqualTo(String value) { + public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } - public Criteria andIdNotEqualTo(String value) { + public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } - public Criteria andIdGreaterThan(String value) { + public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } - public Criteria andIdGreaterThanOrEqualTo(String value) { + public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } - public Criteria andIdLessThan(String value) { + public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } - public Criteria andIdLessThanOrEqualTo(String value) { + public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } - public Criteria andIdLike(String value) { - addCriterion("id like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotLike(String value) { - addCriterion("id not like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { + public Criteria andIdIn(List values) { addCriterion("id in", values, "id"); return (Criteria) this; } - public Criteria andIdNotIn(List values) { + public Criteria andIdNotIn(List values) { addCriterion("id not in", values, "id"); return (Criteria) this; } - public Criteria andIdBetween(String value1, String value2) { + public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } - public Criteria andIdNotBetween(String value1, String value2) { + public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } diff --git a/src/main/java/com/sztzjy/fund_investment/mapper/TopicRecordMapper.java b/src/main/java/com/sztzjy/fund_investment/mapper/TopicRecordMapper.java index 184bf28..b1b5827 100644 --- a/src/main/java/com/sztzjy/fund_investment/mapper/TopicRecordMapper.java +++ b/src/main/java/com/sztzjy/fund_investment/mapper/TopicRecordMapper.java @@ -12,7 +12,7 @@ public interface TopicRecordMapper { int deleteByExample(TopicRecordExample example); - int deleteByPrimaryKey(String id); + int deleteByPrimaryKey(Integer id); int insert(TopicRecord record); @@ -20,7 +20,7 @@ public interface TopicRecordMapper { List selectByExample(TopicRecordExample example); - TopicRecord selectByPrimaryKey(String id); + TopicRecord selectByPrimaryKey(Integer id); int updateByExampleSelective(@Param("record") TopicRecord record, @Param("example") TopicRecordExample example); diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java index 1abeabf..93c9edd 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java +++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java @@ -154,7 +154,6 @@ public class TopicServiceImpl implements TopicService { return new ResultEntity>(HttpStatus.BAD_REQUEST, "请勿重复提交!"); } int score = 0; - List list = new ArrayList<>(); String module = ""; for (TopicsWithBLOBs topic : topics) { String userAnswer = topic.getUserAnswer(); @@ -195,8 +194,6 @@ public class TopicServiceImpl implements TopicService { } //添加到答题记录表 TopicRecord topicRecord = new TopicRecord(); - String recordId = IdUtil.simpleUUID(); - topicRecord.setId(recordId); topicRecord.setTopicId(topicId); topicRecord.setUserAnswer(userAnswer); topicRecord.setAnswer(rightAnswer); @@ -213,7 +210,6 @@ public class TopicServiceImpl implements TopicService { topicRecord.setModule(module); topicRecord.setTopicType(topicType); topicRecordMapper.insert(topicRecord); - list.add(recordId); } PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId); @@ -244,7 +240,7 @@ public class TopicServiceImpl implements TopicService { performanceScoreMapper.updateByPrimaryKey(performanceScore); performanceScoreService.calculateScoreByModule("ipoListedConditionScore", score, flowId); } - return new ResultEntity<>(list); + return new ResultEntity<>(HttpStatus.OK,"提交成功!"); } @@ -318,7 +314,9 @@ public class TopicServiceImpl implements TopicService { public List getTopicRecord(String flowId, String module) { TopicRecordExample example = new TopicRecordExample(); example.createCriteria().andModuleEqualTo(module).andFlowIdEqualTo(flowId); - return topicRecordMapper.selectByExample(example); + example.setOrderByClause("id"); + List list = topicRecordMapper.selectByExample(example); + return list; } diff --git a/src/main/resources/mappers/TopicRecordMapper.xml b/src/main/resources/mappers/TopicRecordMapper.xml index 66e9ddc..860467c 100644 --- a/src/main/resources/mappers/TopicRecordMapper.xml +++ b/src/main/resources/mappers/TopicRecordMapper.xml @@ -2,7 +2,7 @@ - + @@ -92,15 +92,15 @@ order by ${orderByClause} - select from topic_record - where id = #{id,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} - + delete from topic_record - where id = #{id,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} delete from topic_record @@ -114,7 +114,7 @@ choicesA, choicesB, choicesC, choicesD, choicesE, user_answer, answer) - values (#{id,jdbcType=VARCHAR}, #{topicId,jdbcType=VARCHAR}, #{flowId,jdbcType=VARCHAR}, + values (#{id,jdbcType=INTEGER}, #{topicId,jdbcType=VARCHAR}, #{flowId,jdbcType=VARCHAR}, #{module,jdbcType=VARCHAR}, #{topicContent,jdbcType=VARCHAR}, #{topicType,jdbcType=VARCHAR}, #{choicesa,jdbcType=VARCHAR}, #{choicesb,jdbcType=VARCHAR}, #{choicesc,jdbcType=VARCHAR}, #{choicesd,jdbcType=VARCHAR}, #{choicese,jdbcType=VARCHAR}, #{userAnswer,jdbcType=VARCHAR}, @@ -165,7 +165,7 @@ - #{id,jdbcType=VARCHAR}, + #{id,jdbcType=INTEGER}, #{topicId,jdbcType=VARCHAR}, @@ -215,7 +215,7 @@ update topic_record - id = #{record.id,jdbcType=VARCHAR}, + id = #{record.id,jdbcType=INTEGER}, topic_id = #{record.topicId,jdbcType=VARCHAR}, @@ -260,7 +260,7 @@ update topic_record - set id = #{record.id,jdbcType=VARCHAR}, + set id = #{record.id,jdbcType=INTEGER}, topic_id = #{record.topicId,jdbcType=VARCHAR}, flow_id = #{record.flowId,jdbcType=VARCHAR}, module = #{record.module,jdbcType=VARCHAR}, @@ -317,7 +317,7 @@ answer = #{answer,jdbcType=VARCHAR}, - where id = #{id,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} update topic_record @@ -333,6 +333,6 @@ choicesE = #{choicese,jdbcType=VARCHAR}, user_answer = #{userAnswer,jdbcType=VARCHAR}, answer = #{answer,jdbcType=VARCHAR} - where id = #{id,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} \ No newline at end of file