商品模块
This commit is contained in:
parent
cdec6b0b02
commit
4e63fbf1c8
|
|
@ -139,7 +139,7 @@ public class ConsInfoController {
|
|||
* @param id 耗材信息id
|
||||
* @param isStock 库存开关 1-开启 0-关闭
|
||||
*/
|
||||
@PostMapping("on-off")
|
||||
@PostMapping("onOff")
|
||||
@OperationLog("耗材信息-库存开关")
|
||||
//@SaAdminCheckPermission("consInfo:on-off")
|
||||
public CzgResult<Void> onOffConsInfo(@RequestParam Long id, @RequestParam Integer isStock) {
|
||||
|
|
|
|||
|
|
@ -101,5 +101,37 @@ public class ProdSkuDTO implements Serializable {
|
|||
* 逻辑删除字段 0否 1 删除
|
||||
*/
|
||||
private Integer isDel;
|
||||
/**
|
||||
* sku名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 是否上架别名
|
||||
*/
|
||||
private Integer isSale;
|
||||
/**
|
||||
* 是否售罄别名
|
||||
*/
|
||||
private Integer isSoldStock;
|
||||
/**
|
||||
* 售价别名
|
||||
*/
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
|
||||
public String getName() {
|
||||
return specInfo;
|
||||
}
|
||||
|
||||
public Integer getIsSale() {
|
||||
return isGrounding;
|
||||
}
|
||||
|
||||
public Integer getIsSoldStock() {
|
||||
return isPauseSale;
|
||||
}
|
||||
|
||||
public BigDecimal getLowPrice() {
|
||||
return salePrice;
|
||||
}
|
||||
}
|
||||
|
|
@ -148,6 +148,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|||
@Override
|
||||
public List<ProductDTO> getProductList(ProductDTO param) {
|
||||
QueryWrapper queryWrapper = buildFullQueryWrapper(param);
|
||||
queryWrapper.eq(Product::getIsSale, YesNoEnum.YES.value());
|
||||
List<ProductDTO> records = super.listAs(queryWrapper, ProductDTO.class);
|
||||
buildProductExtInfo(records);
|
||||
return records;
|
||||
|
|
@ -280,18 +281,36 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|||
String type = param.getType();
|
||||
Long id = param.getId();
|
||||
Integer isSale = param.getIsSale();
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsGrounding, isSale)
|
||||
.eq(ProdSku::getId, id)
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
if (ProductIsSaleTypeEnum.SKU.value().equals(type)) {
|
||||
ProdSku prodSku = prodSkuMapper.selectOneById(id);
|
||||
if (prodSku == null) {
|
||||
throw new CzgException("SKU不存在");
|
||||
}
|
||||
prodSku.setIsGrounding(isSale);
|
||||
prodSkuMapper.update(prodSku);
|
||||
long normalCount = prodSkuMapper.selectCountByQuery(QueryWrapper.create().eq(ProdSku::getProductId, prodSku.getProductId()).eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value()));
|
||||
if (normalCount == 0) {
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsSale, isSale)
|
||||
.eq(Product::getId, prodSku.getProductId())
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
||||
}
|
||||
} else if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsSale, isSale)
|
||||
.eq(Product::getId, id)
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsGrounding, isSale)
|
||||
.eq(ProdSku::getProductId, id)
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
|
||||
prodSkuMapper.selectOneById(id);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue