From b661bcf7e065092c876e052bad0bfaecb9dc0c17 Mon Sep 17 00:00:00 2001
From: luohairen <3399054449@qq.com>
Date: 星期二, 12 十一月 2024 21:21:06 +0800
Subject: [PATCH] 优化错题查询
---
src/main/resources/mapper/EducationResourceMapper.xml | 70 ++++++++++++++++++++++------------
1 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/src/main/resources/mapper/EducationResourceMapper.xml b/src/main/resources/mapper/EducationResourceMapper.xml
index 86c3488..4bc65fb 100644
--- a/src/main/resources/mapper/EducationResourceMapper.xml
+++ b/src/main/resources/mapper/EducationResourceMapper.xml
@@ -9,48 +9,67 @@
ter.id,
ter.content_type,
ter.content_url as contentUrlString,
- ter.belong_type,
+ ter.subject_id,
ter.introduction,
ter.create_time,
ter.update_time,
ter.attachment as attachmentString,
- ts.name as typeName
+ ts.name as typeName,
+ ter.class_id,
+ tc.class_name
FROM
t_education_resource ter
- INNER JOIN t_subject ts ON ts.id = ter.belong_type
+ INNER JOIN t_subject ts ON ts.id = ter.subject_id
+ INNER JOIN t_classes tc ON tc.id = ter.class_id
<where>
AND ter.deleted = 0
<if test="query.introduction != null and query.introduction != ''">
- AND ter.introduction like concat('%', #{query.subject}, '%')
+ AND ter.introduction like concat('%', #{query.introduction}, '%')
</if>
- <if test="query.belongType != null">
- AND ts.id = #{query.belongType}
+ <if test="query.subjectId != null">
+ AND ter.subject_id = #{query.subjectId}
+ </if>
+ <if test="query.classId != null">
+ AND ter.class_id = #{query.classId}
+ </if>
+ <if test="query.contentType != null and query.contentType != '' ">
+ AND ter.content_type = #{query.contentType}
</if>
</where>
ORDER BY
ter.create_time DESC
</select>
- <select id="byType" resultType="com.ycl.jxkg.domain.vo.admin.education.EducationResourceVO">
+ <select id="studentPage" resultType="com.ycl.jxkg.domain.vo.admin.education.EducationResourceVO">
SELECT
- ter.id,
- ter.content_type,
- ter.content_url as contentUrlString,
- ter.belong_type,
- ter.introduction,
- ter.create_time,
- ter.update_time,
- ter.attachment as attachmentString
+ ter.id,
+ ter.content_type,
+ ter.content_url as contentUrlString,
+ ter.subject_id,
+ ter.introduction,
+ ter.create_time,
+ ter.update_time,
+ ter.attachment as attachmentString,
+ ts.name as typeName,
+ ter.class_id,
+ tc.class_name
FROM
- t_education_resource ter
- INNER JOIN t_subject ts ON ts.id = tos.belong_type
+ t_education_resource ter
+ INNER JOIN t_subject ts ON ts.id = ter.subject_id
+ INNER JOIN t_classes tc ON tc.id = ter.class_id
<where>
- AND ter.deleted = 0
+ AND ter.deleted = 0 and ter.class_id in
+ <foreach collection="query.classIds" item="classId" separator="," open="(" close=")">
+ #{classId}
+ </foreach>
<if test="query.introduction != null and query.introduction != ''">
- AND ter.introduction like concat('%', #{query.subject}, '%')
+ AND ter.introduction like concat('%', #{query.introduction}, '%')
</if>
- <if test="query.belongType != null">
- AND ts.id = #{query.belongType}
+ <if test="query.subjectId != null">
+ AND ter.subject_id = #{query.subjectId}
+ </if>
+ <if test="query.contentType != null and query.contentType != '' ">
+ AND ter.content_type = #{query.contentType}
</if>
</where>
ORDER BY
@@ -58,9 +77,9 @@
</select>
<insert id="add" keyColumn="id" useGeneratedKeys="true">
- INSERT INTO t_education_resource(content_type, content_url, belong_type, introduction, create_time, update_time,
- attachment)
- value (#{form.contentType}, #{form.contentUrl}, #{form.belongType}, #{form.introduction}, #{form.createTime}, #{form.updateTime}, #{form.attachment})
+ INSERT INTO t_education_resource(content_type, content_url, subject_id, introduction, create_time, update_time,
+ attachment,create_user,class_id)
+ values (#{form.contentType}, #{form.contentUrl}, #{form.subjectId}, #{form.introduction}, #{form.createTime}, #{form.updateTime}, #{form.attachment},#{form.createUser},#{form.classId})
</insert>
<update id="update">
@@ -69,7 +88,8 @@
<set>
<if test="form.contentType != null and form.contentType != ''">content_type = #{form.contentType},</if>
<if test="form.contentUrl != null and form.contentUrl != ''">content_url = #{form.contentUrl},</if>
- <if test="form.belongType != null">belong_type = #{form.belongType},</if>
+ <if test="form.subjectId != null">subject_id = #{form.subjectId},</if>
+ <if test="form.classId != null">class_id = #{form.classId},</if>
<if test="form.introduction != null and form.introduction != ''">introduction = #{form.introduction},</if>
<if test="form.updateTime != null">update_time = #{form.updateTime},</if>
attachment = #{form.attachment}
--
Gitblit v1.8.0