<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//oos.juyouhx.com//DTD Mapper 3.0//EN" "http://oss.juyouhx.com/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.scpyun.platform.standard.jilinsscgsdp.JlEventOverdueWarningConfigDao">

    <sql id="columns">
        a.yellow_warn_days as 'yellowWarnDays' ,
        a.red_warn_days as 'redWarnDays' ,
        a.risk_type as 'riskType' ,
        a.create_by as 'createBy' ,
        a.create_time as 'createTime' ,
        a.update_by as 'updateBy' ,
        a.update_time as 'updateTime' ,
        a.del_flag as 'delFlag' ,
        a.id as 'id'
    </sql>


    <select id="findList" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.JlEventOverdueWarningConfigEntity"
            resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.JlEventOverdueWarningConfigEntity">
        select
        <include refid="columns"/>
        from
        jl_event_overdue_warning_config a
        <where>
            1=1
        </where>
    </select>

    <select id="getOne" parameterType="String"
            resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.JlEventOverdueWarningConfigEntity">
        select
        <include refid="columns"/>
        from
        jl_event_overdue_warning_config a
        <where>
            id=#{id}
        </where>
    </select>

    <insert id="insert">
        insert into jl_event_overdue_warning_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            id,
            <if test="yellowWarnDays != null">
                yellow_warn_days,
            </if>
            <if test="redWarnDays != null">
                red_warn_days,
            </if>
            <if test="riskType != null">
                risk_type,
            </if>
            <if test="createBy != null">
                create_by,
            </if>
            create_time
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            REPLACE(UUID(),'-',''),
            <if test="yellowWarnDays != null">
                #{yellowWarnDays},
            </if>
            <if test="redWarnDays != null">
                #{redWarnDays},
            </if>
            <if test="riskType != null">
                #{riskType},
            </if>
            <if test="createBy != null">
                #{createBy},
            </if>
            now()
        </trim>
    </insert>

    <delete id="delete">
        delete from jl_event_overdue_warning_config
        where id=#{id}
    </delete>
</mapper>
