package com.sw.mes.issue.dao;


import com.sw.mes.core.base.BaseDao;
import com.sw.mes.issue.entity.YbIssueDetial;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

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

    @Query(value = "select yid.crystal_no as crystalNo \n" +
            "from yb_issue_detial yid  \n" +
            "LEFT JOIN plan_processing_order ppo ON yid.crystal_no = ppo.code\n" +
            "where \n" +
            "yid.crystal_no=?1\n" +
            "and ppo.`status`=5 limit 1", nativeQuery = true)
    String findByCrystalNoAndIssueId(String crystalNo);

    List<YbIssueDetial> findByIssueId(Long id);


    @Query(value = "select * from yb_issue_detial where crystal_no=?1", nativeQuery = true)
    YbIssueDetial findByIssueIdByCrystalNo(String crystalNo);
}
