From 2bf92184d4584cac58b76b8d1ea0b3b0ff34b4fb Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期五, 24 五月 2024 13:46:30 +0800
Subject: [PATCH] fix:统计修改

---
 src/main/resources/mapper/OnlineStudyMapper.xml |   55 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/src/main/resources/mapper/OnlineStudyMapper.xml b/src/main/resources/mapper/OnlineStudyMapper.xml
index 4fdadf3..6ab5488 100644
--- a/src/main/resources/mapper/OnlineStudyMapper.xml
+++ b/src/main/resources/mapper/OnlineStudyMapper.xml
@@ -6,17 +6,55 @@
 
     <select id="page" resultType="com.mindskip.xzs.domain.vo.OnlineStudyVO">
         SELECT
-        id,content_type, content_url, belong_type, subject, create_time, update_time, attachment
+            tos.id,
+            tos.content_type,
+            tos.content_url as contentUrlString,
+            tos.belong_type,
+            tos.subject,
+            tos.create_time,
+            tos.update_time,
+            tos.attachment as attachmentString,
+            tst.type_name
         FROM
-        t_online_study
+            t_online_study tos
+                INNER JOIN t_study_type tst ON tst.id = tos.belong_type
         <where>
-            AND deleted = 0
+            AND tos.deleted = 0
             <if test="query.subject != null and query.subject != ''">
-                AND subject like concat('%', #{query.subject}, '%')
+                AND tos.subject like concat('%', #{query.subject}, '%')
+            </if>
+            <if test="query.belongType != null">
+                AND tst.id = #{query.belongType}
             </if>
         </where>
         ORDER BY
-        create_time DESC
+            tos.create_time DESC
+    </select>
+
+    <select id="byType" resultType="com.mindskip.xzs.domain.vo.OnlineStudyVO">
+        SELECT
+            tos.id,
+            tos.content_type,
+            tos.content_url as contentUrlString,
+            tos.belong_type,
+            tos.subject,
+            tos.create_time,
+            tos.update_time,
+            tos.attachment as attachmentString
+        FROM
+            t_online_study tos
+                INNER JOIN t_study_type tst ON tst.id = tos.belong_type
+        <where>
+            AND tos.deleted = 0
+            <if test="query.subject != null and query.subject != ''">
+                AND tos.subject like concat('%', #{query.subject}, '%')
+            </if>
+            <if test="query.belongType != null">
+                AND tst.id = #{query.belongType}
+            </if>
+        </where>
+        ORDER BY
+            tos.create_time DESC
     </select>
 
     <insert id="add" keyColumn="id" useGeneratedKeys="true" parameterType="com.mindskip.xzs.domain.OnlineStudy">
@@ -31,14 +69,13 @@
         <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.belong_type != null and form.belong_type != ''">belong_type = #{form.belongType},</if>
-            <if test="form.belongType != null and form.belongType != ''">belong_type = #{form.belongType},</if>
+            <if test="form.belongType != null">belong_type = #{form.belongType},</if>
             <if test="form.subject != null and form.subject != ''">subject = #{form.subject},</if>
             <if test="form.updateTime != null">update_time = #{form.updateTime},</if>
-            <if test="form.attachment != null and form.attachment != ''">attachment = #{form.attachment},</if>
+            attachment = #{form.attachment}
         </set>
         WHERE
-        id = #{vo.id}
+        id = #{form.id}
     </update>
 
     <update id="remove">

--
Gitblit v1.8.0