From dc050f50a530ef7b0eaa378ca1790c26d4f0bfd5 Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Wed, 24 Aug 2022 03:44:06 +0800
Subject: [PATCH] 新增月台专用查询接口

---
 snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml |   75 +++++++++++++++++++++++++++++++++++--
 1 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml
index aa9c7c9..c5b8025 100644
--- a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml
+++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml
@@ -26,18 +26,23 @@
        a.is_allowed_comment,
        a.jump_url as jumpURL,
        a.update_date,
-       a.create_date
+       a.create_date,
+       a.video_ids,
+       a.picture_ids
     </sql>
 
+    <!--首页通用的条件查询-->
     <sql id="queryListCondition">
         <trim prefix="WHERE" prefixOverrides="AND | OR">
             a.is_enable=1
             and a.editor_status=1
             and a.publish_date &lt; now()
             <choose>
+                <!-- 月台查询用 -->
                 <when test="param.fileType != null">
                     and a.article_file_type = #{param.fileType}
                 </when>
+                <!-- 指定排除 视频类在首页显示,但需要在分类栏目列表显示 -->
                 <when test="param.fileType == null and param.typeId == null">
                     and a.article_file_type not in (3,4)
                 </when>
@@ -47,6 +52,8 @@
                     AND a.article_type_id = #{param.typeId}
                     order by a.is_top desc,a.top_value asc , a.publish_date desc
                 </when>
+
+                <!-- 指定排除 笔记类在首页显示 -->
                 <otherwise>
                     AND a.article_type_id != 4
                     order by a.is_top desc,a.top_value asc , a.update_date desc
@@ -56,6 +63,7 @@
 
     </sql>
 
+    <!-- 首页查询-->
     <select id="searchList" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo">
         select
         <include refid="Base_Column_List"/>
@@ -66,10 +74,6 @@
         inner join blog_article_type t
         on t.id =a.article_type_id
 
-        left join sys_file_info f1
-        on f1.id=a.article_file_id
-
-
         left join sys_file_info f2
         on f2.id=a.cover_file_id
 
@@ -78,6 +82,7 @@
         limit #{param.pageNo},#{param.pageSize}
     </select>
 
+    <!-- 首页查询个数统计-->
     <select id="searchListCount" resultType="java.lang.Long">
         select
         count(0)
@@ -87,6 +92,7 @@
 
     </select>
 
+    <!-- 月份归档统计-->
     <select id="searchMonthCount" resultType="vip.xiaonuo.modular.blogStatistics.vo.BlogArchiveDetailVo">
        SELECT
 	    separate_month AS `month`,
@@ -106,4 +112,63 @@
 
     </select>
 
+    <!-- 上下篇查询-->
+    <select id="getAdjoiningRecord" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo">
+        select
+        a.id,
+        a.title
+        from
+        blog_article a
+        <include refid="queryListCondition"/>
+        limit #{param.pageNo},#{param.pageSize}
+    </select>
+
+    <sql id="queryPlatformCondition">
+        <trim prefix="WHERE" prefixOverrides="AND | OR">
+            a.is_enable=1
+            and a.editor_status=1
+            and a.publish_date &lt; now()
+
+            <if test="param.fileType != null">
+                and a.article_file_type = #{param.fileType}
+            </if>
+
+            AND a.article_type_id in
+            <foreach collection="param.typeIds" item="obj" separator="," open="(" close=")">
+                #{obj}
+            </foreach>
+
+            order by a.is_top desc,a.top_value asc , a.publish_date desc
+        </trim>
+
+    </sql>
+
+    <!--月台列表查询-->
+    <select id="searchPlatformList" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo">
+        select
+        <include refid="Base_Column_List"/>
+        ,IF(a.cover_file_id is not null,CONCAT("/",f2.file_bucket,"/",f2.file_object_name),"") as coverFileURL
+        ,t.type_name as articleTypeName
+        from
+        blog_article a
+        inner join blog_article_type t
+        on t.id =a.article_type_id
+
+        left join sys_file_info f2
+        on f2.id=a.cover_file_id
+
+        <include refid="queryPlatformCondition"/>
+
+        limit #{param.pageNo},#{param.pageSize}
+    </select>
+
+    <select id="searchPlatformListCount" resultType="java.lang.Long">
+        select
+        count(0)
+        from
+        blog_article a
+        <include refid="queryPlatformCondition"/>
+    </select>
+
+
 </mapper>

--
Gitblit v1.9.1