Kaynağa Gözat

修改业务逻辑,文章发布新增合集,圈子多选选项

fangzhen 7 ay önce
ebeveyn
işleme
48e392b51c

+ 3 - 9
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/Community/CommunityArticle.java

@@ -60,6 +60,7 @@ public class CommunityArticle implements Serializable {
      * 圈子id
      * 圈子id
      */
      */
     @ApiModelProperty("圈子id")
     @ApiModelProperty("圈子id")
+    @TableField(exist = false)
     private Long circleId;
     private Long circleId;
 
 
     /**
     /**
@@ -68,19 +69,12 @@ public class CommunityArticle implements Serializable {
     @ApiModelProperty("文章内容")
     @ApiModelProperty("文章内容")
     private String content;
     private String content;
 
 
-    /**
-     * 文章板块
-     */
-    @ApiModelProperty("文章板块")
-    @TableField(exist = false)
-    private List<CommunityClass> classes;
-
     /**
     /**
      * 板块圈子
      * 板块圈子
      */
      */
     @ApiModelProperty("板块圈子")
     @ApiModelProperty("板块圈子")
     @TableField(exist = false)
     @TableField(exist = false)
-    private List<CommunityCircle> circles;
+    private List<String> circleIds;
 
 
     /**
     /**
      * 文章标签
      * 文章标签
@@ -94,7 +88,7 @@ public class CommunityArticle implements Serializable {
      */
      */
     @ApiModelProperty("合集")
     @ApiModelProperty("合集")
     @TableField(exist = false)
     @TableField(exist = false)
-    private List<CommunityCollection> collections;
+    private List<String> collectionIds;
 
 
     /**
     /**
      * 图片地址
      * 图片地址

+ 51 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/Community/CommunityArticleCircle.java

@@ -0,0 +1,51 @@
+package com.ruoyi.generator.domain.Community;
+
+import javax.validation.constraints.NotNull;
+
+import java.io.Serializable;
+
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* 文章关联圈子
+* @TableName community_article_circle
+*/
+@TableName("community_article_circle")
+@Data
+public class CommunityArticleCircle implements Serializable {
+
+    /**
+    * 唯一id
+    */
+    @NotNull(message="[唯一id]不能为空")
+    @ApiModelProperty("唯一id")
+    @TableId("id")
+    private Long id;
+    /**
+    * 文章id
+    */
+    @ApiModelProperty("文章id")
+    private Long articleId;
+    /**
+    * 圈子id
+    */
+    @ApiModelProperty("圈子id")
+    private Long circleId;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    private Long createBy;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+}

+ 9 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/community/CommunityArticleCircleMapper.java

@@ -0,0 +1,9 @@
+package com.ruoyi.generator.mapper.community;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.generator.domain.Community.CommunityArticleCircle;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CommunityArticleCircleMapper extends BaseMapper<CommunityArticleCircle> {
+}

+ 10 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleCircleImpl.java

@@ -0,0 +1,10 @@
+package com.ruoyi.generator.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.generator.domain.Community.CommunityArticleCircle;
+import com.ruoyi.generator.mapper.community.CommunityArticleCircleMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CommunityArticleCircleImpl extends ServiceImpl<CommunityArticleCircleMapper, CommunityArticleCircle> implements ICommunityArticleCircleService {
+}

+ 53 - 52
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -77,6 +77,15 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
     @Autowired
     @Autowired
     private CommunityUserInfoMapper communityUserInfoMapper;
     private CommunityUserInfoMapper communityUserInfoMapper;
 
 
+    @Autowired
+    private ICommunityArticleCircleService communityArticleCircleService;
+
+    @Autowired
+    private CommunityCollectionArticleMapper communityCollectionArticleMapper;
+
+    @Autowired
+    private ICommunityCollectionArticleService collectionArticleService;
+
     /**
     /**
      * 查询文章列表
      * 查询文章列表
      *
      *
@@ -124,6 +133,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
         communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, circleIds, offset, pageSize, searchType);
         communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, circleIds, offset, pageSize, searchType);
         for (CommunityArticleVo articleVo : communityArticleVos) {
         for (CommunityArticleVo articleVo : communityArticleVos) {
             List<Map<String, Object>> imageList = articleVo.getImageList();
             List<Map<String, Object>> imageList = articleVo.getImageList();
+            articleVo.setCircleIds(circleIds);
             List<CommunityArticleImages> videoList = new ArrayList<>();
             List<CommunityArticleImages> videoList = new ArrayList<>();
             CommunityArticleImages videos = null;
             CommunityArticleImages videos = null;
             for (Map<String, Object> image : imageList) {
             for (Map<String, Object> image : imageList) {
@@ -140,15 +150,9 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
             articleVo.setVideoList(videoList);
             articleVo.setVideoList(videoList);
 
 
             //设置文章的点赞数量
             //设置文章的点赞数量
-            articleVo.setLikeCount(communityLikeMapper
-                    .selectList(new QueryWrapper<CommunityLike>()
-                            .eq("article_id", articleVo.getId()))
-                    .size());
+            articleVo.setLikeCount(communityLikeMapper.selectList(new QueryWrapper<CommunityLike>().eq("article_id", articleVo.getId())).size());
 
 
-            articleVo.setCollectCount(communityCollectMapper
-                    .selectList(new QueryWrapper<CommunityArticleCollect>()
-                            .eq("article_id", articleVo.getId()))
-                    .size());
+            articleVo.setCollectCount(communityCollectMapper.selectList(new QueryWrapper<CommunityArticleCollect>().eq("article_id", articleVo.getId())).size());
 
 
             //文章下的评论
             //文章下的评论
             List<Map<String, Object>> comments = articleVo.getComments();
             List<Map<String, Object>> comments = articleVo.getComments();
@@ -162,36 +166,23 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
                 communityArticleCommentVo.put("username", sysUser.getUserName());
                 communityArticleCommentVo.put("username", sysUser.getUserName());
                 communityArticleCommentVo.put("avatar", sysUser.getAvatar());
                 communityArticleCommentVo.put("avatar", sysUser.getAvatar());
                 //当前登录用户是否已点赞
                 //当前登录用户是否已点赞
-                List<CommunityCommentLike> commentLikes = communityCommentLikeMapper
-                        .selectList(new QueryWrapper<CommunityCommentLike>()
-                                .eq("comment_id", communityArticleCommentVo.get("id")).eq("user_id", userId));
+                List<CommunityCommentLike> commentLikes = communityCommentLikeMapper.selectList(new QueryWrapper<CommunityCommentLike>().eq("comment_id", communityArticleCommentVo.get("id")).eq("user_id", userId));
                 communityArticleCommentVo.put("commentLike", !commentLikes.isEmpty());
                 communityArticleCommentVo.put("commentLike", !commentLikes.isEmpty());
 
 
                 //该评论的点赞数量
                 //该评论的点赞数量
-                communityArticleCommentVo.put("commentLikeCount", communityCommentLikeMapper
-                        .selectList(new QueryWrapper<CommunityCommentLike>()
-                                .eq("comment_id", communityArticleCommentVo.get("id")))
-                        .size());
+                communityArticleCommentVo.put("commentLikeCount", communityCommentLikeMapper.selectList(new QueryWrapper<CommunityCommentLike>().eq("comment_id", communityArticleCommentVo.get("id"))).size());
             }
             }
 
 
             //判断是否已收藏
             //判断是否已收藏
-            CommunityArticleCollect collect = communityCollectMapper
-                    .selectOne(new QueryWrapper<CommunityArticleCollect>()
-                            .eq("user_id", userId)
-                            .eq("article_id", articleVo.getId()));
+            CommunityArticleCollect collect = communityCollectMapper.selectOne(new QueryWrapper<CommunityArticleCollect>().eq("user_id", userId).eq("article_id", articleVo.getId()));
             articleVo.setCollect(!Objects.isNull(collect));
             articleVo.setCollect(!Objects.isNull(collect));
 
 
             //判断是否已点赞
             //判断是否已点赞
-            CommunityLike like = communityLikeMapper
-                    .selectOne(new QueryWrapper<CommunityLike>()
-                            .eq("user_id", userId)
-                            .eq("article_id", articleVo.getId()));
+            CommunityLike like = communityLikeMapper.selectOne(new QueryWrapper<CommunityLike>().eq("user_id", userId).eq("article_id", articleVo.getId()));
             articleVo.setLike(!Objects.isNull(like));
             articleVo.setLike(!Objects.isNull(like));
 
 
             //获取文章标签
             //获取文章标签
-            List<CommunityArticleTag> articleTags = communityArticleTagMapper
-                    .selectList(new QueryWrapper<CommunityArticleTag>()
-                            .eq("article_id", articleVo.getId()));
+            List<CommunityArticleTag> articleTags = communityArticleTagMapper.selectList(new QueryWrapper<CommunityArticleTag>().eq("article_id", articleVo.getId()));
             List<Long> tagIds = new ArrayList<>();
             List<Long> tagIds = new ArrayList<>();
             for (CommunityArticleTag articleTag : articleTags) {
             for (CommunityArticleTag articleTag : articleTags) {
                 tagIds.add(articleTag.getTagId());
                 tagIds.add(articleTag.getTagId());
@@ -254,6 +245,34 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
             articleImages.setCreateBy(userId);
             articleImages.setCreateBy(userId);
             communityArticleImagesMapper.insert(articleImages);
             communityArticleImagesMapper.insert(articleImages);
         }
         }
+
+        //插入圈子
+        List<String> circleIds = communityArticle.getCircleIds();
+        List<CommunityArticleCircle> articleCircles = new ArrayList<>();
+        CommunityArticleCircle articleCircle = null;
+        for (String circleId : circleIds) {
+            articleCircle = new CommunityArticleCircle();
+            articleCircle.setCircleId(Long.parseLong(circleId));
+            articleCircle.setArticleId(communityArticle.getId());
+            articleCircle.setCreateBy(userId);
+            articleCircle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
+            articleCircles.add(articleCircle);
+        }
+        communityArticleCircleService.saveBatch(articleCircles);
+
+        //插入合集
+        List<String> collectionIds = communityArticle.getCollectionIds();
+        List<CommunityCollectionArticle> collectionArticles = new ArrayList<>();
+        CommunityCollectionArticle collectionArticle = null;
+        for (String collectionId : collectionIds) {
+            collectionArticle = new CommunityCollectionArticle();
+            collectionArticle.setCollectionId(Long.parseLong(collectionId));
+            collectionArticle.setArticleId(communityArticle.getId());
+            collectionArticle.setCreateBy(userId);
+            collectionArticle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
+            collectionArticles.add(collectionArticle);
+        }
+        collectionArticleService.saveBatch(collectionArticles);
     }
     }
 
 
 
 
@@ -329,10 +348,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
      */
      */
     @Override
     @Override
     public CommunityArticleCollect selectCommunityCollectById(CommunityArticleCollect collect) {
     public CommunityArticleCollect selectCommunityCollectById(CommunityArticleCollect collect) {
-        return communityCollectMapper
-                .selectOne(new QueryWrapper<CommunityArticleCollect>()
-                        .eq("article_id", collect.getArticleId())
-                        .eq("user_id", SecurityUtils.getUserId()));
+        return communityCollectMapper.selectOne(new QueryWrapper<CommunityArticleCollect>().eq("article_id", collect.getArticleId()).eq("user_id", SecurityUtils.getUserId()));
     }
     }
 
 
     /**
     /**
@@ -366,9 +382,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
      */
      */
     @Override
     @Override
     public List<CommunityCircleVo> selectCommunityCircleList(String classId) {
     public List<CommunityCircleVo> selectCommunityCircleList(String classId) {
-        List<CommunityClassCircle> classes = communityClassCircleMapper
-                .selectList(new QueryWrapper<CommunityClassCircle>()
-                        .eq("class_id", classId));
+        List<CommunityClassCircle> classes = communityClassCircleMapper.selectList(new QueryWrapper<CommunityClassCircle>().eq("class_id", classId));
         List<Long> circleIds = new ArrayList<>();
         List<Long> circleIds = new ArrayList<>();
         for (CommunityClassCircle aClass : classes) {
         for (CommunityClassCircle aClass : classes) {
             circleIds.add(aClass.getCircleId());
             circleIds.add(aClass.getCircleId());
@@ -385,11 +399,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
                 BeanUtils.copyProperties(communityCircle, communityCircleVo);
                 BeanUtils.copyProperties(communityCircle, communityCircleVo);
 
 
                 //获取当前用户是否有关注这些圈子
                 //获取当前用户是否有关注这些圈子
-                CommunityUserCircle communityUserCircles = communityUserCircleMapper
-                        .selectOne(new QueryWrapper<CommunityUserCircle>()
-                                .eq("circle_id", communityCircle.getId())
-                                .eq("user_id", SecurityUtils.getLoginUser().getUserId())
-                                .eq("is_delete", 0));
+                CommunityUserCircle communityUserCircles = communityUserCircleMapper.selectOne(new QueryWrapper<CommunityUserCircle>().eq("circle_id", communityCircle.getId()).eq("user_id", SecurityUtils.getLoginUser().getUserId()).eq("is_delete", 0));
                 if (Objects.isNull(communityUserCircles) || Objects.isNull(communityUserCircles.getId())) {
                 if (Objects.isNull(communityUserCircles) || Objects.isNull(communityUserCircles.getId())) {
                     //没找到关注数据,则设为false,反之则true
                     //没找到关注数据,则设为false,反之则true
                     communityCircleVo.setLike(false);
                     communityCircleVo.setLike(false);
@@ -412,9 +422,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
     public CommunityUserLike addOrDeleteUserLike(Long likeUserId) {
     public CommunityUserLike addOrDeleteUserLike(Long likeUserId) {
         Long userId = SecurityUtils.getLoginUser().getUserId();  // 当前登录用户id
         Long userId = SecurityUtils.getLoginUser().getUserId();  // 当前登录用户id
         //1.检查是否已被当前用户关注
         //1.检查是否已被当前用户关注
-        CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>()
-                .eq("user_id", userId)
-                .eq("like_user_id", likeUserId));
+        CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>().eq("user_id", userId).eq("like_user_id", likeUserId));
         //2.1 没有则进行关注,返回关注列表信息
         //2.1 没有则进行关注,返回关注列表信息
         if (Objects.isNull(communityUserLike) || Objects.isNull(communityUserLike.getId())) {
         if (Objects.isNull(communityUserLike) || Objects.isNull(communityUserLike.getId())) {
             communityUserLike = new CommunityUserLike();
             communityUserLike = new CommunityUserLike();
@@ -424,9 +432,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
             communityUserLike.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
             communityUserLike.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
             communityUserLikeMapper.insert(communityUserLike);
             communityUserLikeMapper.insert(communityUserLike);
 
 
-            communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>()
-                    .eq("user_id", userId)
-                    .eq("like_user_id", likeUserId));
+            communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>().eq("user_id", userId).eq("like_user_id", likeUserId));
             return communityUserLike;
             return communityUserLike;
         }
         }
 
 
@@ -444,8 +450,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
     @Override
     @Override
     public CommunityUserInfoVo selectCommunityUserInfoById(Long userId) {
     public CommunityUserInfoVo selectCommunityUserInfoById(Long userId) {
         SysUser sysUser = sysUserMapper.selectUserById(userId);
         SysUser sysUser = sysUserMapper.selectUserById(userId);
-        CommunityUserInfo communityUserInfo = communityUserInfoMapper
-                .selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", userId));
+        CommunityUserInfo communityUserInfo = communityUserInfoMapper.selectOne(new QueryWrapper<CommunityUserInfo>().eq("user_id", userId));
         CommunityUserInfoVo communityUserInfoVo = new CommunityUserInfoVo();
         CommunityUserInfoVo communityUserInfoVo = new CommunityUserInfoVo();
         BeanUtils.copyProperties(communityUserInfo, communityUserInfoVo);
         BeanUtils.copyProperties(communityUserInfo, communityUserInfoVo);
         communityUserInfoVo.setAvatar(sysUser.getAvatar());
         communityUserInfoVo.setAvatar(sysUser.getAvatar());
@@ -453,12 +458,8 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
         communityUserInfoVo.setUserId(userId);
         communityUserInfoVo.setUserId(userId);
 
 
         //设置关注,粉丝,陪伴数量
         //设置关注,粉丝,陪伴数量
-        communityUserInfoVo.setLikeCount(communityUserLikeMapper
-                .selectList(new QueryWrapper<CommunityUserLike>()
-                        .eq("user_id", userId)).size());
-        communityUserInfoVo.setFansCount(communityUserLikeMapper
-                .selectList(new QueryWrapper<CommunityUserLike>()
-                        .eq("like_user_id", userId)).size());
+        communityUserInfoVo.setLikeCount(communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>().eq("user_id", userId)).size());
+        communityUserInfoVo.setFansCount(communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>().eq("like_user_id", userId)).size());
         communityUserInfoVo.setCompanionCount(0);
         communityUserInfoVo.setCompanionCount(0);
 
 
         //设置是否被当前登录的用户关注
         //设置是否被当前登录的用户关注

+ 10 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionArticleImpl.java

@@ -0,0 +1,10 @@
+package com.ruoyi.generator.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.generator.domain.Community.CommunityCollectionArticle;
+import com.ruoyi.generator.mapper.community.CommunityCollectionArticleMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CommunityCollectionArticleImpl extends ServiceImpl<CommunityCollectionArticleMapper, CommunityCollectionArticle> implements ICommunityCollectionArticleService {
+}

+ 7 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/ICommunityArticleCircleService.java

@@ -0,0 +1,7 @@
+package com.ruoyi.generator.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.generator.domain.Community.CommunityArticleCircle;
+
+public interface ICommunityArticleCircleService extends IService<CommunityArticleCircle> {
+}

+ 7 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/ICommunityCollectionArticleService.java

@@ -0,0 +1,7 @@
+package com.ruoyi.generator.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.generator.domain.Community.CommunityCollectionArticle;
+
+public interface ICommunityCollectionArticleService extends IService<CommunityCollectionArticle> {
+}

+ 9 - 6
ruoyi-generator/src/main/java/com/ruoyi/generator/vo/CommunityArticleVo.java

@@ -1,9 +1,11 @@
 package com.ruoyi.generator.vo;
 package com.ruoyi.generator.vo;
 
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.ruoyi.common.core.domain.BaseEntity;
 import com.ruoyi.common.core.domain.BaseEntity;
+import com.ruoyi.generator.domain.Community.CommunityArticleCircle;
 import com.ruoyi.generator.domain.Community.CommunityArticleImages;
 import com.ruoyi.generator.domain.Community.CommunityArticleImages;
 import com.ruoyi.generator.domain.Community.CommunityTag;
 import com.ruoyi.generator.domain.Community.CommunityTag;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
@@ -59,12 +61,6 @@ public class CommunityArticleVo extends BaseEntity implements Serializable {
     @ApiModelProperty("文章内容")
     @ApiModelProperty("文章内容")
     private String content;
     private String content;
 
 
-    /**
-     * 圈子id
-     */
-    @ApiModelProperty("圈子id")
-    private String circleId;
-
     @ApiModelProperty("是否已点赞")
     @ApiModelProperty("是否已点赞")
     private boolean isLike;
     private boolean isLike;
 
 
@@ -102,6 +98,13 @@ public class CommunityArticleVo extends BaseEntity implements Serializable {
     @TableField("imageList")
     @TableField("imageList")
     private List<Map<String, Object>> imageList;
     private List<Map<String, Object>> imageList;
 
 
+    /**
+     * 圈子id
+     */
+    @ApiModelProperty("圈子信息")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private List<Long> circleIds;
+
     @ApiModelProperty("文章视频集合")
     @ApiModelProperty("文章视频集合")
     @TableField(exist = false)
     @TableField(exist = false)
     private List<CommunityArticleImages> videoList;
     private List<CommunityArticleImages> videoList;

+ 3 - 4
ruoyi-generator/src/main/resources/mapper/community/ArticleMapper.xml

@@ -9,7 +9,6 @@
         <result property="userId" column="article_user_id"/>
         <result property="userId" column="article_user_id"/>
         <result property="title" column="article_title"/>
         <result property="title" column="article_title"/>
         <result property="content" column="article_content"/>
         <result property="content" column="article_content"/>
-        <result property="circleId" column="article_circle_id"/>
         <result property="createBy" column="article_create_by"/>
         <result property="createBy" column="article_create_by"/>
         <result property="createTime" column="article_create_time"/>
         <result property="createTime" column="article_create_time"/>
         <result property="updateBy" column="article_update_by"/>
         <result property="updateBy" column="article_update_by"/>
@@ -105,7 +104,6 @@
         a.is_comment as article_is_comment,
         a.is_comment as article_is_comment,
         a.content as article_content,
         a.content as article_content,
         a.page_views as pageViews,
         a.page_views as pageViews,
-        a.circle_id as article_circle_id,
         a.create_by as article_create_by,
         a.create_by as article_create_by,
         a.create_time as article_create_time,
         a.create_time as article_create_time,
         a.update_by as article_update_by,
         a.update_by as article_update_by,
@@ -162,6 +160,7 @@
         from
         from
         community_article a
         community_article a
         left join sys_user c on a.user_id = c.user_id
         left join sys_user c on a.user_id = c.user_id
+        left join community_article_circle e on e.article_id = a.id
         <where>
         <where>
             <if test="communityArticle.id != null and communityArticle.id != ''">
             <if test="communityArticle.id != null and communityArticle.id != ''">
                 AND a.id = #{communityArticle.id}
                 AND a.id = #{communityArticle.id}
@@ -170,7 +169,7 @@
                 AND a.title like concat('%', #{communityArticle.title}, '%')
                 AND a.title like concat('%', #{communityArticle.title}, '%')
             </if>
             </if>
             <if test="circleIds != null and circleIds.size() > 0">
             <if test="circleIds != null and circleIds.size() > 0">
-                and a.circle_id IN
+                and e.circle_id IN
                 <foreach collection="circleIds" item="circleId" index="index" open="(" close=")" separator=",">
                 <foreach collection="circleIds" item="circleId" index="index" open="(" close=")" separator=",">
                     #{circleId}
                     #{circleId}
                 </foreach>
                 </foreach>
@@ -179,7 +178,7 @@
                 AND a.user_id = #{communityArticle.userId}
                 AND a.user_id = #{communityArticle.userId}
             </if>
             </if>
         </where>
         </where>
-        group by a.id
+        group by a.id,a.create_time
         <if test="searchType == 1">
         <if test="searchType == 1">
             order by a.create_time desc
             order by a.create_time desc
         </if>
         </if>