严智鑫
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
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.CountMachineTaskState;
import com.northglass.entity.CountMachineTask;
 
public interface CountMachineTaskDao extends JpaRepository<CountMachineTask, Long> {
 
    @Query("select t from CountMachineTask t where t.state = '" + CountMachineTaskState.IN_WORK + "' and t.countMachine.id = ?1")
    public List<CountMachineTask> findInWorkTaskByCountMachine(Long countMachineId);
    
    @Query("select t from CountMachineTask t where t.state = '" + CountMachineTaskState.IN_WORK + "' and t.countMachine.id = ?1 and t.rank = ?2")
    public List<CountMachineTask> findInWorkTaskByCountMachineAndRank(Long countMachineId,String rank);
    
    @Query("select t from CountMachineTask t where t.state = '" + CountMachineTaskState.WAITING + "' and t.countMachine.id = ?1")
    public List<CountMachineTask> findWaitingTasksByCountMachine(Long countMachineId);
    
    @Query("select t from CountMachineTask t where t.state = '" + CountMachineTaskState.WARNING + "' and t.countMachine.id = ?1")
    public List<CountMachineTask> findWarningTasksByCountMachine(Long countMachineId);
    
    @Query("select t from CountMachineTask t where t.state = '" + CountMachineTaskState.COMPLETED + "' and t.countMachine.id = ?1")
    public List<CountMachineTask> findCompletedTasksByCountMachine(Long countMachineId);
    
    @Query("select t from CountMachineTask t where t.state = '" + CountMachineTaskState.COMPLETED + "' and t.countMachine.id = ?1 and t.apart=?2")
    public List<CountMachineTask> findCompletedTasksByCountMachineAndApartId(Long countMachineId,String apartId);
 
    @Query("select t from CountMachineTask t where t.countMachine.id = ?1 and t.apart=?2")
    public List<CountMachineTask> findTasksByCountMachineAndApartId(Long countMachineId,String apartId);
 
    @Query("select t from CountMachineTask t where t.countMachine.id = ?1")
    public List<CountMachineTask> findByCountMachine(Long countMachineId);
    
    @Query("select t from CountMachineTask t where t.state =?1")
    public List<CountMachineTask> findCompletedTasks(String state);
    
    @Query("select t from CountMachineTask t where (t.state = '" + CountMachineTaskState.IN_WORK + "' or t.state = '" + CountMachineTaskState.WAITING + "') and t.countMachine.id = ?1")
    public List<CountMachineTask> findInWorkTaskByid(Long countMachineId);
    
    //新版本使用
    //磨边后队列
    @Query("select t from CountMachineTask t where t.state = '" + CountMachineTaskState.IN_WORK + "' and t.countMachine.id = ?1")
    public List<CountMachineTask> findInworkTaskByid(Long countMachineId);
    
    @Query("select t from CountMachineTask t where t.rawPackageTxt.id = ?1")
    public List<CountMachineTask> findRawPackageTxtByid(Long countMachineId);
}