refactor(exam): 重构摸底测试为考试词汇模块
- 删除原 Assessment 相关的实体、Mapper、Service 接口及实现和 Controller - 重命名常量类 AssessmentConstant 为 ExamWordsConstant 并调整相关常量值 - 新增 ExamWordsController 替代 AssessmentController,使用新模板生成试卷 - 新增 ExamWordsService 及其实现,实现按年级、等级和学生列表生成考试词汇 - 新增 ListWordIdTypeHandler 处理 List<Integer> 与数据库间的 JSON 转换 - 调整 PngUtil 中常量引用改为 ExamWordsConstant - 修改配置文件新增模板路径及临时目录设置 - 新增单元测试 ExamTest 验证考试词汇生成及文档导出功能 - 修改生成配置文件,支持 student_exam_words 表的数据操作 - 清理未使用的 Assessment 相关代码,精简项目结构
This commit is contained in:
@@ -1,156 +0,0 @@
|
||||
<?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">
|
||||
<mapper namespace="com.yinlihupo.enlish.service.domain.mapper.AssessmentsDOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.yinlihupo.enlish.service.domain.dataobject.AssessmentsDO">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="student_id" jdbcType="INTEGER" property="studentId" />
|
||||
<result column="test_date" jdbcType="TIMESTAMP" property="testDate" />
|
||||
<result column="test_type" jdbcType="INTEGER" property="testType" />
|
||||
<result column="level" jdbcType="INTEGER" property="level" />
|
||||
<result column="estimated_vocab_size" jdbcType="INTEGER" property="estimatedVocabSize" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.yinlihupo.enlish.service.domain.dataobject.AssessmentsDO">
|
||||
<result column="content_details_json" jdbcType="LONGVARCHAR" property="contentDetailsJson" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, student_id, test_date, test_type, level, estimated_vocab_size
|
||||
</sql>
|
||||
|
||||
<sql id="Blob_Column_List">
|
||||
content_details_json
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from assessments
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from assessments
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
|
||||
<insert id="insert" parameterType="com.yinlihupo.enlish.service.domain.dataobject.AssessmentsDO">
|
||||
insert into assessments (id, student_id, test_date,
|
||||
test_type, level, estimated_vocab_size,
|
||||
content_details_json)
|
||||
values (#{id,jdbcType=INTEGER}, #{studentId,jdbcType=INTEGER}, #{testDate,jdbcType=TIMESTAMP},
|
||||
#{testType,jdbcType=INTEGER}, #{level,jdbcType=INTEGER}, #{estimatedVocabSize,jdbcType=INTEGER},
|
||||
#{contentDetailsJson,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
|
||||
<insert id="insertSelective" parameterType="com.yinlihupo.enlish.service.domain.dataobject.AssessmentsDO">
|
||||
insert into assessments
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="studentId != null">
|
||||
student_id,
|
||||
</if>
|
||||
<if test="testDate != null">
|
||||
test_date,
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
test_type,
|
||||
</if>
|
||||
<if test="level != null">
|
||||
level,
|
||||
</if>
|
||||
<if test="estimatedVocabSize != null">
|
||||
estimated_vocab_size,
|
||||
</if>
|
||||
<if test="contentDetailsJson != null">
|
||||
content_details_json,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="studentId != null">
|
||||
#{studentId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="testDate != null">
|
||||
#{testDate,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
#{testType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="level != null">
|
||||
#{level,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="estimatedVocabSize != null">
|
||||
#{estimatedVocabSize,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="contentDetailsJson != null">
|
||||
#{contentDetailsJson,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.yinlihupo.enlish.service.domain.dataobject.AssessmentsDO">
|
||||
update assessments
|
||||
<set>
|
||||
<if test="studentId != null">
|
||||
student_id = #{studentId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="testDate != null">
|
||||
test_date = #{testDate,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
test_type = #{testType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="level != null">
|
||||
level = #{level,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="estimatedVocabSize != null">
|
||||
estimated_vocab_size = #{estimatedVocabSize,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="contentDetailsJson != null">
|
||||
content_details_json = #{contentDetailsJson,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.yinlihupo.enlish.service.domain.dataobject.AssessmentsDO">
|
||||
update assessments
|
||||
set student_id = #{studentId,jdbcType=INTEGER},
|
||||
test_date = #{testDate,jdbcType=TIMESTAMP},
|
||||
test_type = #{testType,jdbcType=INTEGER},
|
||||
level = #{level,jdbcType=INTEGER},
|
||||
estimated_vocab_size = #{estimatedVocabSize,jdbcType=INTEGER},
|
||||
content_details_json = #{contentDetailsJson,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<update id="updateByPrimaryKey" parameterType="com.yinlihupo.enlish.service.domain.dataobject.AssessmentsDO">
|
||||
update assessments
|
||||
set student_id = #{studentId,jdbcType=INTEGER},
|
||||
test_date = #{testDate,jdbcType=TIMESTAMP},
|
||||
test_type = #{testType,jdbcType=INTEGER},
|
||||
level = #{level,jdbcType=INTEGER},
|
||||
estimated_vocab_size = #{estimatedVocabSize,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectAssessmentsIdByStudentIdAndTestType">
|
||||
select id
|
||||
from assessments
|
||||
where student_id = #{studentId,jdbcType=INTEGER}
|
||||
and test_type = #{testType,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="selectContentDetailsJsonByAssessmentsId">
|
||||
select content_details_json
|
||||
from assessments
|
||||
where id = #{assessmentsId,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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">
|
||||
<mapper namespace="com.yinlihupo.enlish.service.domain.mapper.ExamWordsDOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.yinlihupo.enlish.service.domain.dataobject.ExamWordsDO">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="grade_id" jdbcType="INTEGER" property="gradeId" />
|
||||
<result column="level" jdbcType="INTEGER" property="level" />
|
||||
<result column="title" jdbcType="VARCHAR" property="title" />
|
||||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.yinlihupo.enlish.service.domain.dataobject.ExamWordsDO">
|
||||
<result column="word_ids" jdbcType="LONGVARCHAR" property="wordIds" typeHandler="com.yinlihupo.enlish.service.config.ListWordIdTypeHandler" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into exam_words (grade_id, level, title, word_ids, created_at)
|
||||
VALUES (#{gradeId}, #{level}, #{title}, #{wordIds, typeHandler=com.yinlihupo.enlish.service.config.ListWordIdTypeHandler}, #{createdAt})
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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">
|
||||
<mapper namespace="com.yinlihupo.enlish.service.domain.mapper.GradeUnitDOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.yinlihupo.enlish.service.domain.dataobject.GradeUnitDO">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="grade_id" jdbcType="INTEGER" property="gradeId" />
|
||||
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectUnitIdsByGradeId" resultType="java.lang.Integer">
|
||||
select unit_id
|
||||
from grade_unit
|
||||
where grade_id = #{gradeId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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">
|
||||
<mapper namespace="com.yinlihupo.enlish.service.domain.mapper.StudentExamWordsDOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.yinlihupo.enlish.service.domain.dataobject.StudentExamWordsDO">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="student_id" jdbcType="INTEGER" property="studentId" />
|
||||
<result column="exam_words_id" jdbcType="INTEGER" property="examWordsId" />
|
||||
<result column="is_completed" jdbcType="INTEGER" property="isCompleted" />
|
||||
<result column="start_data" jdbcType="TIMESTAMP" property="startData" />
|
||||
</resultMap>
|
||||
<insert id="insertStudentsExam">
|
||||
insert into student_exam_words
|
||||
(student_id, exam_words_id, is_completed, start_data)
|
||||
values
|
||||
<foreach collection="studentIds" item="studentId" separator=",">
|
||||
(#{studentId}, #{examWordsId}, 0, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -9,27 +9,6 @@
|
||||
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, word, `definition`, pronunciation, unit_id
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from vocabulary_bank
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from vocabulary_bank
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
|
||||
<insert id="insert" parameterType="com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO">
|
||||
insert into vocabulary_bank (id, word, `definition`, pronunciation, unit_id)
|
||||
values (#{id,jdbcType=INTEGER}, #{word,jdbcType=VARCHAR}, #{definition,jdbcType=VARCHAR},
|
||||
#{pronunciation,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER})
|
||||
</insert>
|
||||
|
||||
<insert id="insertSelective" parameterType="com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO">
|
||||
insert into vocabulary_bank
|
||||
@@ -69,39 +48,19 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO">
|
||||
update vocabulary_bank
|
||||
<set>
|
||||
<if test="word != null">
|
||||
word = #{word,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="definition != null">
|
||||
`definition` = #{definition,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pronunciation != null">
|
||||
pronunciation = #{pronunciation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
unit_id = #{unitId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<update id="updateByPrimaryKey" parameterType="com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO">
|
||||
update vocabulary_bank
|
||||
set word = #{word,jdbcType=VARCHAR},
|
||||
`definition` = #{definition,jdbcType=VARCHAR},
|
||||
pronunciation = #{pronunciation,jdbcType=VARCHAR},
|
||||
unit_id = #{unitId,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectVocabularyBankDOListByUnitId" resultMap="BaseResultMap">
|
||||
select *
|
||||
from vocabulary_bank
|
||||
where unit_id = #{unitId}
|
||||
limit #{wordCount}
|
||||
</select>
|
||||
<select id="selectVocabularyBankDOListByIds" resultMap="BaseResultMap">
|
||||
select *
|
||||
from vocabulary_bank
|
||||
where id in
|
||||
<foreach item="id" collection="ids" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user