main
parent
4e81ecad34
commit
b72ad7e2b0
|
|
@ -73,6 +73,8 @@ public class AppUserDynamic extends BaseEntity
|
|||
// 动态ids
|
||||
private List<Long> ids;
|
||||
|
||||
private List<Long> dynamicIds;
|
||||
|
||||
public void setIsTop(Long isTop)
|
||||
{
|
||||
this.isTop = isTop;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.app.mapper;
|
|||
import java.util.List;
|
||||
import com.ruoyi.app.domain.AppUserDynamic;
|
||||
import com.ruoyi.app.domain.vo.AppUserDynamicVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* App用户动态Mapper接口
|
||||
|
|
@ -28,6 +29,7 @@ public interface AppUserDynamicMapper
|
|||
* @return App用户动态集合
|
||||
*/
|
||||
public List<AppUserDynamic> selectAppUserDynamicList(AppUserDynamic appUserDynamic);
|
||||
public List<Long> listByUserIds(@Param("ids")List<Long> ids);
|
||||
public List<AppUserDynamicVo> selectDynamicList(AppUserDynamic appUserDynamic);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
|
|||
@Autowired
|
||||
private AppUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private AppUserFriendMapper appUserFriendMapper;
|
||||
|
||||
/**
|
||||
* 查询App用户动态
|
||||
*
|
||||
|
|
@ -150,14 +153,25 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
|
|||
|
||||
@Override
|
||||
public List<AppUserDynamicVo> selectDynamicList(AppUserDynamic appUserDynamic) {
|
||||
// 收藏评论
|
||||
if (appUserDynamic.getIsCollect() == 1 && appUserDynamic.getAppId() != null) {
|
||||
AppUserCollect appUserCollect = new AppUserCollect();
|
||||
appUserCollect.setUserId(appUserDynamic.getAppId());
|
||||
List<AppUserCollect> appUserCollects = appUserCollectMapper.selectAppUserCollectList(appUserCollect);
|
||||
appUserDynamic.setIds(appUserCollects.stream().map(x->x.getDynamicId()).collect(Collectors.toList()));
|
||||
}
|
||||
if (appUserDynamic.getAppId() == null && appUserDynamic.getUserId() == null) {
|
||||
|
||||
// 自己全部数据、公开数据、好友数据
|
||||
if (appUserDynamic.getIsCollect() != 1 && appUserDynamic.getUserId() != null) {
|
||||
appUserDynamic.setPrivacyStatus(0l);
|
||||
AppUserFriend appUserFriend = new AppUserFriend();
|
||||
appUserFriend.setUserId(appUserDynamic.getUserId());
|
||||
List<AppUserFriend> friends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
|
||||
if (friends != null && friends.size() > 0) {
|
||||
// 好友的动态
|
||||
List<Long> dynamicIds = appUserDynamicMapper.listByUserIds(friends.stream().map(x->x.getFriendId()).collect(Collectors.toList()));
|
||||
appUserDynamic.setDynamicIds(dynamicIds);
|
||||
}
|
||||
}
|
||||
List<AppUserDynamicVo> list = appUserDynamicMapper.selectDynamicList(appUserDynamic);
|
||||
for (AppUserDynamicVo appUserDynamicVo : list) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="videoUrl != null and videoUrl != ''"> and a.video_url = #{videoUrl}</if>
|
||||
<if test="topicId != null "> and a.topic_id like concat('%',#{topicId},'%')</if>
|
||||
<if test="address != null and address != ''"> and a.address = #{address}</if>
|
||||
<if test="privacyStatus != null "> and a.privacy_status = #{privacyStatus}</if>
|
||||
<if test="privacyStatus != null ">
|
||||
and (
|
||||
a.privacy_status = #{privacyStatus}
|
||||
<if test="dynamicIds != null and dynamicIds.size() > 0">
|
||||
or a.id in
|
||||
<foreach collection="dynamicIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userId != null "> or a.user_id = #{userId}</if>
|
||||
)
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and a.updateBy = #{updateBy}</if>
|
||||
<if test="isTop != null "> and a.is_top = #{isTop}</if>
|
||||
<if test="isMember != null "> and u.is_member = #{isMember}</if>
|
||||
|
|
@ -95,6 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listByUserIds" parameterType="Long" resultType="Long">
|
||||
select id from app_user_dynamic
|
||||
where privacy_status = 1 and user_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectcById" parameterType="Long" resultType="com.ruoyi.app.domain.vo.AppUserDynamicVo">
|
||||
select a.id as "id",a.user_id as "userId",a.content as "content",a.video_url as "videoUrl",a.topic_id as "topicId",a.address as "address",
|
||||
a.is_top as "isTop",
|
||||
|
|
|
|||
Loading…
Reference in New Issue