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 af2081422..543aac0a3 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 @@ -1,6 +1,7 @@ package com.czg.controller.admin; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; import com.czg.account.dto.ShopPayTypeDTO; import com.czg.account.dto.paytype.ShopPayTypeAddDTO; import com.czg.account.entity.ShopPayType; @@ -50,13 +51,13 @@ 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()); - }); - }).ne(ShopPayType::getId, shopPayTypeDTO.getId())); - if (count > 0) { - throw new ApiNotPrintException("支付方式或支付名称已存在"); + if (StrUtil.isNotBlank(shopPayTypeDTO.getPayName())) { + long count = shopPayTypeService.count(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId()) + .eq(ShopPayType::getPayName, shopPayTypeDTO.getPayName()) + .ne(ShopPayType::getId, shopPayTypeDTO.getId())); + 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()))); } diff --git a/cash-common/cash-common-service/src/main/java/com/czg/account/dto/ShopPayTypeDTO.java b/cash-common/cash-common-service/src/main/java/com/czg/account/dto/ShopPayTypeDTO.java index e3cd0be86..4a82484d1 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/account/dto/ShopPayTypeDTO.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/account/dto/ShopPayTypeDTO.java @@ -33,6 +33,7 @@ public class ShopPayTypeDTO implements Serializable { * 是否快捷展示1是0否 */ private Integer isShowShortcut; + private String payName; /** * 0允许退款 1-不允许退款