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);
|
|
}
|