<?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.flossom.common.core.mapper.SysFiringInfoMapper">

    <resultMap type="SysFiringInfo" id="SysFiringInfoResult">
        <result property="id"    column="id"    />
        <result property="title"    column="title"    />
        <result property="content"    column="content"    />
        <result property="fileUrl"    column="file_url"    />
        <result property="filePath"    column="file_path"    />
        <result property="fileSuffix"    column="file_suffix"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="type"    column="type"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
    </resultMap>

    <sql id="selectSysFiringInfoVo">
        select id, title,content,file_url, file_path, file_suffix, del_flag, type, create_time, create_by from sys_firing_info
    </sql>

    <select id="selectSysFiringInfoList" parameterType="SysFiringInfo" resultMap="SysFiringInfoResult">
        <include refid="selectSysFiringInfoVo"/>
        <where>
            <if test="filePath != null  and filePath != ''"> and file_path = #{filePath}</if>
            <if test="fileSuffix != null  and fileSuffix != ''"> and file_suffix = #{fileSuffix}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="delFlag != null  and delFlag != ''"> and del_flag = #{delFlag}</if>

        </where>
    </select>

    <select id="selectSysFiringInfoById" parameterType="Long" resultMap="SysFiringInfoResult">
        <include refid="selectSysFiringInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertSysFiringInfo" parameterType="SysFiringInfo" useGeneratedKeys="true" keyProperty="id">
        insert into sys_firing_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="title != null">title,</if>
            <if test="content != null">content,</if>
            <if test="filePath != null">file_path,</if>
            <if test="fileUrl != null">file_url,</if>
            <if test="fileSuffix != null">file_suffix,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="type != null">type,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="title != null">#{title},</if>
            <if test="content != null">#{content},</if>
            <if test="filePath != null">#{filePath},</if>
            <if test="fileUrl != null">#{fileUrl},</if>
            <if test="fileSuffix != null">#{fileSuffix},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="type != null">#{type},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>

    <update id="updateSysFiringInfo" parameterType="SysFiringInfo">
        update sys_firing_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="title != null">title = #{title},</if>
            <if test="content != null">content = #{content},</if>
            <if test="fileUrl != null">file_url = #{fileUrl},</if>
            <if test="filePath != null">file_path = #{filePath},</if>
            <if test="fileSuffix != null">file_suffix = #{fileSuffix},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="type != null">type = #{type},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysFiringInfoById" parameterType="Long">
        delete from sys_firing_info where id = #{id}
    </delete>

    <delete id="deleteSysFiringInfoByIds" parameterType="String">
        delete from sys_firing_info where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
