package com.sw.mes.inspect.dao;

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.inspect.entity.YbOemData;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

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


    @Query(value = "SELECT * FROM `yb_oem_data` WHERE section_no = ?1 ORDER BY id DESC LIMIT 2", nativeQuery = true)
    List<YbOemData> findBySectionNo(String sectionNo);

    @Modifying
    @Transactional
    @Query(value = "UPDATE yb_oem_data SET `status`=?2 WHERE id =?1 ", nativeQuery = true)
    void UpdateState(long id, int status);


}
