package com.sw.mes.fb.aio.dao;

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.fb.aio.entity.AioCheckSectionState;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

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

    @Query(value = "SELECT * FROM zhxx_fb_aio_check_section_state WHERE section_no=?1 ", nativeQuery = true)
    List<AioCheckSectionState> findBySectionNo(String sectionNo);

//    @Query(value = "SELECT * FROM zhxx_fb_aio_check_section_state WHERE section_no IN (?1) limit 1 ", nativeQuery = true)
//    AioCheckSectionState findBySectionNoIn(List<String> sectionNos);
    @Query(value = "SELECT * FROM zhxx_fb_aio_check_section_state WHERE section_no IN (?1) order by create_time desc limit 1 ", nativeQuery = true)
    AioCheckSectionState findBySectionNoIn(List<String> sectionNos);

    @Query(value = "SELECT * FROM zhxx_fb_aio_check_section_state WHERE section_no_group LIKE concat('%',?1, '%') order by create_time desc", nativeQuery = true)
    List<AioCheckSectionState> findBySectionNoGroup(String sectionNo);

}
