From b39cc2beacc1ec2e37cff349cae42e420105c8a6 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Fri, 05 Nov 2021 14:29:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/springblade/modules/article/mapper/ArticleMapper.xml |  179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 179 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/modules/article/mapper/ArticleMapper.xml b/src/main/java/org/springblade/modules/article/mapper/ArticleMapper.xml
index adc6620..edcd5f8 100644
--- a/src/main/java/org/springblade/modules/article/mapper/ArticleMapper.xml
+++ b/src/main/java/org/springblade/modules/article/mapper/ArticleMapper.xml
@@ -18,5 +18,184 @@
         <if test="article.endTime!=null and article.endTime!=''">
             and create_time&lt;=#{article.endTime}
         </if>
+        <if test="article.articleType!=null and article.articleType!=''">
+            and article_type = #{article.articleType}
+        </if>
+        <if test="article.keyword!=null and article.keyword!=''">
+            AND CONCAT(title,source_name)
+            LIKE CONCAT ('%', #{article.keyword},'%')
+        </if>
+        order by create_time desc
     </select>
+
+    <!--查询资讯分页列表信息-->
+    <select id="pageDate" resultType="org.springblade.modules.article.entity.Article">
+        select * from sys_article
+        where 1=1
+        <if test="article.articleType!=null and article.articleType!=''">
+            and article_type LIKE CONCAT ('%', #{article.articleType},'%')
+        </if>
+        <if test="article.keyword!=null and article.keyword!=''">
+            AND CONCAT(title,source_name)
+            LIKE CONCAT ('%', #{article.keyword},'%')
+        </if>
+        <if test="(article.rolename==null and article.rolename=='') or (article.rolename!='administrator' and article.rolename!='policeAdmin')">
+            AND publish = 1
+        </if>
+        order by create_time desc
+    </select>
+
+    <!--查询收藏资讯分页列表信息-->
+    <select id="pageCollectList" resultType="org.springblade.modules.article.entity.Article">
+        SELECT
+        art.*
+        FROM
+        sys_collect col
+        LEFT JOIN sys_article art on art.id = col.collect_article
+        WHERE
+        1 = 1 AND collect_user =  #{article.userid}
+        <if test="article.articleType!=null and article.articleType!=''">
+            and article_type LIKE CONCAT ('%', #{article.articleType},'%')
+        </if>
+        <if test="article.keyword!=null and article.keyword!=''">
+            AND CONCAT(title,source_name)
+            LIKE CONCAT ('%', #{article.keyword},'%')
+        </if>
+        <if test="(article.rolename==null and article.rolename=='') or (article.rolename!='administrator' and article.rolename!='policeAdmin')">
+            AND publish = 1
+        </if>
+        order by create_time desc
+    </select>
+
+    <!--查询资讯分页列表信息-->
+    <select id="pageLikes" resultType="org.springblade.modules.article.vo.ArticleVo">
+        SELECT
+        *
+        FROM
+        sys_article art
+        LEFT JOIN (
+        SELECT
+        a.likes_article,
+        COUNT( * ) AS count,
+        b.islikes
+        FROM
+        sys_likes a
+        LEFT JOIN ( SELECT likes_article, COUNT( * ) AS islikes FROM sys_likes WHERE 1 = 1
+        <if test="article.userid!=null and article.userid!=''">
+            and likes_user = #{article.userid}
+        </if>
+        GROUP BY likes_article ) b ON a.likes_article = b.likes_article
+        GROUP BY
+        likes_article,
+        b.islikes
+        ) likes ON art.id = likes.likes_article
+
+        LEFT JOIN (
+        SELECT
+        a.collect_article,
+        COUNT( * ) AS collectcount,
+        b.iscollect
+        FROM
+        sys_collect a
+        LEFT JOIN ( SELECT collect_article, COUNT( * ) AS iscollect FROM sys_collect WHERE 1 = 1
+        <if test="article.userid!=null and article.userid!=''">
+            and collect_user = #{article.userid}
+        </if>
+        GROUP BY collect_article ) b ON a.collect_article = b.collect_article
+        GROUP BY
+        collect_article,
+        b.iscollect
+        ) collect ON art.id = collect.collect_article
+
+        LEFT JOIN (
+        SELECT
+        article,
+        COUNT(*) as comments
+        FROM
+        sys_comment
+        GROUP BY article
+        ) com on com.article = art.id
+        WHERE
+        1 = 1
+        <if test="article.articleType!=null and article.articleType!=''">
+            and article_type LIKE CONCAT ('%', #{article.articleType},'%')
+        </if>
+        <if test="article.keyword!=null and article.keyword!=''">
+            AND CONCAT(title,source_name)
+            LIKE CONCAT ('%', #{article.keyword},'%')
+        </if>
+        <if test="(article.rolename==null and article.rolename=='') or (article.rolename!='administrator' and article.rolename!='policeAdmin')">
+            AND publish = 1
+        </if>
+        order by create_time desc
+    </select>
+
+    <!--查询资讯分页列表信息-->
+    <select id="pageCollect" resultType="org.springblade.modules.article.vo.ArticleVo">
+        SELECT
+        *
+        FROM
+        sys_article art
+        LEFT JOIN (
+        SELECT
+        a.likes_article,
+        COUNT( * ) AS count,
+        b.islikes
+        FROM
+        sys_likes a
+        LEFT JOIN ( SELECT likes_article, COUNT( * ) AS islikes FROM sys_likes WHERE 1 = 1
+        <if test="article.userid!=null and article.userid!=''">
+            and likes_user = #{article.userid}
+        </if>
+        GROUP BY likes_article ) b ON a.likes_article = b.likes_article
+        GROUP BY
+        likes_article,
+        b.islikes
+        ) likes ON art.id = likes.likes_article
+
+        LEFT JOIN (
+        SELECT
+        a.collect_article,
+        COUNT( * ) AS collectcount,
+        b.iscollect
+        FROM
+        sys_collect a
+        LEFT JOIN ( SELECT collect_article, COUNT( * ) AS iscollect FROM sys_collect WHERE 1 = 1
+        <if test="article.userid!=null and article.userid!=''">
+            and collect_user = #{article.userid}
+        </if>
+        GROUP BY collect_article ) b ON a.collect_article = b.collect_article
+        GROUP BY
+        collect_article,
+        b.iscollect
+        ) collect ON art.id = collect.collect_article
+
+        LEFT JOIN (
+        SELECT
+        article,
+        COUNT(*) as comments
+        FROM
+        sys_comment
+        GROUP BY article
+        ) com on com.article = art.id
+        WHERE
+        1 = 1
+        AND iscollect = 1
+        <if test="article.articleType!=null and article.articleType!=''">
+            and article_type LIKE CONCAT ('%', #{article.articleType},'%')
+        </if>
+        <if test="article.keyword!=null and article.keyword!=''">
+            AND CONCAT(title,source_name)
+            LIKE CONCAT ('%', #{article.keyword},'%')
+        </if>
+        <if test="(article.rolename==null and article.rolename=='') or (article.rolename!='administrator' and article.rolename!='policeAdmin')">
+            AND publish = 1
+        </if>
+        order by create_time desc
+    </select>
+
+    <update id="upcomment">
+        update sys_article set iscomment = #{type}
+        where id in(${ids})
+    </update>
 </mapper>

--
Gitblit v1.9.3