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

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

/**
 * @Author
 * @Description：
 * @Date:
 * @Modified By:
 */
public interface CarrierConfigDao extends BaseDao<CarrierConfig, Integer> {

    @Query(value = "SELECT * FROM carrier_config WHERE type =?1 AND is_deleted = 0 order by create_time desc limit 1 ", nativeQuery = true)
    CarrierConfig findByTypeDesc(Integer type);

    @Query(value = "SELECT * FROM carrier_config WHERE carrier_no =?1  limit 1 ", nativeQuery = true)
    CarrierConfig checkCarrierNo(String carrierNo);

    @Query(value = "SELECT * FROM carrier_config WHERE is_deleted = 0 AND status = 0 AND carrier_no =?1  limit 1 ", nativeQuery = true)
    CarrierConfig checkStatusCarrierNo(String carrierNo);

    @Query(value = "SELECT * FROM carrier_config WHERE is_deleted = 0 AND carrier_no =?1  limit 1 ", nativeQuery = true)
    CarrierConfig findCarrierInfoBoxNo(String carrierNo);
}