Преглед изворни кода

后台 商户相关信息优化

limingming пре 1 година
родитељ
комит
2b03559435

+ 12 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/MerchantUserController.java

@@ -45,7 +45,7 @@ public class MerchantUserController extends BaseController {
     }
 
     /**
-     * 查询全部商户信息列表(不分页)
+     * 查询全部商户信息列表
      */
     @PostMapping("/allList")
     public R<List<MerchantUser>> list() {
@@ -69,6 +69,15 @@ public class MerchantUserController extends BaseController {
 //            String uuid = UUID.randomUUID().toString().replace("-", "").substring(0, 6);
             //随机生成4位数字加字母
             String charAndNum = createCharAndNum.getCharAndNum(4);
+            //如果有重复的重新生成
+            for (int i = 0; i < 10; i++) {
+                MerchantUser one = merchantUserService.getOne(new LambdaQueryWrapper<MerchantUser>().eq(MerchantUser::getMerchantCode, charAndNum), false);
+                if (one != null) {
+                    charAndNum = createCharAndNum.getCharAndNum(4);
+                    continue;
+                }
+                break;
+            }
             param.setMerchantCode(charAndNum);
         }
         return R.ok(merchantUserService.saveOrUpdate(param));
@@ -81,8 +90,8 @@ public class MerchantUserController extends BaseController {
      */
     @PostMapping("/delete")
     public R<T> remove(@RequestBody BaseParam param) {
-        boolean sta = merchantUserService.removeById(param.getId());
-        if (!sta) {
+        boolean flat = merchantUserService.removeById(param.getId());
+        if (!flat) {
             return R.fail("删除失败");
         }
         return R.ok();