|
|
@@ -23,7 +23,11 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
" with follow as ( " +
|
|
|
" select substring_index(followed_id, '_', 1) as flag, substring_index(followed_id, '_', -1) as phone, created_time " +
|
|
|
" from life_fans " +
|
|
|
- " where delete_flag = 0 and fans_id = #{fansId} " +
|
|
|
+ " where delete_flag = 0 and (fans_id = #{fansId} " +
|
|
|
+ "<if test=\"identityUserType != null and identityRefId != null\">" +
|
|
|
+ " or (fans_user_type = #{identityUserType} and fans_ref_id = #{identityRefId}) " +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
" ) " +
|
|
|
" select info.id, IF(info.store_application_status = 0, user.nick_name, info.store_name) AS NAME," +
|
|
|
" user.head_img image, concat('store_', user.phone) phoneId, IF(info.store_application_status = 0, user.account_blurb, info.store_blurb) AS blurb, 1 blockedType,user.id blockedId ,IFNULL(user.nick_name, user.name) username, user.account_blurb accountBlurb, IF(info.store_application_status = 1, '1', '0') AS isMerchant, foll.created_time " +
|
|
|
@@ -40,19 +44,32 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
" where foll.flag = 'user' and user.delete_flag = 0 " +
|
|
|
"</if>" +
|
|
|
") foll " +
|
|
|
- "left join life_fans fans on fans.fans_id = foll.phoneId and fans.followed_id = #{relationFansId} and fans.delete_flag = 0 " +
|
|
|
- "left join life_fans fans_this on fans_this.fans_id = #{relationFansId} and fans_this.followed_id = foll.phoneId and fans_this.delete_flag = 0 " +
|
|
|
+ "left join life_fans fans on fans.fans_id = foll.phoneId and fans.delete_flag = 0 and (fans.followed_id = #{relationFansId} " +
|
|
|
+ "<if test=\"relationIdentityUserType != null and relationIdentityRefId != null\">" +
|
|
|
+ " or (fans.followed_user_type = #{relationIdentityUserType} and fans.followed_ref_id = #{relationIdentityRefId})" +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
+ "left join life_fans fans_this on fans_this.followed_id = foll.phoneId and fans_this.delete_flag = 0 and (fans_this.fans_id = #{relationFansId} " +
|
|
|
+ "<if test=\"relationIdentityUserType != null and relationIdentityRefId != null\">" +
|
|
|
+ " or (fans_this.fans_user_type = #{relationIdentityUserType} and fans_this.fans_ref_id = #{relationIdentityRefId})" +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
"left join life_blacklist lb on lb.blocked_type = foll.blockedType and lb.blocked_id = foll.blockedId and lb.blocker_type = #{blockerType} and lb.blocker_id = #{blockerId} and lb.delete_flag = 0 " +
|
|
|
"${ew.customSqlSegment} " +
|
|
|
"</script>")
|
|
|
- IPage<LifeFansVo> getMyFollowed(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("relationFansId") String relationFansId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param("onlyStoreFollowed") boolean onlyStoreFollowed, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
|
|
|
+ IPage<LifeFansVo> getMyFollowed(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("identityUserType") Integer identityUserType, @Param("identityRefId") Integer identityRefId, @Param("relationFansId") String relationFansId, @Param("relationIdentityUserType") Integer relationIdentityUserType, @Param("relationIdentityRefId") Integer relationIdentityRefId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param("onlyStoreFollowed") boolean onlyStoreFollowed, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
|
|
|
|
|
|
|
|
|
- @Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowMe, 1 as isFollowThis from ( " +
|
|
|
+ @Select("<script>" +
|
|
|
+ "select foll.*, if(isnull(fans.id), 0, 1) isFollowMe, 1 as isFollowThis from ( " +
|
|
|
" with follow as ( " +
|
|
|
" select substring_index(followed_id, '_', 1) as flag, substring_index(followed_id, '_', -1) as phone " +
|
|
|
" from life_fans " +
|
|
|
- " where delete_flag = 0 and fans_id = #{fansId} " +
|
|
|
+ " where delete_flag = 0 and (fans_id = #{fansId} " +
|
|
|
+ "<if test=\"identityUserType != null and identityRefId != null\">" +
|
|
|
+ " or (fans_user_type = #{identityUserType} and fans_ref_id = #{identityRefId}) " +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
" ) " +
|
|
|
" select info.id, info.store_name name, img.img_url image, concat('store_', user.phone) phoneId " +
|
|
|
" from follow foll " +
|
|
|
@@ -66,8 +83,13 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
" join life_user user on foll.phone = user.user_phone " +
|
|
|
" where foll.flag = 'user' and user.delete_flag = 0 " +
|
|
|
") foll " +
|
|
|
- "left join life_fans fans on fans.fans_id = foll.phoneId and fans.followed_id = #{fansId} and fans.delete_flag = 0 ")
|
|
|
- List<LifeFansVo> getMyFollowedAll(@Param("fansId") String fansId);
|
|
|
+ "left join life_fans fans on fans.fans_id = foll.phoneId and fans.delete_flag = 0 and (fans.followed_id = #{fansId} " +
|
|
|
+ "<if test=\"identityUserType != null and identityRefId != null\">" +
|
|
|
+ " or (fans.followed_user_type = #{identityUserType} and fans.followed_ref_id = #{identityRefId})" +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
+ "</script>")
|
|
|
+ List<LifeFansVo> getMyFollowedAll(@Param("fansId") String fansId, @Param("identityUserType") Integer identityUserType, @Param("identityRefId") Integer identityRefId);
|
|
|
|
|
|
@Select("<script>" +
|
|
|
"select MAX(foll.id) id, MAX(foll.name) name, MAX(foll.image) image, foll.phoneId, MAX(foll.blurb) blurb, MAX(foll.blockedType) blockedType, MAX(foll.blockedId) blockedId, MAX(foll.isMerchant) isMerchant, MAX(foll.created_time) created_time, " +
|
|
|
@@ -78,7 +100,11 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
" with follow as ( " +
|
|
|
" select substring_index(fans_id, '_', 1) as flag, substring_index(fans_id, '_', -1) as phone, created_time " +
|
|
|
" from life_fans " +
|
|
|
- " where delete_flag = 0 and followed_id = #{fansId} " +
|
|
|
+ " where delete_flag = 0 and (followed_id = #{fansId} " +
|
|
|
+ "<if test=\"identityUserType != null and identityRefId != null\">" +
|
|
|
+ " or (followed_user_type = #{identityUserType} and followed_ref_id = #{identityRefId}) " +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
" ) " +
|
|
|
" select user.id, IF(info.store_application_status = 0, user.nick_name, info.store_name) AS name, user.head_img image, concat('store_', user.phone) phoneId, IF(info.store_application_status = 0, user.account_blurb, info.store_blurb) AS blurb, 1 blockedType,user.id blockedId, IF(info.store_application_status = 1, '1', '0') AS isMerchant, foll.created_time " +
|
|
|
" from follow foll " +
|
|
|
@@ -94,12 +120,20 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
" where foll.flag = 'user' and user.delete_flag = 0 " +
|
|
|
"</if>" +
|
|
|
") foll " +
|
|
|
- "left join life_fans fans on fans.followed_id = foll.phoneId and fans.fans_id = #{relationFansId} and fans.delete_flag = 0 " +
|
|
|
- "left join life_fans fans_me on fans_me.fans_id = foll.phoneId and fans_me.followed_id = #{relationFansId} and fans_me.delete_flag = 0 " +
|
|
|
+ "left join life_fans fans on fans.followed_id = foll.phoneId and fans.delete_flag = 0 and (fans.fans_id = #{relationFansId} " +
|
|
|
+ "<if test=\"relationIdentityUserType != null and relationIdentityRefId != null\">" +
|
|
|
+ " or (fans.fans_user_type = #{relationIdentityUserType} and fans.fans_ref_id = #{relationIdentityRefId})" +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
+ "left join life_fans fans_me on fans_me.fans_id = foll.phoneId and fans_me.delete_flag = 0 and (fans_me.followed_id = #{relationFansId} " +
|
|
|
+ "<if test=\"relationIdentityUserType != null and relationIdentityRefId != null\">" +
|
|
|
+ " or (fans_me.followed_user_type = #{relationIdentityUserType} and fans_me.followed_ref_id = #{relationIdentityRefId})" +
|
|
|
+ "</if>" +
|
|
|
+ ") " +
|
|
|
"left join life_blacklist lb on lb.blocked_type = foll.blockedType and lb.blocked_id = foll.blockedId and lb.blocker_type = #{blockerType} and lb.blocker_id = #{blockerId} and lb.delete_flag = 0 " +
|
|
|
"${ew.customSqlSegment} " +
|
|
|
"</script>")
|
|
|
- IPage<LifeFansVo> getMyFans(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("relationFansId") String relationFansId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param("onlyStoreFans") boolean onlyStoreFans, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
|
|
|
+ IPage<LifeFansVo> getMyFans(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("identityUserType") Integer identityUserType, @Param("identityRefId") Integer identityRefId, @Param("relationFansId") String relationFansId, @Param("relationIdentityUserType") Integer relationIdentityUserType, @Param("relationIdentityRefId") Integer relationIdentityRefId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param("onlyStoreFans") boolean onlyStoreFans, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
|
|
|
|
|
|
// @Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowThis, 1 as isFollowMe, count(fans2.id) fansNum, count(fans3.id) followNum from ( " +
|
|
|
// " with follow as ( " +
|