支付方式接口完善
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.ShopPayTypeDTO;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
@@ -58,4 +61,28 @@ public class ShopPayTypeServiceImpl extends ServiceImpl<ShopPayTypeMapper, ShopP
|
||||
payType.setShopId(shopId);
|
||||
return save(payType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean edit(Long shopId, ShopPayTypeDTO shopPayTypeDTO) {
|
||||
ShopPayType shopPayType = BeanUtil.copyProperties(shopPayTypeDTO, ShopPayType.class);
|
||||
if (StrUtil.isNotBlank(shopPayTypeDTO.getPayName())) {
|
||||
long count = count(new QueryWrapper().eq(ShopPayType::getShopId, shopId)
|
||||
.eq(ShopPayType::getPayName, shopPayTypeDTO.getPayName())
|
||||
.ne(ShopPayType::getId, shopPayTypeDTO.getId()));
|
||||
if (count > 0) {
|
||||
throw new ApiNotPrintException("支付名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(shopPayTypeDTO.getPayType())) {
|
||||
long count = count(new QueryWrapper().eq(ShopPayType::getShopId, shopId)
|
||||
.eq(ShopPayType::getPayType, shopPayTypeDTO.getPayType())
|
||||
.ne(ShopPayType::getId, shopPayTypeDTO.getId()));
|
||||
if (count > 0) {
|
||||
throw new ApiNotPrintException("支付方式已存在");
|
||||
}
|
||||
}
|
||||
|
||||
return update(shopPayType, new QueryWrapper().eq(ShopPayType::getId, shopPayTypeDTO.getId()).eq(ShopPayType::getShopId, shopId));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user