商品模块
This commit is contained in:
@@ -139,7 +139,7 @@ public class ConsInfoController {
|
|||||||
* @param id 耗材信息id
|
* @param id 耗材信息id
|
||||||
* @param isStock 库存开关 1-开启 0-关闭
|
* @param isStock 库存开关 1-开启 0-关闭
|
||||||
*/
|
*/
|
||||||
@PostMapping("on-off")
|
@PostMapping("onOff")
|
||||||
@OperationLog("耗材信息-库存开关")
|
@OperationLog("耗材信息-库存开关")
|
||||||
//@SaAdminCheckPermission("consInfo:on-off")
|
//@SaAdminCheckPermission("consInfo:on-off")
|
||||||
public CzgResult<Void> onOffConsInfo(@RequestParam Long id, @RequestParam Integer isStock) {
|
public CzgResult<Void> onOffConsInfo(@RequestParam Long id, @RequestParam Integer isStock) {
|
||||||
|
|||||||
@@ -101,5 +101,37 @@ public class ProdSkuDTO implements Serializable {
|
|||||||
* 逻辑删除字段 0否 1 删除
|
* 逻辑删除字段 0否 1 删除
|
||||||
*/
|
*/
|
||||||
private Integer isDel;
|
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
|
@Override
|
||||||
public List<ProductDTO> getProductList(ProductDTO param) {
|
public List<ProductDTO> getProductList(ProductDTO param) {
|
||||||
QueryWrapper queryWrapper = buildFullQueryWrapper(param);
|
QueryWrapper queryWrapper = buildFullQueryWrapper(param);
|
||||||
|
queryWrapper.eq(Product::getIsSale, YesNoEnum.YES.value());
|
||||||
List<ProductDTO> records = super.listAs(queryWrapper, ProductDTO.class);
|
List<ProductDTO> records = super.listAs(queryWrapper, ProductDTO.class);
|
||||||
buildProductExtInfo(records);
|
buildProductExtInfo(records);
|
||||||
return records;
|
return records;
|
||||||
@@ -280,18 +281,36 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|||||||
String type = param.getType();
|
String type = param.getType();
|
||||||
Long id = param.getId();
|
Long id = param.getId();
|
||||||
Integer isSale = param.getIsSale();
|
Integer isSale = param.getIsSale();
|
||||||
UpdateChain.of(ProdSku.class)
|
if (ProductIsSaleTypeEnum.SKU.value().equals(type)) {
|
||||||
.set(ProdSku::getIsGrounding, isSale)
|
ProdSku prodSku = prodSkuMapper.selectOneById(id);
|
||||||
.eq(ProdSku::getId, id)
|
if (prodSku == null) {
|
||||||
.eq(ProdSku::getShopId, shopId)
|
throw new CzgException("SKU不存在");
|
||||||
.update();
|
}
|
||||||
if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
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();
|
||||||
|
}
|
||||||
|
} else if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
||||||
UpdateChain.of(Product.class)
|
UpdateChain.of(Product.class)
|
||||||
.set(Product::getIsSale, isSale)
|
.set(Product::getIsSale, isSale)
|
||||||
.eq(Product::getId, id)
|
.eq(Product::getId, id)
|
||||||
.eq(Product::getShopId, shopId)
|
.eq(Product::getShopId, shopId)
|
||||||
.update();
|
.update();
|
||||||
|
UpdateChain.of(ProdSku.class)
|
||||||
|
.set(ProdSku::getIsGrounding, isSale)
|
||||||
|
.eq(ProdSku::getProductId, id)
|
||||||
|
.eq(ProdSku::getShopId, shopId)
|
||||||
|
.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prodSkuMapper.selectOneById(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user