Skip to content

Commit 6b3f4ba

Browse files
committed
部分优化+添加毕设任务书
1 parent 95c7a4a commit 6b3f4ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+215
-56
lines changed

src/main/java/com/njxz/exam/controller/TestPaperController.java

Lines changed: 149 additions & 20 deletions
Large diffs are not rendered by default.

src/main/java/com/njxz/exam/dao/ExamQuestiontypeMapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ public interface ExamQuestiontypeMapper {
2929
int updateByPrimaryKey(ExamQuestiontype record);
3030

3131
int insertList(@Param("list")List<ExamQuestiontype> list);
32+
33+
public List<ExamQuestiontype> allExamQuestiontypes(@Param("eId")Long eId);
3234
}

src/main/java/com/njxz/exam/dao/QuestionsMapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ public interface QuestionsMapper {
2929
int updateByPrimaryKey(Questions record);
3030

3131
public int countgetBy(Long qId);
32+
33+
public List<Questions> getQuestionsByEIdAndEQTId(@Param("eId")Long eId,@Param("eqtId") Long eqtId);
3234
}

src/main/java/com/njxz/exam/mapper/ExamQuestionsMapper.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
</selectKey>
203203
insert into exam_questions(exam_id,exam_type,question_id) values
204204
<foreach collection="list" item="item" index="index" separator=",">
205-
(#{item.examId,jdbcType=BIGINT},#{item.questionId,jdbcType=BIGINT},#{item.examType,jdbcType=TINYINT})
205+
(#{item.examId,jdbcType=BIGINT},#{item.examType,jdbcType=TINYINT},#{item.questionId,jdbcType=BIGINT})
206206
</foreach>
207207
</insert>
208208
</mapper>

src/main/java/com/njxz/exam/mapper/ExamQuestiontypeMapper.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,9 @@
237237
(#{item.examId,jdbcType=BIGINT},#{item.questionTypeId,jdbcType=BIGINT},#{item.questionNum,jdbcType=SMALLINT},#{item.typeScore,jdbcType=SMALLINT},#{item.typeSort,jdbcType=TINYINT})
238238
</foreach>
239239
</insert>
240+
241+
<!-- 选择某试卷的所有题型,按照升序排列 -->
242+
<select id="allExamQuestiontypes" parameterType="java.lang.Long" resultMap="BaseResultMap">
243+
select * from exam_questiontype eqt where eqt.exam_id=#{eId,jdbcType=BIGINT} ORDER BY eqt.type_sort asc
244+
</select>
240245
</mapper>

src/main/java/com/njxz/exam/service/ExamQuestionsService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ public interface ExamQuestionsService {
99
public int add(ExamQuestions examQuestions);
1010
//添加多条
1111
public int add(List<ExamQuestions> eqList);
12+
1213
}

src/main/java/com/njxz/exam/service/ExamQuestiontypeService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ public interface ExamQuestiontypeService {
1414
//试卷题型个数
1515
public int countByEId(Long eId);
1616

17+
//取出试卷所有题型--按照type_sort升序排列
18+
public List<ExamQuestiontype> allExamQuestiontypes(Long eId);
19+
1720
}

src/main/java/com/njxz/exam/service/QuestionService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ public interface QuestionService {
2828
//题目的抽取次数
2929
public int countgetBy(Long qId);
3030

31+
//根据试卷和题型取出试题,并根据难易度升序排序--和questions表外连接、
32+
public List<Questions> getQuestionsByEIdAndEQTId(Long eId,Long eqtId);
33+
3134
}

src/main/java/com/njxz/exam/serviceImpl/ExamQuestionsServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import com.njxz.exam.dao.ExamQuestionsMapper;
99
import com.njxz.exam.modle.ExamQuestions;
10+
import com.njxz.exam.modle.Questions;
1011
import com.njxz.exam.service.ExamQuestionsService;
1112

1213
@Service("examQuestionsService")
@@ -26,5 +27,5 @@ public int add(List<ExamQuestions> eqList) {
2627
// TODO Auto-generated method stub
2728
return examQuestionsMapper.insertList(eqList);
2829
}
29-
30+
3031
}

src/main/java/com/njxz/exam/serviceImpl/ExamQuestiontypeServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,9 @@ public int countByEId(Long eId) {
3838
return (int)eqtMapper.countByExample(example);
3939
}
4040

41+
@Override
42+
public List<ExamQuestiontype> allExamQuestiontypes(Long eId) {
43+
return eqtMapper.allExamQuestiontypes(eId);
44+
}
45+
4146
}

0 commit comments

Comments
 (0)