<?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.BzscYsjglggzscfjMapper">

    <resultMap type="BzscYsjglggzscfj" id="BzscYsjglggzscfjResult">
        <result property="id"    column="id"    />
        <result property="deptId"    column="dept_id"    />
        <result property="nd"    column="nd"    />
        <result property="fjmc"    column="fjmc"    />
        <result property="fjdz"    column="fjdz"    />
        <result property="dl"    column="dl"    />
        <result property="zl"    column="zl"    />
        <result property="fjlx"    column="fjlx"    />
        <result property="rdpx"    column="rdpx"    />
        <result property="lrr"    column="lrr"    />
        <result property="lrsj"    column="lrsj"    />
        <result property="xgr"    column="xgr"    />
        <result property="xgsj"    column="xgsj"    />
        <result property="bz"    column="bz"    />
        <result property="yl2"    column="yl2"    />
        <result property="yl3"    column="yl3"    />
        <result property="yl4"    column="yl4"    />
        <result property="yl5"    column="yl5"    />
    </resultMap>

    <sql id="selectBzscYsjglggzscfjVo">
        select id, dept_id, nd, fjmc, fjdz, dl, zl, fjlx, rdpx, lrr, lrsj, xgr, xgsj, bz, yl2, yl3, yl4, yl5 from bzsc_ysjglggzscfj
    </sql>

    <select id="selectBzscYsjglggzscfjList" parameterType="BzscYsjglggzscfj" resultMap="BzscYsjglggzscfjResult">
        <include refid="selectBzscYsjglggzscfjVo"/>
        <where>
            <if test="deptId != null  and deptId != ''"> and dept_id = #{deptId}</if>
            <if test="nd != null  and nd != ''"> and nd = #{nd}</if>
            <if test="fjmc != null  and fjmc != ''"> and fjmc = #{fjmc}</if>
            <if test="fjdz != null  and fjdz != ''"> and fjdz = #{fjdz}</if>
            <if test="dl != null  and dl != ''"> and dl = #{dl}</if>
            <if test="zl != null  and zl != ''"> and zl = #{zl}</if>
            <if test="fjlx != null  and fjlx != ''"> and fjlx = #{fjlx}</if>
            <if test="rdpx != null  and rdpx != ''"> and rdpx = #{rdpx}</if>
            <if test="lrr != null  and lrr != ''"> and lrr = #{lrr}</if>
            <if test="lrsj != null "> and lrsj = #{lrsj}</if>
            <if test="xgr != null  and xgr != ''"> and xgr = #{xgr}</if>
            <if test="xgsj != null "> and xgsj = #{xgsj}</if>
            <if test="bz != null  and bz != ''"> and bz = #{bz}</if>
            <if test="yl2 != null  and yl2 != ''"> and yl2 = #{yl2}</if>
            <if test="yl3 != null  and yl3 != ''"> and yl3 = #{yl3}</if>
            <if test="yl4 != null  and yl4 != ''"> and yl4 = #{yl4}</if>
            <if test="yl5 != null  and yl5 != ''"> and yl5 = #{yl5}</if>
        </where>
    </select>

    <select id="selectBzscYsjglggzscfjById" parameterType="Long" resultMap="BzscYsjglggzscfjResult">
        <include refid="selectBzscYsjglggzscfjVo"/>
        where id = #{id}
    </select>

    <insert id="insertBzscYsjglggzscfjlist">
        insert into bzsc_ysjglggzscfj(dept_id, nd, fjmc, fjdz, dl, zl, fjlx, rdpx, lrr, lrsj, xgr, xgsj, bz, yl2, yl3, yl4, yl5 ) values
        <foreach item="item" index="index" collection="list" separator=",">
            ( #{item.deptId}, #{item.nd}, #{item.fjmc}, #{item.fjdz}, #{item.dl}, #{item.zl}, #{item.fjlx}, #{item.rdpx}, #{item.lrr}, #{item.lrsj}, #{item.xgr}, #{item.xgsj}, #{item.bz}, #{item.yl2}, #{item.yl3}, #{item.yl4}, #{item.yl5})
        </foreach>
    </insert>

    <insert id="insertBzscYsjglggzscfj" parameterType="BzscYsjglggzscfj" useGeneratedKeys="true" keyProperty="id">
        insert into bzsc_ysjglggzscfj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deptId != null">dept_id,</if>
            <if test="nd != null">nd,</if>
            <if test="fjmc != null">fjmc,</if>
            <if test="fjdz != null">fjdz,</if>
            <if test="dl != null">dl,</if>
            <if test="zl != null">zl,</if>
            <if test="fjlx != null">fjlx,</if>
            <if test="rdpx != null">rdpx,</if>
            <if test="lrr != null">lrr,</if>
            <if test="lrsj != null">lrsj,</if>
            <if test="xgr != null">xgr,</if>
            <if test="xgsj != null">xgsj,</if>
            <if test="bz != null">bz,</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="deptId != null">#{deptId},</if>
            <if test="nd != null">#{nd},</if>
            <if test="fjmc != null">#{fjmc},</if>
            <if test="fjdz != null">#{fjdz},</if>
            <if test="dl != null">#{dl},</if>
            <if test="zl != null">#{zl},</if>
            <if test="fjlx != null">#{fjlx},</if>
            <if test="rdpx != null">#{rdpx},</if>
            <if test="lrr != null">#{lrr},</if>
            <if test="lrsj != null">#{lrsj},</if>
            <if test="xgr != null">#{xgr},</if>
            <if test="xgsj != null">#{xgsj},</if>
            <if test="bz != null">#{bz},</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="updateBzscYsjglggzscfj" parameterType="BzscYsjglggzscfj">
        update bzsc_ysjglggzscfj
        <trim prefix="SET" suffixOverrides=",">
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="nd != null">nd = #{nd},</if>
            <if test="fjmc != null">fjmc = #{fjmc},</if>
            <if test="fjdz != null">fjdz = #{fjdz},</if>
            <if test="dl != null">dl = #{dl},</if>
            <if test="zl != null">zl = #{zl},</if>
            <if test="fjlx != null">fjlx = #{fjlx},</if>
            <if test="rdpx != null">rdpx = #{rdpx},</if>
            <if test="lrr != null">lrr = #{lrr},</if>
            <if test="lrsj != null">lrsj = #{lrsj},</if>
            <if test="xgr != null">xgr = #{xgr},</if>
            <if test="xgsj != null">xgsj = #{xgsj},</if>
            <if test="bz != null">bz = #{bz},</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="deleteBzscYsjglggzscfjById" parameterType="Long">
        delete from bzsc_ysjglggzscfj where id = #{id}
    </delete>

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