Bladeren bron

Merge remote-tracking branch 'origin/develop' into develop

‘linchangsheng’ 5 maanden geleden
bovenliggende
commit
8c4a15f7a5

+ 5 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/contract/SettleRelaConfigController.java

@@ -23,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 
@@ -73,11 +72,13 @@ public class SettleRelaConfigController {
 
     @PostMapping("/query/sub/websit")
     @ApiOperation(value = "查询下级网点")
-    public ResponseHelper<List<AdminWebsit>> querySubWebsit(
+    public ResponseHelper<IPage<AdminWebsit>> querySubWebsit(
             @ApiParam(value = "网点编号", required = true) @RequestParam String websitId,
-            @ApiParam(value = "网点名称", required = true) @RequestParam String websitName
+            @ApiParam(value = "网点名称", required = true) @RequestParam String websitName,
+            @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
+            @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
     ) throws RemoteServiceException {
-        List<AdminWebsit> list = settleRelaConfigLogic.querySubWebsit(websitId, websitName);
+        IPage<AdminWebsit> list = settleRelaConfigLogic.querySubWebsit(websitId, websitName, pageNum, pageSize);
         return ResponseHelper.success(list);
     }
 

+ 11 - 16
mall-server-api/src/main/java/com/gree/mall/manager/logic/contract/SettleRelaConfigLogic.java

@@ -83,16 +83,8 @@ public class SettleRelaConfigLogic {
         return bean;
     }
 
-    public List<AdminWebsit> querySubWebsit(String websitId, String websitName) {
+    public Page<AdminWebsit> querySubWebsit(String websitId, String websitName, Integer pageNum, Integer pageSize) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
-        final List<AdminWebsit> websitList = adminWebsitService.lambdaQuery()
-                .eq(AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatId())
-                .eq(AdminWebsit::getLevel, 2)
-                .like(StringUtils.isNotBlank(websitId), AdminWebsit::getWebsitId, websitId)
-                .like(StringUtils.isNotBlank(websitName), AdminWebsit::getName, websitName)
-                .orderByAsc(AdminWebsit::getBelongCompanyCode)
-                .orderByAsc(AdminWebsit::getWebsitId)
-                .list();
 
         final List<WebsitFollowConfigItem> items = websitFollowConfigItemService.lambdaQuery()
                 .eq(WebsitFollowConfigItem::getCompanyWechatId, adminUser.getCompanyWechatId())
@@ -100,14 +92,17 @@ public class SettleRelaConfigLogic {
 
         final List<String> useList = items.stream().map(WebsitFollowConfigItem::getSubWebsitId).collect(Collectors.toList());
 
-        List<AdminWebsit> list = new ArrayList<>();
-        for (AdminWebsit websit : websitList) {
-            if (!useList.contains(websit.getWebsitId())) {
-                list.add(websit);
-            }
-        }
+        final Page<AdminWebsit> websitList = adminWebsitService.lambdaQuery()
+                .eq(AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .eq(AdminWebsit::getLevel, 2)
+                .like(StringUtils.isNotBlank(websitId), AdminWebsit::getWebsitId, websitId)
+                .like(StringUtils.isNotBlank(websitName), AdminWebsit::getName, websitName)
+                .notIn(CollectionUtil.isNotEmpty(useList), AdminWebsit::getWebsitId, useList)
+                .orderByAsc(AdminWebsit::getBelongCompanyCode)
+                .orderByAsc(AdminWebsit::getWebsitId)
+                .page(new Page<>(pageNum, pageSize));
 
-        return list;
+        return websitList;
     }
 
     @Transactional