package com.sw.mes.yb.production.dao;

import com.sw.mes.yb.production.entity.CrystalBatchOperation;
import com.sw.mes.core.base.BaseDao;
import org.springframework.data.jpa.repository.Query;

/**
* @Author
* @Description：
* @Date:
* @Modified By:
*/
public interface CrystalBatchOperationDao extends BaseDao<CrystalBatchOperation, Long> {

    @Query(value = "SELECT * FROM crystal_batch_operation WHERE crystal_no = ?1 AND status =?2 ORDER BY id DESC limit 1",nativeQuery = true)
    CrystalBatchOperation findByCrystalNoAndStatus(String crystalNo,Integer status);

    @Query(value = "SELECT * FROM crystal_batch_operation WHERE section_no = ?1 AND status =?2 ORDER BY id DESC limit 1",nativeQuery = true)
    CrystalBatchOperation findBySectionNoAndStatus(String sectionNo,Integer status);

    @Query(value = "SELECT * FROM crystal_batch_operation WHERE section_no = ?1  ORDER BY id DESC limit 1",nativeQuery = true)
    CrystalBatchOperation findBySectionNo(String sectionNo);
}