Commit bc9e1526 authored by liwei's avatar liwei

修改了会员详情接口,查询出了我喜欢的,喜欢我的,互相喜欢的三种数量

parent 3442a933
...@@ -141,5 +141,11 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> { ...@@ -141,5 +141,11 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> {
* 排行榜 * 排行榜
*/ */
IPage<MemInfo> queryRankPaged(CyPageInfo cyPageInfo,@Param("entity") MemInfo memInfo); IPage<MemInfo> queryRankPaged(CyPageInfo cyPageInfo,@Param("entity") MemInfo memInfo);
/**
* 查询我喜欢的 喜欢我的 互相喜欢的数量
*/
MemInfo selectUserFollowCount(Integer userId);
} }
...@@ -5,6 +5,8 @@ import lombok.Data; ...@@ -5,6 +5,8 @@ import lombok.Data;
@Data @Data
public class MemFollowDTO { public class MemFollowDTO {
private Integer businessId;
private Integer userId; private Integer userId;
private Integer targetId; private Integer targetId;
......
...@@ -543,5 +543,20 @@ public class MemInfo extends CyIdIncreEntity<MemInfo> { ...@@ -543,5 +543,20 @@ public class MemInfo extends CyIdIncreEntity<MemInfo> {
*/ */
@TableField(exist = false) @TableField(exist = false)
private Integer loginUserId; private Integer loginUserId;
/**
* 我喜欢的数量
*/
private Integer meFollowCount;
/**
* 喜欢我的数量
*/
private Integer followMeCount;
/**
* 互相喜欢的数量
*/
private Integer eachFollowCount;
} }
...@@ -214,7 +214,14 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -214,7 +214,14 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
*/ */
@Override @Override
public MemInfo findById(int id){ public MemInfo findById(int id){
return baseMapper.selectDetailById(id); //查询基本信息
MemInfo memInfo = baseMapper.selectDetailById(id);
//查询我喜欢的 喜欢我的 互相喜欢的数量
MemInfo memInfo1 = baseMapper.selectUserFollowCount(memInfo.getUserId());
memInfo.setFollowMeCount(memInfo1.getFollowMeCount());
memInfo.setMeFollowCount(memInfo1.getMeFollowCount());
memInfo.setEachFollowCount(memInfo1.getEachFollowCount());
return memInfo;
} }
/** /**
......
...@@ -548,7 +548,18 @@ ...@@ -548,7 +548,18 @@
<select id="queryFollowIdById" resultType="java.lang.Integer"> <select id="queryFollowIdById" resultType="java.lang.Integer">
select ouf.target_id from opm_user_follow ouf WHERE ouf.user_id = #{userId} select ouf.target_id from opm_user_follow ouf WHERE ouf.user_id = #{userId}
</select> </select>
<select id="selectUserFollowCount" resultType="org.rcisoft.business.memInfo.entity.MemInfo">
SELECT
( SELECT COUNT( business_id ) FROM opm_user_follow WHERE user_id = #{userId} ) AS meFollowCount,
( SELECT COUNT( business_id ) FROM opm_user_follow WHERE target_id = #{userId} ) AS followMeCount,
COUNT( b.business_id ) AS eachFollowCount
FROM
opm_user_follow a
LEFT JOIN opm_user_follow b ON a.user_id = b.target_id AND a.target_id = b.user_id
WHERE
a.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}
......
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