|
@@ -15,8 +15,9 @@ import java.util.List;
|
|
|
@Mapper
|
|
@Mapper
|
|
|
public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
|
|
|
|
|
- @Select("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.username) username, MAX(foll.accountBlurb) accountBlurb, MAX(foll.isMerchant) isMerchant, " +
|
|
|
|
|
- " MAX(lb.id) blackListid, MAX(if(isnull(fans.id), 0, 1)) isFollowMe, 1 as isFollowThis, " +
|
|
|
|
|
|
|
+ @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.username) username, MAX(foll.accountBlurb) accountBlurb, MAX(foll.isMerchant) isMerchant, " +
|
|
|
|
|
+ " MAX(lb.id) blackListid, MAX(if(isnull(fans.id), 0, 1)) isFollowMe, MAX(if(isnull(fans_this.id), 0, 1)) isFollowThis, MAX(if(isnull(lb.id), '0', '1')) isBlocked, " +
|
|
|
" (select count(1) from life_fans where fans_id= foll.phoneId and delete_flag =0) followNum, " +
|
|
" (select count(1) from life_fans where fans_id= foll.phoneId and delete_flag =0) followNum, " +
|
|
|
" (select count(1) from life_fans where followed_id= foll.phoneId and delete_flag =0) fansNum from ( " +
|
|
" (select count(1) from life_fans where followed_id= foll.phoneId and delete_flag =0) fansNum from ( " +
|
|
|
" with follow as ( " +
|
|
" with follow as ( " +
|
|
@@ -31,16 +32,20 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
" join store_info info on info.id = user.store_id " +
|
|
" join store_info info on info.id = user.store_id " +
|
|
|
" left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
|
|
" left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
|
|
|
" where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
|
|
" where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
|
|
|
|
|
+ "<if test=\"onlyStoreFollowed == false\">" +
|
|
|
" union " +
|
|
" union " +
|
|
|
" select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId,'' username, '' accountBlurb, '0' AS isMerchant " +
|
|
" select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId,'' username, '' accountBlurb, '0' AS isMerchant " +
|
|
|
" from follow foll " +
|
|
" from follow foll " +
|
|
|
" join life_user user on foll.phone = user.user_phone " +
|
|
" join life_user user on foll.phone = user.user_phone " +
|
|
|
" where foll.flag = 'user' and user.delete_flag = 0 " +
|
|
" where foll.flag = 'user' and user.delete_flag = 0 " +
|
|
|
|
|
+ "</if>" +
|
|
|
") foll " +
|
|
") foll " +
|
|
|
- "left join life_fans fans on fans.fans_id = foll.phoneId and fans.followed_id = #{fansId} and fans.delete_flag = 0 " +
|
|
|
|
|
|
|
+ "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_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 " +
|
|
"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} ")
|
|
|
|
|
- IPage<LifeFansVo> getMyFollowed(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
|
|
|
|
|
|
|
+ "${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);
|
|
|
|
|
|
|
|
|
|
|
|
|
@Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowMe, 1 as isFollowThis from ( " +
|
|
@Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowMe, 1 as isFollowThis from ( " +
|
|
@@ -64,8 +69,9 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
"left join life_fans fans on fans.fans_id = foll.phoneId and fans.followed_id = #{fansId} and fans.delete_flag = 0 ")
|
|
"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);
|
|
List<LifeFansVo> getMyFollowedAll(@Param("fansId") String fansId);
|
|
|
|
|
|
|
|
- @Select("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(lb.id) blackListid, MAX(if(isnull(fans.id), 0, 1)) isFollowThis, 1 as isFollowMe, " +
|
|
|
|
|
|
|
+ @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(lb.id) blackListid, MAX(if(isnull(fans.id), 0, 1)) isFollowThis, MAX(if(isnull(fans_me.id), 0, 1)) isFollowMe, MAX(if(isnull(lb.id), '0', '1')) isBlocked, " +
|
|
|
" (select count(1) from life_fans fans2 where fans2.followed_id = foll.phoneId and fans2.delete_flag = 0) fansNum, " +
|
|
" (select count(1) from life_fans fans2 where fans2.followed_id = foll.phoneId and fans2.delete_flag = 0) fansNum, " +
|
|
|
" (select count(1) from life_fans fans3 where fans3.fans_id = foll.phoneId and fans3.delete_flag = 0) followNum " +
|
|
" (select count(1) from life_fans fans3 where fans3.fans_id = foll.phoneId and fans3.delete_flag = 0) followNum " +
|
|
|
"from ( " +
|
|
"from ( " +
|
|
@@ -80,16 +86,20 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
|
|
|
" join store_info info on info.id = user.store_id " +
|
|
" join store_info info on info.id = user.store_id " +
|
|
|
" left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
|
|
" left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
|
|
|
" where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0" +
|
|
" where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0" +
|
|
|
|
|
+ "<if test=\"onlyStoreFans == false\">" +
|
|
|
" union " +
|
|
" union " +
|
|
|
" select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId, '0' AS isMerchant" +
|
|
" select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId, '0' AS isMerchant" +
|
|
|
" from follow foll " +
|
|
" from follow foll " +
|
|
|
" join life_user user on foll.phone = user.user_phone " +
|
|
" join life_user user on foll.phone = user.user_phone " +
|
|
|
" where foll.flag = 'user' and user.delete_flag = 0 " +
|
|
" where foll.flag = 'user' and user.delete_flag = 0 " +
|
|
|
|
|
+ "</if>" +
|
|
|
") foll " +
|
|
") foll " +
|
|
|
- "left join life_fans fans on fans.followed_id = foll.phoneId and fans.fans_id = #{fansId} and fans.delete_flag = 0 " +
|
|
|
|
|
|
|
+ "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_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 " +
|
|
"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} ")
|
|
|
|
|
- IPage<LifeFansVo> getMyFans(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
|
|
|
|
|
|
|
+ "${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);
|
|
|
|
|
|
|
|
// @Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowThis, 1 as isFollowMe, count(fans2.id) fansNum, count(fans3.id) followNum from ( " +
|
|
// @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 ( " +
|
|
// " with follow as ( " +
|