zhangchen 8 時間 前
コミット
a04daa5ab9

+ 10 - 10
alien-entity/src/main/java/shop/alien/mapper/LifeFansMapper.java

@@ -19,7 +19,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "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(foll.created_time) created_time, " +
             "  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 lf_cnt where lf_cnt.fans_user_type = foll.followedUserType and lf_cnt.fans_ref_id = foll.followedRefId and lf_cnt.delete_flag = 0) followNum, " +
-            "  (select count(1) from life_fans lf_cnt2 where lf_cnt2.followed_user_type = foll.followedUserType and lf_cnt2.followed_ref_id = foll.followedRefId and lf_cnt2.delete_flag = 0) fansNum from ( " +
+            "  (select count(1) from life_fans lf_cnt2 where lf_cnt2.followed_user_type = foll.followedUserType and lf_cnt2.followed_ref_id = foll.followedRefId and lf_cnt2.delete_flag = 0) fansNum, foll.username from ( " +
             "    with follow as (   " +
             "        select followed_user_type as followedUserType, followed_ref_id as followedRefId, created_time   " +
             "        from life_fans   " +
@@ -29,7 +29,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "</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, 2 as followedUserType, user.id as followedRefId " +
+            "    user.head_img image,user.name username 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, 2 as followedUserType, user.id as followedRefId " +
             "    from follow foll " +
             "    join store_user user on foll.followedUserType = 2 and user.id = foll.followedRefId " +
             "    join store_info info on info.id = user.store_id " +
@@ -37,7 +37,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "    where user.delete_flag = 0 and info.delete_flag = 0 " +
             "<if test=\"onlyStoreFollowed == false\">" +
             "    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, foll.created_time, 1 as followedUserType, user.id as followedRefId " +
+            "    select user.id, user.user_name name,user.user_name username, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId,'' username, '' accountBlurb, '0' AS isMerchant, foll.created_time, 1 as followedUserType, user.id as followedRefId " +
             "    from follow foll " +
             "    join life_user user on foll.followedUserType = 1 and user.id = foll.followedRefId   " +
             "    where user.delete_flag = 0   " +
@@ -90,7 +90,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "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, " +
             "  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_user_type = foll.fansUserType and fans2.followed_ref_id = foll.fansRefId and fans2.delete_flag = 0) fansNum, " +
-            "    (select count(1) from life_fans fans3 where fans3.fans_user_type = foll.fansUserType and fans3.fans_ref_id = foll.fansRefId and fans3.delete_flag = 0) followNum " +
+            "    (select count(1) from life_fans fans3 where fans3.fans_user_type = foll.fansUserType and fans3.fans_ref_id = foll.fansRefId and fans3.delete_flag = 0) followNum, foll.userName username " +
             "from ( " +
             "    with follow as ( " +
             "        select fans_user_type as fansUserType, fans_ref_id as fansRefId, created_time " +
@@ -100,7 +100,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "        and 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, 2 as fansUserType, user.id as fansRefId " +
+            "    select user.id, IF(info.store_application_status = 0, user.nick_name, info.store_name) AS name,user.name userName, 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, 2 as fansUserType, user.id as fansRefId " +
             "    from follow foll " +
             "    join store_user user on foll.fansUserType = 2 and user.id = foll.fansRefId " +
             "    join store_info info on info.id = user.store_id " +
@@ -108,7 +108,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "    where user.delete_flag = 0 and info.delete_flag = 0" +
             "<if test=\"onlyStoreFans == false\">" +
             "    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, foll.created_time, 1 as fansUserType, user.id as fansRefId " +
+            "    select user.id, user.user_name name,user.user_name userName, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId, '0' AS isMerchant, foll.created_time, 1 as fansUserType, user.id as fansRefId " +
             "    from follow foll " +
             "    join life_user user on foll.fansUserType = 1 and user.id = foll.fansRefId " +
             "    where user.delete_flag = 0 " +
@@ -193,7 +193,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "select MAX(foll.id) id, MAX(foll.name) name, MAX(foll.image) image, foll.phoneId, MAX(foll.blurb) blurb, " +
             "  MAX(if(isnull(fans.id), 0, 1)) isFollowThis, 1 as isFollowMe, " +
             "       (select count(1) from life_fans fans2 where fans2.followed_user_type = foll.fansUserType and fans2.followed_ref_id = foll.fansRefId and fans2.delete_flag = 0) fansNum, " +
-            "       (select count(1) from life_fans fans3 where fans3.fans_user_type = foll.fansUserType and fans3.fans_ref_id = foll.fansRefId and fans3.delete_flag = 0) followNum " +
+            "       (select count(1) from life_fans fans3 where fans3.fans_user_type = foll.fansUserType and fans3.fans_ref_id = foll.fansRefId and fans3.delete_flag = 0) followNum, foll.username " +
             " from ( " +
             "    with follow as ( " +
             "    select fans_user_type as fansUserType, fans_ref_id as fansRefId " +
@@ -203,7 +203,7 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "    and followed_user_type = #{identityUserType} and followed_ref_id = #{identityRefId} " +
             "</if>" +
             "    ) " +
-            "    select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 1 as fansUserType, user.id as fansRefId " +
+            "    select user.id, user.user_name name, user.user_name username, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 1 as fansUserType, user.id as fansRefId " +
             "    from follow foll " +
             "    join life_user user on foll.fansUserType = 1 and user.id = foll.fansRefId " +
             "    where user.delete_flag = 0 " +
@@ -233,14 +233,14 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "        and fans1.fans_user_type = #{identityUserType} and fans1.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, 2 as followedUserType, user.id as followedRefId " +
+            "    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 , user.name username, user.account_blurb accountBlurb, IF(info.store_application_status = 1, '1', '0') AS isMerchant, foll.created_time, 2 as followedUserType, user.id as followedRefId " +
             "    from follow foll " +
             "    join store_user user on foll.followedUserType = 2 and user.id = foll.followedRefId " +
             "    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 " +
             "    where user.delete_flag = 0 and info.delete_flag = 0 " +
             "    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, foll.created_time, 1 as followedUserType, user.id as followedRefId " +
+            "    select user.id, user.user_name name,user.user_name username, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId, '' accountBlurb, '0' AS isMerchant, foll.created_time, 1 as followedUserType, user.id as followedRefId " +
             "    from follow foll " +
             "    join life_user user on foll.followedUserType = 1 and user.id = foll.followedRefId " +
             "    where user.delete_flag = 0 " +

+ 5 - 1
alien-store/src/main/java/shop/alien/store/service/LifeUserService.java

@@ -520,7 +520,11 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
     public LifeUser getUserByPhone(String phoneNum) {
         LambdaQueryWrapper<LifeUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         lambdaQueryWrapper.eq(LifeUser::getUserPhone, phoneNum);
-        LifeUser user = this.getOne(lambdaQueryWrapper);
+        lambdaQueryWrapper.in(LifeUser::getLogoutFlag,0, 2);
+        lambdaQueryWrapper.orderByDesc(LifeUser::getCreatedTime).orderByDesc(LifeUser::getId);
+        lambdaQueryWrapper.last("LIMIT 1");
+        List<LifeUser> users = this.list(lambdaQueryWrapper);
+        LifeUser user = users.isEmpty() ? null : users.get(0);
         if (user != null) {
             String userId = "user_" + phoneNum;
             LifeFansIdentityQuery.Scope userScope = new LifeFansIdentityQuery.Scope(userId, 1, user.getId());