package com.muyu.enterprise.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.muyu.domain.WarnStrategy;
import com.muyu.domain.resp.WarnRuleResp;
import com.muyu.domain.resp.WarnStrategyAndVinResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WarnStrategyMapper extends MPJBaseMapper<WarnStrategy> {


    @Select("SELECT vehicle.vehicle_vin, warn_strategy.warn_strategy_id, warn_strategy.vehicle_type_id, warn_strategy.message_template_id FROM vehicle LEFT JOIN warn_strategy ON vehicle.warn_strategy_id = warn_strategy.warn_strategy_id WHERE vehicle.warn_strategy_id = #{warn_strategy_id}")
    List<WarnStrategyAndVinResp> findById(Long vehicleId);

    /**
     * 查询列表（存Redis）
     * @param warnStrategyId
     * @return
     */
    @Select("select * from warn_strategy where warn_strategy_id = #{warn_strategy_id}")
    WarnRuleResp findByWarnStrategyId(Long warnStrategyId);


}
