Przeglądaj źródła

中台bug修复 返回值类型更新

wuchen 2 miesięcy temu
rodzic
commit
f16844a2d3

+ 9 - 3
alien-store/src/main/java/shop/alien/store/service/impl/StoreUserServiceImpl.java

@@ -534,13 +534,19 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
             for (StorePlatformUserRole role : pageRoles) {
                 StoreUser subAccount = subAccountMap.get(role.getUserId());
                 if (subAccount == null) continue;
+                StoreUser mainAccount = role.getStoreId() == null ? null : mainAccountMap.get(role.getStoreId());
                 StoreUserVo storeUserVo = new StoreUserVo();
                 BeanUtils.copyProperties(subAccount, storeUserVo);
-                storeUserVo.setSwitchStatus(subAccount.getStatus() != null && subAccount.getStatus() == 0);
+                // 分页列表:账号ID、parentAccountId 均为主账号 id(与主账号联系电话对应),子账号 id 放入 subAccountId
+                Integer mainId = mainAccount != null ? mainAccount.getId() : subAccount.getSubAccountId();
+                storeUserVo.setId(mainId != null ? mainId : subAccount.getId());
+                storeUserVo.setSubAccountId(subAccount.getId());
+                storeUserVo.setParentAccountId(mainId);
+                int rowStatus = role.getStatus() != null ? role.getStatus() : (subAccount.getStatus() != null ? subAccount.getStatus() : 0);
+                storeUserVo.setStatus(rowStatus);
+                storeUserVo.setSwitchStatus(rowStatus == 0);
                 storeUserVo.setPhone(subAccount.getPhone());
-                StoreUser mainAccount = role.getStoreId() == null ? null : mainAccountMap.get(role.getStoreId());
                 if (mainAccount != null) {
-                    storeUserVo.setParentAccountId(mainAccount.getId());
                     storeUserVo.setParentAccountPhone(mainAccount.getPhone());
                     storeUserVo.setParentAccountName(mainAccount.getName());
                 }