秒杀拼团下单时的一些bug
This commit is contained in:
@ -34,7 +34,7 @@ public interface YxStoreCombinationMapper extends CoreMapper<YxStoreCombination>
|
||||
" where id=#{combinationId}")
|
||||
int incStockDecSales(@Param("num") int num,@Param("combinationId") Long combinationId);
|
||||
|
||||
@Select("SELECT c.id,c.effective_time as effectiveTime,c.image,c.people,c.price," +
|
||||
@Select("SELECT c.id,c.effective_time as effectiveTime,c.image,c.people,c.price, s.sales as sales," +
|
||||
"c.title,c.unit_name as unitName,s.price as productPrice FROM yx_store_combination c " +
|
||||
"INNER JOIN yx_store_product s ON s.id=c.product_id " +
|
||||
" WHERE c.is_show = 1 AND c.is_del = 0 AND c.start_time < now() " +
|
||||
@ -42,7 +42,7 @@ public interface YxStoreCombinationMapper extends CoreMapper<YxStoreCombination>
|
||||
List<YxStoreCombinationQueryVo> getCombList(Page page);
|
||||
|
||||
@Select("SELECT c.id,c.effective_time as effectiveTime,c.image,c.people,c.price,c.browse," +
|
||||
"c.description,c.image,c.images,c.info,c.is_postage as isPostage,c.postage," +
|
||||
"c.description,c.image,c.images,c.info," +
|
||||
"c.product_id as productId,c.sales,c.start_time as startTime" +
|
||||
",c.stock,c.stop_time stopTime," +
|
||||
"c.title,c.unit_name as unitName,s.price as productPrice FROM yx_store_combination c " +
|
||||
@ -51,7 +51,7 @@ public interface YxStoreCombinationMapper extends CoreMapper<YxStoreCombination>
|
||||
YxStoreCombinationQueryVo getCombDetail(Long id);
|
||||
|
||||
@Select("SELECT c.id,c.image,c.price,c.title as storeName,c.is_show as isShow,c.cost," +
|
||||
"c.is_postage as isPostage,c.postage,c.sales,c.stock,c.is_del as isDel" +
|
||||
"c.sales,c.stock,c.is_del as isDel" +
|
||||
" FROM yx_store_combination c " +
|
||||
" WHERE c.id = #{id} and c.is_del = 0 ")
|
||||
YxStoreProductQueryVo combinatiionInfo(Long id);
|
||||
|
@ -139,13 +139,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
yxStoreProductAttrService.decProductAttrStock(num,productId,unique, type);
|
||||
}
|
||||
int res = 0;
|
||||
if("combination".equals(type)){
|
||||
res = storeProductMapper.decCombinationStockIncSales(num,productId,activityId);
|
||||
}else if("seckill".equals(type)){
|
||||
res = storeProductMapper.decSeckillStockIncSales(num,productId,activityId);
|
||||
}else {
|
||||
|
||||
res = storeProductMapper.decStockIncSales(num,productId);
|
||||
}
|
||||
|
||||
if(res == 0) {
|
||||
throw new YshopException("商品库存不足");
|
||||
|
@ -36,11 +36,11 @@ public interface StoreProductAttrValueMapper extends CoreMapper<YxStoreProductAt
|
||||
int incStockDecSales(@Param("num") int num,@Param("productId") Long productId,
|
||||
@Param("unique") String unique);
|
||||
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, pink_stock=pink_stock-#{num} sales=sales+#{num}" +
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, pink_stock=pink_stock-#{num} ,sales=sales+#{num}" +
|
||||
" where product_id=#{productId} and `unique`=#{unique} and stock >= #{num} and pink_stock>=#{num}")
|
||||
int decCombinationStockIncSales(int num, Long productId, String unique);
|
||||
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, seckill_stock=seckill_stock-#{num} sales=sales+#{num}" +
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, seckill_stock=seckill_stock-#{num},sales=sales+#{num}" +
|
||||
" where product_id=#{productId} and `unique`=#{unique} and stock >= #{num} and seckill_stock>=#{num}")
|
||||
int decSeckillStockIncSales(int num, Long productId, String unique);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
|
||||
@Update("update yx_store_combination set stock=stock-#{num}, sales=sales+#{num}" +
|
||||
" where id=#{activityId} and stock >= #{num}")
|
||||
int decCombinationStockIncSales(int num, Long productId,Long activityId);
|
||||
//todo 拼团商品库存+—
|
||||
//todo 秒杀商品库存+—
|
||||
@Update("update yx_store_seckill set stock=stock-#{num}, sales=sales+#{num}" +
|
||||
" where id=#{activityId} and stock >= #{num}")
|
||||
int decSeckillStockIncSales(int num, Long productId,Long activityId);
|
||||
|
Reference in New Issue
Block a user