package cn.ysk.cashier.cons.repository;

import cn.ysk.cashier.cons.domain.TbProskuCon;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

/**
* @website https://eladmin.vip
* @author admin
* @date 2024-06-22
**/
public interface TbProskuConRepository extends JpaRepository<TbProskuCon, Integer>, JpaSpecificationExecutor<TbProskuCon> {


    @Query(value = "select count(0) from tb_prosku_con where con_info_id=?1 and product_sku_id=?2 and shop_id=?3 and product_id=?4",nativeQuery = true)
    int countByConInfoIdAndProductSkuIdAndShopId(Integer conInfoId,Integer productSkuId,Integer shopId,Integer productId);





    @Query(value = "select * from tb_prosku_con where con_info_id=?1 and product_sku_id=?2 and shop_id=?3 and product_id=?4",nativeQuery = true)
    TbProskuCon selectByConInfoIdAndProductSkuIdAndShopId(Integer conInfoId,Integer productSkuId,Integer shopId,Integer productId);


}