1
0
Эх сурвалжийг харах

fixed 店铺商品列表查询优化

fushengqian 1 жил өмнө
parent
commit
8c0ebdabdb

+ 1 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/CateServiceImpl.java

@@ -227,7 +227,7 @@ public class CateServiceImpl extends ServiceImpl<MtGoodsCateMapper, MtGoodsCate>
         String storeId =  params.get("storeId") == null ? "" : params.get("storeId").toString();
         String merchantId =  params.get("merchantId") == null ? "" : params.get("merchantId").toString();
         if (StringUtils.isNotBlank(merchantId)) {
-            lambdaQueryWrapper.like(MtGoodsCate::getMerchantId, merchantId);
+            lambdaQueryWrapper.eq(MtGoodsCate::getMerchantId, merchantId);
         }
         String name =  params.get("name") == null ? "" : params.get("name").toString();
         if (StringUtils.isNotBlank(name)) {

+ 9 - 5
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendCashierController.java

@@ -110,19 +110,19 @@ public class BackendCashierController extends BaseController {
         }
 
         TAccount accountInfo = accountService.getAccountInfoById(accountDto.getId());
-        Integer storeId = accountInfo.getStoreId();
-        MtStore storeInfo;
+        Integer storeId = (accountInfo.getStoreId() == null || accountInfo.getStoreId() < 1) ? 0 : accountInfo.getStoreId();
+        MtStore storeInfo = null;
         if (storeId == null || storeId < 1) {
             MtMerchant mtMerchant = merchantService.queryMerchantById(accountInfo.getMerchantId());
             if (mtMerchant != null) {
                 storeInfo = storeService.getDefaultStore(mtMerchant.getNo());
-            } else {
-                storeInfo = storeService.getDefaultStore("");
             }
         } else {
             storeInfo = storeService.queryStoreById(storeId);
         }
-        storeId = storeInfo.getId();
+        if (storeInfo != null) {
+            storeId = storeInfo.getId();
+        }
         MtUser memberInfo = null;
         if (userId != null && userId > 0) {
             memberInfo = memberService.queryMemberById(userId);
@@ -131,9 +131,13 @@ public class BackendCashierController extends BaseController {
         param.put("status", StatusEnum.ENABLED.getKey());
         if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
             param.put("merchantId", accountInfo.getMerchantId());
+        } else {
+            param.put("merchantId", 0);
         }
         if (storeId > 0) {
             param.put("storeId", storeId);
+        } else {
+            param.put("storeId", 0);
         }
         List<MtGoodsCate> cateList = cateService.queryCateListByParams(param);
 

+ 6 - 2
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendMerchantController.java

@@ -162,8 +162,12 @@ public class BackendMerchantController extends BaseController {
             merchantId = accountInfo.getMerchantId();
         }
 
-        String operator = accountInfo.getAccountName();
-        merchantService.updateStatus(merchantId, operator, status);
+        try {
+            String operator = accountInfo.getAccountName();
+            merchantService.updateStatus(merchantId, operator, status);
+        } catch (BusinessCheckException e) {
+            return getFailureResult(201, e.getMessage());
+        }
 
         return getSuccessResult(true);
     }