From 430a3825f5da45c6dfbed1cd718024dd45c6bc21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 4 Mar 2025 17:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=96=B9=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8E=A5=E5=8F=A3=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/czg/controller/admin/ShopPayTypeController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopPayTypeController.java b/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopPayTypeController.java index 46cf62c35..4abb18e5f 100644 --- a/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopPayTypeController.java +++ b/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopPayTypeController.java @@ -6,6 +6,7 @@ import com.czg.account.dto.paytype.ShopPayTypeAddDTO; import com.czg.account.entity.ShopPayType; import com.czg.account.service.ShopPayTypeService; import com.czg.annotation.SaAdminCheckPermission; +import com.czg.exception.ApiNotPrintException; import com.czg.resp.CzgResult; import com.czg.sa.StpKit; import com.mybatisflex.core.query.QueryWrapper; @@ -49,6 +50,14 @@ public class ShopPayTypeController { @PutMapping public CzgResult edit(@RequestBody ShopPayTypeDTO shopPayTypeDTO) { ShopPayType shopPayType = BeanUtil.copyProperties(shopPayTypeDTO, ShopPayType.class); + long count = shopPayTypeService.count(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId()).and(r -> { + r.eq(ShopPayType::getPayType, shopPayType.getPayType()).or(r1 -> { + r1.eq(ShopPayType::getPayName, shopPayType.getPayName()); + }); + })); + if (count > 0) { + throw new ApiNotPrintException("支付方式或支付名称已存在"); + } return CzgResult.success(shopPayTypeService.update(shopPayType, new QueryWrapper().eq(ShopPayType::getId, shopPayTypeDTO.getId()).eq(ShopPayType::getShopId, StpKit.USER.getShopId()))); }