严智鑫
2025-11-13 945bc394f40d8af1072a53da9a94f24207124e6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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();
}