快捷修改接口 价格问题

This commit is contained in:
wangw 2024-09-23 14:00:17 +08:00
parent 551104543d
commit 8208f97c67
3 changed files with 11 additions and 1 deletions

View File

@ -205,4 +205,8 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
@Modifying
@Query("update TbProductSku set isGrounding=:isGrounding where id=:skuId")
void updateGrounding(Integer skuId,int isGrounding);
@Modifying
@Query("update TbProductSku set salePrice = :salePrice where productId=:productId")
void upSalePrice(@Param("productId") Integer productId, @Param("lowPrice") BigDecimal salePrice);
}

View File

@ -379,6 +379,12 @@ public class StockServiceImpl implements StockService {
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue());
break;
case "salePrice"://价格
description.append("修改价格为" + updateValueVO.getValue());
sqlQuery.append(" set low_price = ").append(updateValueVO.getValue());
tbProductRepository.upLowPrice(product.getId(),new BigDecimal(updateValueVO.getValue()));
tbProductSkuRepository.upSalePrice(product.getId(),new BigDecimal(updateValueVO.getValue()));
break;
// case "stock"://库存开关
// if (!"0".equals(updateValueVO.getValue()) && !"1".equals(updateValueVO.getValue())) {
// throw new BadRequestException("无效值");

View File

@ -13,7 +13,7 @@ public class StockUpdateValueVO {
private String shopId;
@NotNull
private boolean isSku;
@NotNull(message = "主键不可为空")
// @NotNull(message = "主键不可为空")
private String id;
@NotNull(message = "key不可为空")
private String key;