<?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.qianhe.mapper.SjGfjsLbzdbfMapper">
    
    <resultMap type="SjGfjsLbzdbf" id="SjGfjsLbzdbfResult">
        <result property="id"    column="id"    />
        <result property="bfzmc"    column="bfzmc"    />
        <result property="lxr"    column="lxr"    />
        <result property="lxrname"    column="lxrname"    />
        <result property="nd"    column="nd"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="yl1"    column="yl1"    />
        <result property="yl2"    column="yl2"    />
        <result property="yl3"    column="yl3"    />
        <result property="yl4"    column="yl4"    />
        <result property="yl5"    column="yl5"    />
    </resultMap>

    <sql id="selectSjGfjsLbzdbfVo">
        select a.id, a.bfzmc, a.lxr, a.nd, s.nick_name lxrname,
         a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.yl1, a.yl2, a.yl3, a.yl4, a.yl5
        from sj_gfjs_lbzdbf a
		left join sys_user s on a.lxr = s.user_id
    </sql>

    <select id="selectSjGfjsLbzdbfList" parameterType="SjGfjsLbzdbf" resultMap="SjGfjsLbzdbfResult">
        <include refid="selectSjGfjsLbzdbfVo"/>
        <where>  
            <if test="bfzmc != null  and bfzmc != ''"> and a.bfzmc = #{bfzmc}</if>
            <if test="lxr != null "> and a.lxr = #{lxr}</if>
            <if test="nd != null  and nd != ''"> and a.nd = #{nd}</if>
            <if test="yl1 != null  and yl1 != ''"> and a.yl1 = #{yl1}</if>
            <if test="yl2 != null  and yl2 != ''"> and a.yl2 = #{yl2}</if>
            <if test="yl3 != null  and yl3 != ''"> and a.yl3 = #{yl3}</if>
            <if test="yl4 != null  and yl4 != ''"> and a.yl4 = #{yl4}</if>
            <if test="yl5 != null  and yl5 != ''"> and a.yl5 = #{yl5}</if>
        </where>
    </select>
    
    <select id="selectSjGfjsLbzdbfById" parameterType="Long" resultMap="SjGfjsLbzdbfResult">
        <include refid="selectSjGfjsLbzdbfVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSjGfjsLbzdbf" parameterType="SjGfjsLbzdbf" useGeneratedKeys="true" keyProperty="id">
        insert into sj_gfjs_lbzdbf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="bfzmc != null">bfzmc,</if>
            <if test="lxr != null">lxr,</if>
            <if test="nd != null">nd,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="yl1 != null">yl1,</if>
            <if test="yl2 != null">yl2,</if>
            <if test="yl3 != null">yl3,</if>
            <if test="yl4 != null">yl4,</if>
            <if test="yl5 != null">yl5,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="bfzmc != null">#{bfzmc},</if>
            <if test="lxr != null">#{lxr},</if>
            <if test="nd != null">#{nd},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="yl1 != null">#{yl1},</if>
            <if test="yl2 != null">#{yl2},</if>
            <if test="yl3 != null">#{yl3},</if>
            <if test="yl4 != null">#{yl4},</if>
            <if test="yl5 != null">#{yl5},</if>
         </trim>
    </insert>

    <update id="updateSjGfjsLbzdbf" parameterType="SjGfjsLbzdbf">
        update sj_gfjs_lbzdbf
        <trim prefix="SET" suffixOverrides=",">
            <if test="bfzmc != null">bfzmc = #{bfzmc},</if>
            <if test="lxr != null">lxr = #{lxr},</if>
            <if test="nd != null">nd = #{nd},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="yl1 != null">yl1 = #{yl1},</if>
            <if test="yl2 != null">yl2 = #{yl2},</if>
            <if test="yl3 != null">yl3 = #{yl3},</if>
            <if test="yl4 != null">yl4 = #{yl4},</if>
            <if test="yl5 != null">yl5 = #{yl5},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjGfjsLbzdbfById" parameterType="Long">
        delete from sj_gfjs_lbzdbf where id = #{id}
    </delete>

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