支付方式修改接口完善
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.czg.account.dto.ShopPayTypeDTO;
|
import com.czg.account.dto.ShopPayTypeDTO;
|
||||||
import com.czg.account.dto.paytype.ShopPayTypeAddDTO;
|
import com.czg.account.dto.paytype.ShopPayTypeAddDTO;
|
||||||
import com.czg.account.entity.ShopPayType;
|
import com.czg.account.entity.ShopPayType;
|
||||||
@@ -50,13 +51,13 @@ public class ShopPayTypeController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public CzgResult<Boolean> edit(@RequestBody ShopPayTypeDTO shopPayTypeDTO) {
|
public CzgResult<Boolean> edit(@RequestBody ShopPayTypeDTO shopPayTypeDTO) {
|
||||||
ShopPayType shopPayType = BeanUtil.copyProperties(shopPayTypeDTO, ShopPayType.class);
|
ShopPayType shopPayType = BeanUtil.copyProperties(shopPayTypeDTO, ShopPayType.class);
|
||||||
long count = shopPayTypeService.count(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId()).and(r -> {
|
if (StrUtil.isNotBlank(shopPayTypeDTO.getPayName())) {
|
||||||
r.eq(ShopPayType::getPayType, shopPayType.getPayType()).or(r1 -> {
|
long count = shopPayTypeService.count(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId())
|
||||||
r1.eq(ShopPayType::getPayName, shopPayType.getPayName());
|
.eq(ShopPayType::getPayName, shopPayTypeDTO.getPayName())
|
||||||
});
|
.ne(ShopPayType::getId, shopPayTypeDTO.getId()));
|
||||||
}).ne(ShopPayType::getId, shopPayTypeDTO.getId()));
|
if (count > 0) {
|
||||||
if (count > 0) {
|
throw new ApiNotPrintException("支付方式或支付名称已存在");
|
||||||
throw new ApiNotPrintException("支付方式或支付名称已存在");
|
}
|
||||||
}
|
}
|
||||||
return CzgResult.success(shopPayTypeService.update(shopPayType, new QueryWrapper().eq(ShopPayType::getId, shopPayTypeDTO.getId()).eq(ShopPayType::getShopId, StpKit.USER.getShopId())));
|
return CzgResult.success(shopPayTypeService.update(shopPayType, new QueryWrapper().eq(ShopPayType::getId, shopPayTypeDTO.getId()).eq(ShopPayType::getShopId, StpKit.USER.getShopId())));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class ShopPayTypeDTO implements Serializable {
|
|||||||
* 是否快捷展示1是0否
|
* 是否快捷展示1是0否
|
||||||
*/
|
*/
|
||||||
private Integer isShowShortcut;
|
private Integer isShowShortcut;
|
||||||
|
private String payName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0允许退款 1-不允许退款
|
* 0允许退款 1-不允许退款
|
||||||
|
|||||||
Reference in New Issue
Block a user