严智鑫
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
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.entity.CuttingOptPattern;
 
 
public interface CuttingOptPatternDao extends JpaRepository<CuttingOptPattern, Long>{
    
    //1号线待切割的任务
    @Query("select t from CuttingOptPattern t where t.state= '待切割' and t.groups='1'")
    public List<CuttingOptPattern> findByState();
    
    //1号线待切割或者待开始的任务
    @Query("select t from CuttingOptPattern t where (t.state= '待切割' or t.state='待开始') and t.groups='1'")
    public List<CuttingOptPattern> findTask();
    
    
    //找到1号线最大id的对象的文件名(领取的最新任务)
    @Query("select m from CuttingOptPattern m where m.txt_name =(select t.txt_name from CuttingOptPattern t where t.id =(select max(id) from CuttingOptPattern p where 1=1))")
    public List<CuttingOptPattern> findNewTasks();
    
    //找到1号线领取的最新任务处于待开始任务的状态
    @Query("select m from CuttingOptPattern m where m.txt_name =(select t.txt_name from CuttingOptPattern t where t.id =(select max(id) from CuttingOptPattern p where 1=1)) and m.state='待开始'")
    public List<CuttingOptPattern> findWaitTasks();
        
}