严智鑫
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.RawPackageTxtState;
import com.northglass.entity.OptPattern;
import com.northglass.entity.ShelfRank;
 
 
public interface OptPatternDao extends JpaRepository<OptPattern, Long> {
    
    @Query("select p from OptPattern p where p.optId like ?1%")
    public List<OptPattern> findOptPatternByNumberPrefix(String numberPrefix);
    
    @Query("select p from OptPattern p where p.batch=?1")
    public List<OptPattern> findOptPatternByBatchNumber(String apartId);
    
    @Query("select p from OptPattern p where p.batch=?1 and p.state is null")
    public List<OptPattern> findOptPatternByBatchNumberAndState(String apartId);
    
    @Query("select p from OptPattern p where p.groups=?1")
    public List<OptPattern> findOptPatternByGroups(String groups);
    
//    //查找正在工作的任务
//    @Query("select p from OptPattern p where p.batch=?1 and p.status=''")
//    public List<OptPattern> findOptPattern(String groups);
    
    //根据领取的任务id查找属于当前TXT下的所有pattern
    @Query("select t from OptPattern t where t.rawPackageTxt.id=?1")
    public List<OptPattern> findById(Long raw_package_txt_id);
    
    @Query(nativeQuery=true,value="select * from gmms_opt_pattern where raw_package_txt_id=?1")
    public List<OptPattern> findById2(Long raw_package_txt_id);
    
    //找到第一个状态为已下发的TXT下的所有pattern
    @Query("select m from OptPattern m where m.rawPackageTxt.id = (select min(id) from RawPackageTxt t where t.status='"+RawPackageTxtState.SENDED+"')")
    public List<OptPattern> findFirstTxtPattern();
 
    @Query("select p from OptPattern p where p.batch=?1 and p.width=?2 and p.height=?2")
    public List<OptPattern> findbylength(String optname, double width, double height);
    
    @Query(nativeQuery=true,value="select * from gmms_opt_pattern where raw_package_txt_id=321")
    public List<OptPattern> qaz();
    
    @Query("select p from OptPattern p where p.batch=?1")
    public List<OptPattern> qaz1(String optname);
}