Commit 42ee46f4 authored by liwei's avatar liwei

修改了动态的关注查询

parent 0b3842cf
...@@ -117,5 +117,10 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> { ...@@ -117,5 +117,10 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> {
* 点赞 * 点赞
*/ */
Integer addLike(@Param("entity") MemLikeDTO likeDTO); Integer addLike(@Param("entity") MemLikeDTO likeDTO);
/**
* 查询关注的id集合
*/
List<Integer> queryFollowIdById(String authenBusinessId);
} }
...@@ -201,5 +201,16 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> { ...@@ -201,5 +201,16 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
*/ */
@TableField(exist = false) @TableField(exist = false)
private Integer parentId; private Integer parentId;
/**
* 动态查询类型 1:个人 0:关注 2:最近 3:话题
*/
@TableField(exist = false)
private String articleType;
/**
* 关注的数组
*/
private List<Integer> followList;
} }
...@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.rcisoft.baidu.censor.dto.CensorResult; import org.rcisoft.baidu.censor.dto.CensorResult;
import org.rcisoft.baidu.censor.service.ContentCensorService; import org.rcisoft.baidu.censor.service.ContentCensorService;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.opmArticle.dao.OpmArticleRepository; import org.rcisoft.business.opmArticle.dao.OpmArticleRepository;
import org.rcisoft.business.opmArticle.entity.ArticleCommentDTO; import org.rcisoft.business.opmArticle.entity.ArticleCommentDTO;
import org.rcisoft.business.opmArticle.entity.ArticleCommentVO; import org.rcisoft.business.opmArticle.entity.ArticleCommentVO;
...@@ -46,6 +47,8 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm ...@@ -46,6 +47,8 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
private ContentCensorService contentCensorService; private ContentCensorService contentCensorService;
@Autowired @Autowired
private CyFileStorageService cyFileStorageService; private CyFileStorageService cyFileStorageService;
@Autowired
private MemInfoRepository memInfoRepository;
/** /**
* 保存 opmArticle管理 * 保存 opmArticle管理
* @param opmArticle * @param opmArticle
...@@ -160,15 +163,24 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm ...@@ -160,15 +163,24 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
@Override @Override
public IPage<OpmArticle> findAllByPagination(CyPageInfo<OpmArticle> paginationUtility, public IPage<OpmArticle> findAllByPagination(CyPageInfo<OpmArticle> paginationUtility,
OpmArticle opmArticle){ OpmArticle opmArticle){
IPage<OpmArticle> result = null;
if (opmArticle.getArticleType().equals("0")){
//关注
//查询该用户关注对象的id集合
List<Integer> list = memInfoRepository.queryFollowIdById(CyUserUtil.getAuthenBusinessId());
opmArticle.setFollowList(list);
result = baseMapper.queryOpmArticlePaged(paginationUtility,opmArticle);
} else {
if (StringUtils.isNotEmpty(opmArticle.getUserId())){ if (StringUtils.isNotEmpty(opmArticle.getUserId())){
//设置查询用户 查询某个人的动态列表 //设置查询用户 查询某个人的动态列表
opmArticle.setUserId(opmArticle.getUserId()); opmArticle.setUserId(opmArticle.getUserId());
} }
if (StringUtils.isNotEmpty(CyUserUtil.getAuthenBusinessId())){ if (StringUtils.isNotEmpty(CyUserUtil.getAuthenBusinessId())){
//设置当前登录人id //设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId()); opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId());
} }
IPage<OpmArticle> result = baseMapper.queryOpmArticlePaged(paginationUtility,opmArticle); result = baseMapper.queryOpmArticlePaged(paginationUtility,opmArticle);
}
return result; return result;
} }
......
...@@ -523,6 +523,10 @@ ...@@ -523,6 +523,10 @@
SELECT MAX(CASE WHEN ouf.business_id IS NOT NULL THEN 1 ELSE 0 END) AS isFollowed SELECT MAX(CASE WHEN ouf.business_id IS NOT NULL THEN 1 ELSE 0 END) AS isFollowed
FROM (SELECT 1 AS dummy) d LEFT JOIN opm_user_follow ouf ON ouf.user_id = #{entity.userId} AND ouf.target_id = #{entity.targetId}; FROM (SELECT 1 AS dummy) d LEFT JOIN opm_user_follow ouf ON ouf.user_id = #{entity.userId} AND ouf.target_id = #{entity.targetId};
</select> </select>
<select id="queryFollowIdById" resultType="java.lang.Integer">
select ouf.target_id from opm_user_follow ouf WHERE ouf.user_id = #{userId}
</select>
<delete id="deleteFollow" parameterType="org.rcisoft.business.memInfo.entity.MemFollowDTO"> <delete id="deleteFollow" parameterType="org.rcisoft.business.memInfo.entity.MemFollowDTO">
delete from opm_user_follow delete from opm_user_follow
where user_id = #{entity.userId} and target_id = #{entity.targetId} where user_id = #{entity.userId} and target_id = #{entity.targetId}
......
...@@ -173,6 +173,13 @@ ...@@ -173,6 +173,13 @@
<if test="entity.commentCount !=null and entity.commentCount != '' "> <if test="entity.commentCount !=null and entity.commentCount != '' ">
and opa.comment_count &gt;= #{entity.commentCount} and opa.comment_count &gt;= #{entity.commentCount}
</if> </if>
<if test="entity.followList != null and entity.followList.size > 0">
and opa.create_by IN
<foreach item="item" index="index" collection="entity.followList"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY GROUP BY
opa.business_id opa.business_id
ORDER BY ORDER BY
......
...@@ -30,7 +30,9 @@ ...@@ -30,7 +30,9 @@
su.nick_name as nickName su.nick_name as nickName
FROM opm_topic cn FROM opm_topic cn
LEFT JOIN sys_user su on su.business_id = cn.create_by LEFT JOIN sys_user su on su.business_id = cn.create_by
where cn.del_flag='0' where 1=1
and cn.del_flag = '0'
and cn.flag = '1'
<if test="entity.flag!=null and entity.flag != '' "> <if test="entity.flag!=null and entity.flag != '' ">
and cn.flag = #{entity.flag} and cn.flag = #{entity.flag}
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment