From f9cd111444476a62c42ba2459a7bacd888521b64 Mon Sep 17 00:00:00 2001 From: HanLong <404402223@qq.com> Date: Tue, 24 Mar 2026 20:28:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:[=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E4=BD=8D=E7=BD=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hxhq/business/controller/StorageLocationController.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java index c05b2ef..63e6933 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.hxhq.business.domain.StorageLocationJcgj; import com.hxhq.business.domain.YqJcgj; import com.hxhq.business.form.yq.StorageLocationForm; @@ -82,6 +83,12 @@ public class StorageLocationController extends BaseController public AjaxResult save(@RequestBody StorageLocationForm form) { form.setQmrId(SecurityUtils.getUserId()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StorageLocation::getName, form.getName()); + long count = storageLocationService.count(queryWrapper); + if(count > 0) { + return error("【" + form.getName() + "】已存在"); + } storageLocationService.addStorageLocation(form); return success(); } @@ -94,6 +101,12 @@ public class StorageLocationController extends BaseController public AjaxResult edit(@RequestBody StorageLocationForm form) { form.setQmrId(SecurityUtils.getUserId()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StorageLocation::getName, form.getName()); + StorageLocation storageLocation = storageLocationService.getOne(queryWrapper); + if(storageLocation != null && !storageLocation.getId().equals(form.getId())) { + return error("【" + form.getName() + "】已存在"); + } storageLocationService.updateStorageLocation(form); return success(); }