创建订单扣除库存

This commit is contained in:
2024-07-03 10:12:06 +08:00
parent dfdeca9612
commit 09bfa5bdec
6 changed files with 129 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.vo.ShopGroupInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -36,4 +37,7 @@ public interface TbProductMapper {
void upGroupRealSalesNumber(@Param("id") String id,@Param("number") Integer number);
void updateStockById(@Param("productId") String productId, @Param("num") Integer num);
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} > 0")
int decrStock(@Param("id") String id, @Param("num") Integer num);
}

View File

@@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -39,4 +40,7 @@ public interface TbProductSkuMapper {
List<TbProductSku> selectSkus(@Param("list") List<String> productId);
List<TbProductSku> selectSku(@Param("productId") String productId);
}
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} > 0")
int decrStock(@Param("id") String id, @Param("num") Integer num);
}