package com.fzzy.api.view.repository; import com.fzzy.api.entity.Api1208; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; public interface Api1208Rep extends JpaRepository, JpaSpecificationExecutor { @Query("from Api1208 where kqdm=:kqdm and (czbz= 'i' or czbz = 'u') ") List findPushData(@Param("kqdm") String kqdm); @Transactional @Modifying @Query("update Api1208 set czbz =:czbz where id=:id") void updateStatus(@Param("id") String id, @Param("czbz") String czbz); @Query("from Api1208 where id=:id ") List getDataById(@Param("id") String id); @Query("from Api1208 where hwdm=:hwdm ") List getDataByHwdm(@Param("hwdm") String hwdm); @Query("from Api1208 where kqdm=:kqdm and zhgxsj >=:start and zhgxsj <:end order by zhgxsj ") List findPushDataByTime(@Param("kqdm") String kqdm, @Param("start") Date start, @Param("end") Date end); /** * 根据货位代码获取库存数据 * @param hwdm * @return */ @Query("from Api1208 where hwdm=:hwdm order by zhgxsj desc") List findDataByHwdm(@Param("hwdm") String hwdm); @Query("from Api1208 where hwdm=:hwdm and zhgxsj <=:end order by zhgxsj desc") List getDataOne(@Param("hwdm") String hwdm, @Param("end") Date end); }