From 3303fef314b45020d8ea62a908d887060d695b3f Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 03 七月 2024 09:39:32 +0800
Subject: [PATCH] 教学资源增加班级

---
 src/main/resources/mapper/EducationResourceMapper.xml |   52 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/src/main/resources/mapper/EducationResourceMapper.xml b/src/main/resources/mapper/EducationResourceMapper.xml
index bd383cc..cb750e2 100644
--- a/src/main/resources/mapper/EducationResourceMapper.xml
+++ b/src/main/resources/mapper/EducationResourceMapper.xml
@@ -14,43 +14,56 @@
             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.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.subjectId != null">
-                AND ts.id = #{query.subjectId}
+                AND ter.subject_id = #{query.subjectId}
+            </if>
+            <if test="query.classId != null">
+                AND ter.class_id = #{query.classId}
             </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.subject_id,
-            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 = ter.subject_id
+        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.subjectId != null">
-                AND ts.id = #{query.subjectId}
+                AND ter.subject_id = #{query.subjectId}
             </if>
         </where>
         ORDER BY
@@ -59,8 +72,8 @@
 
     <insert id="add" keyColumn="id" useGeneratedKeys="true">
         INSERT INTO t_education_resource(content_type, content_url, subject_id, introduction, create_time, update_time,
-                                   attachment)
-            value (#{form.contentType}, #{form.contentUrl}, #{form.subjectId}, #{form.introduction}, #{form.createTime}, #{form.updateTime}, #{form.attachment})
+                                   attachment,create_user,class_id)
+            value (#{form.contentType}, #{form.contentUrl}, #{form.subjectId}, #{form.introduction}, #{form.createTime}, #{form.updateTime}, #{form.attachment},#{form.createUser},#{form.classId})
     </insert>
 
     <update id="update">
@@ -70,6 +83,7 @@
             <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.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