package com.northglass.repository;
|
|
import java.util.List;
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.Query;
|
|
import com.northglass.constants.StateConstants.RawPackageTxtState;
|
import com.northglass.entity.RawPackageTxt;
|
public interface RawPackageTxtDao extends JpaRepository<RawPackageTxt, Long>{
|
|
//根据txt查询对应的任务
|
@Query("select max(t.id) from RawPackageTxt t")
|
public Long maxTxtNameid();
|
|
//根据txt查询对应的任务
|
@Query("select t from RawPackageTxt t where t.txt_name= ?1")
|
public RawPackageTxt findByTxtName(String txt_name);
|
|
//根据状态查找对应的任务
|
@Query("select t from RawPackageTxt t where t.status=?1")
|
public List<RawPackageTxt> findByStatus(String status);
|
|
|
//查找所有已下发的任务和所有异常中断的任务
|
@Query("select t from RawPackageTxt t where t.status= '"+RawPackageTxtState.SENDED+"' or t.status= '"+RawPackageTxtState.INTERRUPT+"'")
|
public List<RawPackageTxt> findSendedTasks();
|
|
//查找所有已下发的任务和所有异常中断的任务
|
@Query("select t from RawPackageTxt t where (t.status= '"+RawPackageTxtState.SENDED+"' or t.status= '"+RawPackageTxtState.INTERRUPT+"') and t.groups=?1 ORDER BY t.status,t.id")
|
public List<RawPackageTxt> findSendedTasks1(String group);
|
|
//查找所有已下发的任务和所有异常中断的任务
|
@Query("select t from RawPackageTxt t where t.status= '"+RawPackageTxtState.SENDED+"' order by createTime asc")
|
public List<RawPackageTxt> findTasks();
|
|
//查找所有已下发的任务和所有异常中断的任务
|
@Query("select t from RawPackageTxt t where t.status= '"+RawPackageTxtState.INTERRUPT+"'")
|
public List<RawPackageTxt> findInterruptTasks();
|
|
@Query("select t from RawPackageTxt t where t.status= '"+RawPackageTxtState.WAIT_ASSIGNE+"'")
|
public List<RawPackageTxt> findWaitingAssignedTasks();
|
|
//根据领取的任务id查找rawpackagetxt
|
@Query("select t from RawPackageTxt t where t.id=?1")
|
public List<RawPackageTxt> findById(int txtid);
|
|
//找到对应产线的状态为已领取的对象
|
@Query("select t from RawPackageTxt t where t.status = '"+RawPackageTxtState.HAVE_ACCEPT+"' and t.groups=?1")
|
public RawPackageTxt findAcceptedByGroup(String group);
|
|
//找到对应产线的状态为已领取的对象
|
@Query("select t from RawPackageTxt t where t.status = '"+RawPackageTxtState.CUT_FINISH+"' and t.groups=?1")
|
public RawPackageTxt findCutFinishByGroup(String group);
|
|
//找到对应产线的状态为已领取的对象
|
@Query("select t from RawPackageTxt t where t.status = '"+RawPackageTxtState.WORKING+"' and t.groups=?1")
|
public RawPackageTxt findByWorking(String group);
|
|
//找到对应产线的状态为已领取的对象
|
@Query("select t from RawPackageTxt t where t.status = '"+RawPackageTxtState.WORKING+"' or t.status = '"+RawPackageTxtState.HAVE_ACCEPT+"'")
|
public List<RawPackageTxt> findByAcceptAndWorking();
|
}
|