支付方式修改接口完善
This commit is contained in:
@@ -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<Boolean> 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())));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user