严智鑫
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.northglass.repository;
 
import java.util.List;
 
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
 
import com.northglass.constants.StateConstants.GlassArrangeState;
import com.northglass.constants.StateConstants.GlassState;
import com.northglass.constants.StateConstants.sendGlassState;
import com.northglass.entity.Glass;
 
 
public interface GlassDao extends JpaRepository<Glass, Long> {
 
    @Query("select t from Glass t where t.state='" + GlassState.TO_IDENTIFY + "'")
    public List<Glass> findToIdentifyGlass();
    
    @Query("select t from Glass t where t.state='" + GlassState.TO_MEASURE +"'")
    public List<Glass> findToMeasureGlass();
 
    @Query("select t from Glass t where t.state='" + GlassState.TO_IDENTIFY +"' and t.groups=?1")
    public List<Glass> findToMeasureGlass1(String groups);
        
    @Query("select t from Glass t where t.manufacture_batch= ?1")
    public List<Glass> findByBatch(String batch);
 
    @Query("select t from Glass t where t.manufacture_batch= ?1 and (t.sendState='" +sendGlassState.NOTSEND +"' "
            + "or t.sendState='" +sendGlassState.SENDED+"')")
    public List<Glass> findNotRecieveGlassByBatch(String batch);
    
    @Query("select t from Glass t where t.manufacture_batch= ?1 and (t.sendStates='" +sendGlassState.NOTSEND +"' "
            + "or t.sendStates='" +sendGlassState.SENDED+"')")
    public List<Glass> findNotRecieveGlassTwoByBatch(String batch);
    
    @Query("select t from Glass t where t.manufacture_batch= ?1 and t.sendState='" +sendGlassState.NOTSEND +"' ")
    public List<Glass> findNotSendGlassByBatch(String batch);
    
    @Query("select t from Glass t where t.glassId= ?1")
       public List<Glass> findByglass(int glass_id);
    
    @Query("select t from Glass t where t.groups=?1")
    public List<Glass> findGlassBygroups(String groups);
    
    @Query("select t from Glass t where t.manufacture_batch=?1")
   public List<Glass> findGlassByManufactureBatch(String manufacture_batch);
    
    @Query("select t from Glass t where t.arrangeStatu= '"+GlassArrangeState.MEASURE +"' and t.apart_id=?1")
    public List<Glass> findGlassByApart_Id(String apart_id);
    
    @Query("select t from Glass t where t.apart_id=?1")
    public List<Glass> findGlassByApartId(String apart_id);
    
    @Query("select t from Glass t where t.state= '"+GlassState.TO_MEASURE +"'and t.apart_id=?1 and t.groups=?2")
    public List<Glass> findGlassByApart_IdAndGroups(String apart_id,String groups);
    
    @Query("select t from Glass t where t.arrangeStatu='" + GlassArrangeState.MEASURE + "'")
    public List<Glass> findGlass();
    
    @Query("select t from Glass t where t.apart_id=?1 and t.groups=?2")
    public List<Glass> findGlassByApart_Id(String apart_id,String groups);
    
    @Query("select t from Glass t where t.manufacture_batch= ?1 and t.sendState='" +sendGlassState.SENDED +"'")
    public List<Glass> findSendedGlassByBatch(String batch);
    
    @Query("select t from Glass t where t.manufacture_batch= ?1 and t.sendStates='" +sendGlassState.SENDED +"'")
       public List<Glass> findSendedGlassByBatchs(String batch);
    
    @Query("select t from Glass t where t.manufacture_batch= ?1 and t.glassId= ?2")
    public Glass findglassId(String batch,int glassid);
    
    @Query("select t from Glass t where t.manufacture_batch= ?1 and t.length= ?2 and t.width= ?3")
    public List<Glass> findGlassBylength(String batch,double length,double width);
    
    /*update语句*/
    @Modifying
 /*   @Transactional*/
    @Query("update Glass set complete_pieces = complete_pieces +1,flag =?1 + 1 where id = ?2 and flag = ?1")
      public int saveById(int flag,Long id);
    
    @Query("update Glass set complete_pieces = complete_pieces -1,flag =?1 + 1 where id = ?2 and flag = ?1")
      public int saveByIdcomplete(Long id);
    
    @Query("select t from Glass t where t.state= ?1")
       public List<Glass> findGlassByStatu(String statu);
 
    @Query("select t from Glass t where t.rawPackageTxt.id = ?1")
       public List<Glass> findByRaw(Long id);
    
    @Query("select t from Glass t where t.manufacture_batch= ?1 and t.state='" +GlassArrangeState.MEASURE +"'")
    public List<Glass> findGlassByBatchs(String batch); 
    
    @Query("select t from Glass t where t.rawPackageTxt.id = ?1 and t.state='" +GlassArrangeState.MEASURE +"'")
       public List<Glass> findByRawAndState(Long id);
       
}