feat(student-plan): 实现学生学案查询功能

- 新增FindStudentPlansReqVO和FindStudentPlansRspVO定义请求和响应数据结构
- 新增LessonPlanItem用于描述单个学案项
- StudentLessonPlansDO模型新增isFinished属性
- 扩展StudentLessonPlansDOMapper,添加分页及按姓名查询学生学案列表方法及统计总数方法
- 扩展LessonPlansDOMapper,新增按学案ID列表批量查询方法
- 实现StudentLessonPlansService及LessonPlansService接口对应查询方法
- 新增StudentLessonPlansController,提供学生学案分页查询接口
- 在前端LearningPlan.vue添加学案查询界面及分页、搜索功能
- 封装studentLessonPlans接口axios方法,支持分页按姓名查询学生学案数据
- 添加单元测试更新验证数据库查询正确性
This commit is contained in:
lbw
2025-12-17 15:23:40 +08:00
parent 49cd146bc3
commit dbe7312633
16 changed files with 335 additions and 6 deletions

View File

@@ -22,4 +22,15 @@
where id = #{id}
</select>
<select id="findLessonPlansByStudentId" resultMap="BaseResultMap">
select *
from lesson_plans
<if test="ids != null">
where id in
<foreach item="id" collection="ids" separator="," open="(" close=")" index="">
#{id}
</foreach>
</if>
</select>
</mapper>

View File

@@ -8,6 +8,7 @@
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="mastery_rat" jdbcType="DECIMAL" property="masteryRat" />
<result column="total_count" jdbcType="INTEGER" property="totalCount" />
<result column="is_finished" jdbcType="INTEGER" property="isFinished" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.yinlihupo.enlish.service.domain.dataobject.StudentLessonPlansDO">
@@ -22,4 +23,26 @@
)
</insert>
<select id="selectStudentLessonPlanList" resultMap="BaseResultMap">
SELECT slp.*
FROM student_lesson_plans slp
LEFT JOIN student s ON slp.student_id = s.id
JOIN (
SELECT DISTINCT slp_in.student_id
FROM student_lesson_plans slp_in
LEFT JOIN student s_in ON slp_in.student_id = s_in.id
<if test="name != null and name != ''">
WHERE s_in.name LIKE CONCAT('%', #{name}, '%')
</if>
ORDER BY slp_in.student_id
LIMIT #{startIndex}, #{pageSize}
) AS temp ON slp.student_id = temp.student_id
ORDER BY slp.id
</select>
<select id="selectStudentPlanTotal">
SELECT count(DISTINCT student_id) AS total
FROM student_lesson_plans;
</select>
</mapper>