fangqing 1 сар өмнө
parent
commit
872afe4019

+ 6 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -181,6 +181,12 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
             }
         }
 
+        Boolean isDraft = communityArticle.getIsDraft();
+        //判断草稿箱是否为空 为空则为false
+        if (isDraft == null) {
+            communityArticle.setIsDraft(false);
+        }
+
         //根据分类查找文章
         int offset = (pageNum - 1) * pageSize;
         communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, classIds, offset, pageSize, searchType, userId);

+ 5 - 26
ruoyi-generator/src/main/resources/mapper/community/ArticleMapper.xml

@@ -118,6 +118,7 @@
         a.is_download,
         a.article_type,
         a.content_type,
+        a.is_Draft,
         COALESCE((
         SELECT
         JSON_ARRAYAGG(
@@ -146,29 +147,7 @@
         c.nick_name as nick_name,
         c.email as email,
         c.avatar as avatar
-        # COALESCE((
-        # SELECT
-        # JSON_ARRAYAGG(
-        # CASE
-        # WHEN d.id IS NOT NULL THEN
-        # JSON_OBJECT(
-        # 'id', IFNULL(d.id,''),
-        # 'articleId', IFNULL(d.article_id,''),
-        # 'userId', IFNULL(d.user_id,''),
-        # 'content', IFNULL(d.content,''),
-        # 'createBy', IFNULL(d.create_by,''),
-        # 'createTime', IFNULL(DATE_FORMAT(d.create_time,'%Y-%m-%d %H:%i:%s'),''),
-        # 'updateBy', IFNULL(d.update_by,''),
-        # 'updateTime', IFNULL(DATE_FORMAT(d.update_time,'%Y-%m-%d %H:%i:%s'),'')
-        # )
-        # ELSE NULL
-        # END
-        # )
-        # FROM
-        # community_article_comment d
-        # WHERE
-        # d.article_id = a.id and d.is_delete != 1 order by d.create_time desc
-        # ), '[]') AS comments
+
         from
         community_article a
         left join sys_user c on a.user_id = c.user_id
@@ -209,9 +188,9 @@
                     #{articleId}
                 </foreach>
             </if>
-            <if test="communityArticle.isDraft != null and communityArticle.isDraft != '' ">
-                AND IFNULL(a.is_Draft,0) = #{communityArticle.isDraft}
-            </if>
+
+            AND IFNULL(a.is_Draft,0) = #{communityArticle.isDraft}
+
             <if test="searchType == 3">
                 and   EXISTS (select 1 from community_article_recommend car  where car.article_id = a.id and car.is_delete != 1 or car.is_delete is null)
             </if>