购物车只查询当天购物车,规格增加销量

This commit is contained in:
19991905653 2024-04-01 16:18:27 +08:00
parent bebbd8c3c3
commit 03a447d95b
6 changed files with 16 additions and 5 deletions

View File

@ -30,7 +30,7 @@ public interface TbCashierCartMapper {
TbCashierCart selectByDetail(@Param("masterId") String masterId, @Param("productId") String productId,
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("day") String day,@Param("uuid") String uuid);
List<TbCashierCart> selectByMaskerId(@Param("masterId")String masterId, @Param("shopId")Integer shopId,@Param("status") String status);
List<TbCashierCart> selectByMaskerId(@Param("masterId")String masterId, @Param("shopId")Integer shopId,@Param("status") String status,@Param("day") String day);
void deleteByCartId(@Param("masterId") String masterId, @Param("cartId")Integer cartId);

View File

@ -27,4 +27,6 @@ public interface TbProductSkuMapper {
TbProductSkuWithBLOBs selectByShopIdAndProductIdAndSpec(@Param("shopId") String shopId, @Param("productId") String productId, @Param("spec") String spec);
TbProductSkuWithBLOBs selectByProduct(@Param("productId") Integer productId);
void updateByskuId(@Param("productSkuId") Integer productSkuId,@Param("num") Integer num);
}

View File

@ -40,6 +40,8 @@ public class DutyService {
private TbShopInfoMapper shopInfoMapper;
@Autowired
private ShopUserDutyPayMapper shopUserDutyPayMapper;
@Autowired
private TbProductSkuMapper productSkuMapper;
@Transactional(rollbackFor = Exception.class)
public void exect(String message) {
try {
@ -88,6 +90,7 @@ public class DutyService {
shopUserDutyDetail.setProductId(orderDetail.getProductId());
shopUserDutyDetail.setProductName(orderDetail.getProductName());
detaiList.add(shopUserDutyDetail);
productSkuMapper.updateByskuId(orderDetail.getProductSkuId(),orderDetail.getNum());
}
if (detaiList.size() > 0) {
shopUserDutyDetailMapper.batchInsert(detaiList);
@ -127,6 +130,7 @@ public class DutyService {
detaiList.add(shopUserDutyDetail);
}
productSkuMapper.updateByskuId(orderDetail.getProductSkuId(),orderDetail.getNum());
}
if (detaiList.size() > 0) {
shopUserDutyDetailMapper.batchInsert(detaiList);
@ -195,6 +199,7 @@ public class DutyService {
shopUserDutyDetail.setProductId(orderDetail.getProductId());
shopUserDutyDetail.setProductName(orderDetail.getProductName());
detaiList.add(shopUserDutyDetail);
productSkuMapper.updateByskuId(orderDetail.getProductSkuId(),orderDetail.getNum());
}
if (detaiList.size() > 0) {
shopUserDutyDetailMapper.batchInsert(detaiList);
@ -234,6 +239,7 @@ public class DutyService {
detaiList.add(shopUserDutyDetail);
}
productSkuMapper.updateByskuId(orderDetail.getProductSkuId(),orderDetail.getNum());
}
if (detaiList.size() > 0) {

View File

@ -185,9 +185,9 @@ public class OrderService {
return Result.fail(CodeEnum.SHOPINFONOEXIST);
}
String day = DateUtils.getDay();
List<TbCashierCart> list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create");
List<TbCashierCart> list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create",day);
if (list.size() < 1){
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId), "refund");
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId), "refund",day);
if (list.size() > 0){
if (list.size() < 1) {
return Result.fail(CodeEnum.CARTJH);

View File

@ -61,7 +61,7 @@
</select>
<select id="selectByMaskerId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
select *
from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId} and status = #{status} order by id desc
from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId} and status = #{status} and trade_day = #{day} order by id desc
</select>
<select id="selectCartList" resultType="com.chaozhanggui.system.cashierservice.entity.po.CartPo">
select shop_Id as shopId,master_id as masterId,uuid,

View File

@ -333,8 +333,11 @@
updated_at = #{updatedAt,jdbcType=BIGINT}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByskuId">
update tb_product_sku set real_sales_number = real_sales_number + #{num} where id = #{productSkuId}
</update>
<select id="selectByShopIdAndProductIdAndSpec" resultMap="ResultMapWithBLOBs">
<select id="selectByShopIdAndProductIdAndSpec" resultMap="ResultMapWithBLOBs">
select * from tb_product_sku where shop_id=#{shopId} and product_id=#{productId}
<if test="spec != null and spec !=''">