‘linchangsheng’ il y a 2 semaines
Parent
commit
b79d6bbbc8

+ 11 - 2
src/main/java/com/gree/mall/miniapp/logic/user/AddressLogic.java

@@ -105,9 +105,18 @@ public class AddressLogic {
     }
 
     public IPage<UserAddress> page(String userId, Integer pageNum, Integer pageSize) {
-        return userAddressService.lambdaQuery()
+
+        Integer count = userAddressService.lambdaQuery()
+                .eq(StringUtils.isNotBlank(userId), UserAddress::getUserId, userId)
+                .orderByDesc(UserAddress::getCreateTime).count();
+        if (count< 1)
+            return new Page<>();
+
+        Page<UserAddress> page = userAddressService.lambdaQuery()
                 .eq(StringUtils.isNotBlank(userId), UserAddress::getUserId, userId)
-                .orderByDesc(UserAddress::getCreateTime).page(new Page(pageNum, pageSize));
+                .orderByDesc(UserAddress::getCreateTime)
+                .page(new Page<>(pageNum, pageSize));
+        return page;
 
     }