<?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.yifu.cloud.plus.v1.business.mapper.system.TBusWarningMapper">
    <resultMap id="tBusWarningMap" type="com.yifu.cloud.plus.v1.business.entity.system.TBusWarning">
        <id property="id" column="id"/>
        <result property="type" column="type"/>
        <result property="remindType" column="remind_type"/>
        <result property="remindTemplate" column="remind_template"/>
        <result property="sendMethod" column="send_method"/>
        <result property="remindRules" column="remind_rules"/>
        <result property="remindObject" column="remind_object"/>
        <result property="modelCode" column="model_code"/>
        <result property="signName" column="sign_name"/>
        <result property="sendDate" column="send_date"/>
        <result property="remark" column="remark"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.id,
              a.type,
              a.remind_type,
              a.remind_template,
              a.send_method,
              a.remind_rules,
              a.remind_object,
              a.model_code,
              a.sign_name,
              a.send_date,
              a.remark
         </sql>
    <sql id="tBusWarning_where">
        <if test="tBusWarning != null">
            <if test="tBusWarning.id != null and tBusWarning.id.trim() != ''">
                AND a.id = #{tBusWarning.id}
            </if>
            <if test="tBusWarning.type != null">
                AND a.type = #{tBusWarning.type}
            </if>
            <if test="tBusWarning.remindType != null">
                AND a.remind_type = #{tBusWarning.remindType}
            </if>
            <if test="tBusWarning.remindTemplate != null and tBusWarning.remindTemplate.trim() != ''">
                AND a.remind_template = #{tBusWarning.remindTemplate}
            </if>
            <if test="tBusWarning.sendMethod != null">
                AND a.send_method = #{tBusWarning.sendMethod}
            </if>
            <if test="tBusWarning.remindRules != null">
                AND a.remind_rules = #{tBusWarning.remindRules}
            </if>
            <if test="tBusWarning.remindObject != null and tBusWarning.remindObject.trim() != ''">
                AND a.remind_object = #{tBusWarning.remindObject}
            </if>
        </if>
    </sql>
    <!--tBusWarning简单分页查询-->
    <select id="getTBusWarningPage" resultMap="tBusWarningMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_bus_warning a
        <where>
            1=1
            <include refid="tBusWarning_where"/>
        </where>
    </select>

    <!--自动发送短信的list-->
    <select id="getListByAutoSend" resultMap="tBusWarningMap">
        SELECT
            <include refid="Base_Column_List"/>
        FROM t_bus_warning a
        where a.type = 0 and a.send_method = 0
    </select>

    <!--系统消息的list-->
    <select id="getListBySystem" resultMap="tBusWarningMap">
        SELECT
            <include refid="Base_Column_List"/>
        FROM t_bus_warning a
        where a.type = 1
    </select>
</mapper>
