1.下架无法查询到导致报错问题修复

This commit is contained in:
SongZhang 2024-08-09 10:23:57 +08:00
parent 8e1aa5bc19
commit 220c717085
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package cn.ysk.cashier.repository.product;
import cn.ysk.cashier.pojo.product.TbProduct;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
@ -56,7 +57,7 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
@Query("update TbProduct set stockNumber=stockNumber+:num where id=:id")
void incrStock(@Param("id") Integer id, @Param("num") Integer num);
@Query("select product from TbProduct product where product.id=:id and product.shopId=:shopId")
@Query("select product from TbProduct product where product.id=:id and product.shopId=:shopId and product.isDel=0")
TbProduct selectByShopIdAndId(Integer id, String shopId);
@Query("select product from TbProduct product where product.shopId=:shopId")
@ -64,4 +65,5 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
@Query(value = "select b.* from tb_product_sku as a left join tb_product as b on a.product_id=b.id where a.id=:skuId", nativeQuery = true)
TbProduct selectBySkuId(@Param("skuId") Integer skuId);
}