<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.muyu.mapper.WarnStrategyMapper">
    <select id="selectWarnStrategyList" resultType="com.muyu.domain.resp.WarnStrategyResp">
        SELECT *,
               car_type.type_name,
               t_template.template_name
        FROM `warn_strategy`
                 LEFT JOIN car_type ON warn_strategy.car_type_id=car_type.id
                 LEFT JOIN t_template ON warn_strategy.template_id=t_template.template_id
        <where>
            <if test="carTypeId!=null and carTypeId!=''">
                car_type.id=#{carTypeId}
            </if>
        <if test="strategyName!=null and strategyName!=''">
           and warn_strategy.strategy_name=#{strategyName}
        </if>
        <if test="templateId!=null and templateId!=''">
           and t_template.template_id=#{templateId}
        </if>
        </where>
    </select>
    <select id="selectListByCarType" resultType="com.muyu.domain.resp.WarnStrategyResp">
        SELECT *,
               car_type.type_name,
               t_template.template_name
        FROM `warn_strategy`
                 LEFT JOIN car_type ON warn_strategy.car_type_id=car_type.id
                 LEFT JOIN t_template ON warn_strategy.template_id=t_template.template_id
        where warn_strategy.car_type_id=#{carTypeId}
    </select>
</mapper>
