Commit 21158c3f authored by liwei's avatar liwei

修改了动态查询

parent 6d72ff72
......@@ -25,7 +25,7 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
* 分页查询 OpmArticle
*
*/
IPage<OpmArticle> queryOpmArticlePaged(CyPageInfo cyPageInfo, @Param("entity") OpmArticle cmsBanner);
IPage<OpmArticle> queryOpmArticlePaged(CyPageInfo cyPageInfo, @Param("entity") OpmArticle opmArticle);
OpmArticle selectByIdWithUrl(String id);
......
......@@ -98,7 +98,7 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
private String memSex;
/**
* 会员头像
* 会员头像url
*/
@TableField(exist = false)
private String memAvatar;
......@@ -165,5 +165,13 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
*/
@TableField(exist = false)
private String userId;
/**
* 当前登录人ID
*/
@TableField(exist = false)
private String loginUserId;
}
......@@ -4,6 +4,7 @@ package org.rcisoft.business.opmArticle.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.opmArticle.dao.OpmArticleRepository;
import org.rcisoft.business.opmArticle.entity.ArticleCommentVO;
import org.rcisoft.business.opmArticle.entity.LikeDTO;
......@@ -107,7 +108,14 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
@Override
public IPage<OpmArticle> findAllByPagination(CyPageInfo<OpmArticle> paginationUtility,
OpmArticle opmArticle){
opmArticle.setUserId(CyUserUtil.getAuthenBusinessId());
if (StringUtils.isNotEmpty(opmArticle.getUserId())){
//设置查询用户 查询某个人的动态列表
opmArticle.setUserId(opmArticle.getUserId());
}
if (StringUtils.isNotEmpty(CyUserUtil.getAuthenBusinessId())){
//设置当前登录人id
opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId());
}
IPage<OpmArticle> result = baseMapper.queryOpmArticlePaged(paginationUtility,opmArticle);
return result;
......
......@@ -119,7 +119,7 @@
opm_article.del_flag = '0'
) AS pic_ids ON opa.business_id = pic_ids.business_id
LEFT JOIN oss_info pic_urls ON pic_ids.picture_id = pic_urls.business_id
left join opm_user_like opl on opl.article_id = opa.business_id and opl.user_id = #{entity.userId}
left join opm_user_like opl on opl.article_id = opa.business_id and opl.user_id = #{entity.loginUserId}
WHERE
opa.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
......@@ -143,8 +143,8 @@
<if test="entity.topic !=null and entity.topic != '' ">
and opt.topic_name like concat('%',#{entity.topic},'%')
</if>
<if test="entity.createBy !=null and entity.createBy != '' ">
and opa.create_by = #{entity.createBy}
<if test="entity.userId !=null and entity.userId != '' ">
and opa.create_by = #{entity.userId}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and opa.create_date &gt;= #{entity.beginTime}
......@@ -170,6 +170,14 @@
SELECT
opa.*,
mi.mem_code AS memCode,
mi.mem_sex AS memSex,
mi.mem_birthday AS memBirthday,
mi.mem_max_education AS memMaxEducation,
mi.mem_residence_province AS memResidenceProvince,
mi.mem_residence_city AS memResidenceCity,
mi.mem_career AS memCareer,
mi.mem_nick_name AS memNickName,
oi.url AS memAvatar,
GROUP_CONCAT( DISTINCT pic_urls.url ORDER BY pic_urls.url SEPARATOR ',' ) AS url
FROM
opm_article opa
......@@ -187,10 +195,11 @@
opm_article.del_flag = '0'
) AS pic_ids ON opa.business_id = pic_ids.business_id
LEFT JOIN oss_info pic_urls ON pic_ids.picture_id = pic_urls.business_id
LEFT JOIN oss_info oi ON oi.business_id = mi.avatar
WHERE
1 = 1
AND opa.del_flag = '0'
AND opa.business_id = #{businessId}
AND opa.business_id = 123
GROUP BY
opa.business_id
ORDER BY
......
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