<?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.zg.project.Inventory.Visualization.mapper.PlnMapper">
    
    <resultMap type="Pln" id="PlnResult">
        <result property="id"    column="id"    />
        <result property="gcdm"    column="gcdm"    />
        <result property="gcms"    column="gcms"    />
        <result property="zbpc"    column="zbpc"    />
        <result property="zbpcmc"    column="zbpcmc"    />
        <result property="sxrq"    column="sxrq"    />
        <result property="qdrq"    column="qdrq"    />
        <result property="htbh"    column="htbh"    />
        <result property="gyjhbh"    column="gyjhbh"    />
        <result property="gcbh"    column="gcbh"    />
        <result property="xmms"    column="xmms"    />
        <result property="gysbm"    column="gysbm"    />
        <result property="gysmc"    column="gysmc"    />
        <result property="cgddh"    column="cgddh"    />
        <result property="hxmh"    column="hxmh"    />
        <result property="htjhq"    column="htjhq"    />
        <result property="qdjhq"    column="qdjhq"    />
        <result property="sjjhq"    column="sjjhq"    />
        <result property="wlh"    column="wlh"    />
        <result property="wlms"    column="wlms"    />
        <result property="jldw"    column="jldw"    />
        <result property="htsl"    column="htsl"    />
        <result property="jhjhsl"    column="jhjhsl"    />
        <result property="jhjhpc"    column="jhjhpc"    />
        <result property="jhjhje"    column="jhjhje"    />
        <result property="sjjhsl"    column="sjjhsl"    />
        <result property="gyjhzt"    column="gyjhzt"    />
        <result property="cgpzlx"    column="cgpzlx"    />
        <result property="jhjhrq"    column="jhjhrq"    />
        <result property="jhdd"    column="jhdd"    />
        <result property="jhlxr"    column="jhlxr"    />
        <result property="lxfs"    column="lxfs"    />
        <result property="ecp"    column="ecp"    />
        <result property="xmdw"    column="xmdw"    />
        <result property="odr"    column="odr"    />
        <result property="rcde"    column="rcde"    />
        <result property="cgpz"    column="cgpz"    />
        <result property="yrk"    column="yrk"    />
        <result property="yck"    column="yck"    />
        <result property="ste"    column="ste"    />
        <result property="tem"    column="tem"    />
        <result property="intme"    column="intme"    />
        <result property="updtme"    column="updtme"    />
        <result property="rAmt"    column="r_amt"    />
        <result property="cAmt"    column="c_amt"    />
        <result property="crtim"    column="crtim"    />
    </resultMap>

    <sql id="selectPlnVo">
        select id, gcdm, gcms, zbpc, zbpcmc, sxrq, qdrq, htbh, gyjhbh, gcbh, xmms, gysbm, gysmc, cgddh, hxmh, htjhq, qdjhq, sjjhq, wlh, wlms, jldw, htsl, jhjhsl, jhjhpc, jhjhje, sjjhsl, gyjhzt, cgpzlx, jhjhrq, jhdd, jhlxr, lxfs, ecp, xmdw, odr, rcde, cgpz, yrk, yck, ste, tem, intme, updtme, r_amt, c_amt, crtim from pln
    </sql>

    <select id="selectPlnList" parameterType="Pln" resultMap="PlnResult">
        <include refid="selectPlnVo"/>
        <where>  
            <if test="gcdm != null  and gcdm != ''"> and gcdm = #{gcdm}</if>
            <if test="gcms != null  and gcms != ''"> and gcms = #{gcms}</if>
            <if test="zbpc != null  and zbpc != ''"> and zbpc = #{zbpc}</if>
            <if test="zbpcmc != null  and zbpcmc != ''"> and zbpcmc = #{zbpcmc}</if>
            <if test="sxrq != null  and sxrq != ''"> and sxrq = #{sxrq}</if>
            <if test="qdrq != null  and qdrq != ''"> and qdrq = #{qdrq}</if>
            <if test="htbh != null  and htbh != ''"> and htbh = #{htbh}</if>
            <if test="gyjhbh != null  and gyjhbh != ''"> and gyjhbh = #{gyjhbh}</if>
            <if test="gcbh != null  and gcbh != ''"> and gcbh = #{gcbh}</if>
            <if test="xmms != null  and xmms != ''"> and xmms = #{xmms}</if>
            <if test="gysbm != null  and gysbm != ''"> and gysbm = #{gysbm}</if>
            <if test="gysmc != null  and gysmc != ''"> and gysmc = #{gysmc}</if>
            <if test="cgddh != null  and cgddh != ''"> and cgddh = #{cgddh}</if>
            <if test="hxmh != null  and hxmh != ''"> and hxmh = #{hxmh}</if>
            <if test="htjhq != null  and htjhq != ''"> and htjhq = #{htjhq}</if>
            <if test="qdjhq != null  and qdjhq != ''"> and qdjhq = #{qdjhq}</if>
            <if test="sjjhq != null  and sjjhq != ''"> and sjjhq = #{sjjhq}</if>
            <if test="wlh != null  and wlh != ''"> and wlh = #{wlh}</if>
            <if test="wlms != null  and wlms != ''"> and wlms = #{wlms}</if>
            <if test="jldw != null  and jldw != ''"> and jldw = #{jldw}</if>
            <if test="htsl != null  and htsl != ''"> and htsl = #{htsl}</if>
            <if test="jhjhsl != null  and jhjhsl != ''"> and jhjhsl = #{jhjhsl}</if>
            <if test="jhjhpc != null  and jhjhpc != ''"> and jhjhpc = #{jhjhpc}</if>
            <if test="jhjhje != null  and jhjhje != ''"> and jhjhje = #{jhjhje}</if>
            <if test="sjjhsl != null  and sjjhsl != ''"> and sjjhsl = #{sjjhsl}</if>
            <if test="gyjhzt != null  and gyjhzt != ''"> and gyjhzt = #{gyjhzt}</if>
            <if test="cgpzlx != null  and cgpzlx != ''"> and cgpzlx = #{cgpzlx}</if>
            <if test="jhjhrq != null  and jhjhrq != ''"> and jhjhrq = #{jhjhrq}</if>
            <if test="jhdd != null  and jhdd != ''"> and jhdd = #{jhdd}</if>
            <if test="jhlxr != null  and jhlxr != ''"> and jhlxr = #{jhlxr}</if>
            <if test="lxfs != null  and lxfs != ''"> and lxfs = #{lxfs}</if>
            <if test="ecp != null  and ecp != ''"> and ecp = #{ecp}</if>
            <if test="xmdw != null  and xmdw != ''"> and xmdw = #{xmdw}</if>
            <if test="odr != null "> and odr = #{odr}</if>
            <if test="rcde != null  and rcde != ''"> and rcde = #{rcde}</if>
            <if test="cgpz != null  and cgpz != ''"> and cgpz = #{cgpz}</if>
            <if test="yrk != null "> and yrk = #{yrk}</if>
            <if test="yck != null "> and yck = #{yck}</if>
            <if test="ste != null "> and ste = #{ste}</if>
            <if test="tem != null  and tem != ''"> and tem = #{tem}</if>
            <if test="intme != null  and intme != ''"> and intme = #{intme}</if>
            <if test="updtme != null  and updtme != ''"> and updtme = #{updtme}</if>
            <if test="rAmt != null "> and r_amt = #{rAmt}</if>
            <if test="cAmt != null "> and c_amt = #{cAmt}</if>
            <if test="crtim != null  and crtim != ''"> and crtim = #{crtim}</if>
        </where>
    </select>
    
    <select id="selectPlnById" parameterType="Long" resultMap="PlnResult">
        <include refid="selectPlnVo"/>
        where id = #{id}
    </select>
    <select id="getAll" resultType="com.zg.project.Inventory.Visualization.domain.Pln">
        select * from pln
    </select>

    <insert id="insertPln" parameterType="Pln" useGeneratedKeys="true" keyProperty="id">
        insert into pln
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="gcdm != null">gcdm,</if>
            <if test="gcms != null">gcms,</if>
            <if test="zbpc != null">zbpc,</if>
            <if test="zbpcmc != null">zbpcmc,</if>
            <if test="sxrq != null">sxrq,</if>
            <if test="qdrq != null">qdrq,</if>
            <if test="htbh != null">htbh,</if>
            <if test="gyjhbh != null">gyjhbh,</if>
            <if test="gcbh != null">gcbh,</if>
            <if test="xmms != null">xmms,</if>
            <if test="gysbm != null">gysbm,</if>
            <if test="gysmc != null">gysmc,</if>
            <if test="cgddh != null">cgddh,</if>
            <if test="hxmh != null">hxmh,</if>
            <if test="htjhq != null">htjhq,</if>
            <if test="qdjhq != null">qdjhq,</if>
            <if test="sjjhq != null">sjjhq,</if>
            <if test="wlh != null">wlh,</if>
            <if test="wlms != null">wlms,</if>
            <if test="jldw != null">jldw,</if>
            <if test="htsl != null">htsl,</if>
            <if test="jhjhsl != null">jhjhsl,</if>
            <if test="jhjhpc != null">jhjhpc,</if>
            <if test="jhjhje != null">jhjhje,</if>
            <if test="sjjhsl != null">sjjhsl,</if>
            <if test="gyjhzt != null">gyjhzt,</if>
            <if test="cgpzlx != null">cgpzlx,</if>
            <if test="jhjhrq != null">jhjhrq,</if>
            <if test="jhdd != null">jhdd,</if>
            <if test="jhlxr != null">jhlxr,</if>
            <if test="lxfs != null">lxfs,</if>
            <if test="ecp != null">ecp,</if>
            <if test="xmdw != null">xmdw,</if>
            <if test="odr != null">odr,</if>
            <if test="rcde != null">rcde,</if>
            <if test="cgpz != null">cgpz,</if>
            <if test="yrk != null">yrk,</if>
            <if test="yck != null">yck,</if>
            <if test="ste != null">ste,</if>
            <if test="tem != null">tem,</if>
            <if test="intme != null">intme,</if>
            <if test="updtme != null">updtme,</if>
            <if test="rAmt != null">r_amt,</if>
            <if test="cAmt != null">c_amt,</if>
            <if test="crtim != null">crtim,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="gcdm != null">#{gcdm},</if>
            <if test="gcms != null">#{gcms},</if>
            <if test="zbpc != null">#{zbpc},</if>
            <if test="zbpcmc != null">#{zbpcmc},</if>
            <if test="sxrq != null">#{sxrq},</if>
            <if test="qdrq != null">#{qdrq},</if>
            <if test="htbh != null">#{htbh},</if>
            <if test="gyjhbh != null">#{gyjhbh},</if>
            <if test="gcbh != null">#{gcbh},</if>
            <if test="xmms != null">#{xmms},</if>
            <if test="gysbm != null">#{gysbm},</if>
            <if test="gysmc != null">#{gysmc},</if>
            <if test="cgddh != null">#{cgddh},</if>
            <if test="hxmh != null">#{hxmh},</if>
            <if test="htjhq != null">#{htjhq},</if>
            <if test="qdjhq != null">#{qdjhq},</if>
            <if test="sjjhq != null">#{sjjhq},</if>
            <if test="wlh != null">#{wlh},</if>
            <if test="wlms != null">#{wlms},</if>
            <if test="jldw != null">#{jldw},</if>
            <if test="htsl != null">#{htsl},</if>
            <if test="jhjhsl != null">#{jhjhsl},</if>
            <if test="jhjhpc != null">#{jhjhpc},</if>
            <if test="jhjhje != null">#{jhjhje},</if>
            <if test="sjjhsl != null">#{sjjhsl},</if>
            <if test="gyjhzt != null">#{gyjhzt},</if>
            <if test="cgpzlx != null">#{cgpzlx},</if>
            <if test="jhjhrq != null">#{jhjhrq},</if>
            <if test="jhdd != null">#{jhdd},</if>
            <if test="jhlxr != null">#{jhlxr},</if>
            <if test="lxfs != null">#{lxfs},</if>
            <if test="ecp != null">#{ecp},</if>
            <if test="xmdw != null">#{xmdw},</if>
            <if test="odr != null">#{odr},</if>
            <if test="rcde != null">#{rcde},</if>
            <if test="cgpz != null">#{cgpz},</if>
            <if test="yrk != null">#{yrk},</if>
            <if test="yck != null">#{yck},</if>
            <if test="ste != null">#{ste},</if>
            <if test="tem != null">#{tem},</if>
            <if test="intme != null">#{intme},</if>
            <if test="updtme != null">#{updtme},</if>
            <if test="rAmt != null">#{rAmt},</if>
            <if test="cAmt != null">#{cAmt},</if>
            <if test="crtim != null">#{crtim},</if>
         </trim>
    </insert>

    <update id="updatePln" parameterType="Pln">
        update pln
        <trim prefix="SET" suffixOverrides=",">
            <if test="gcdm != null">gcdm = #{gcdm},</if>
            <if test="gcms != null">gcms = #{gcms},</if>
            <if test="zbpc != null">zbpc = #{zbpc},</if>
            <if test="zbpcmc != null">zbpcmc = #{zbpcmc},</if>
            <if test="sxrq != null">sxrq = #{sxrq},</if>
            <if test="qdrq != null">qdrq = #{qdrq},</if>
            <if test="htbh != null">htbh = #{htbh},</if>
            <if test="gyjhbh != null">gyjhbh = #{gyjhbh},</if>
            <if test="gcbh != null">gcbh = #{gcbh},</if>
            <if test="xmms != null">xmms = #{xmms},</if>
            <if test="gysbm != null">gysbm = #{gysbm},</if>
            <if test="gysmc != null">gysmc = #{gysmc},</if>
            <if test="cgddh != null">cgddh = #{cgddh},</if>
            <if test="hxmh != null">hxmh = #{hxmh},</if>
            <if test="htjhq != null">htjhq = #{htjhq},</if>
            <if test="qdjhq != null">qdjhq = #{qdjhq},</if>
            <if test="sjjhq != null">sjjhq = #{sjjhq},</if>
            <if test="wlh != null">wlh = #{wlh},</if>
            <if test="wlms != null">wlms = #{wlms},</if>
            <if test="jldw != null">jldw = #{jldw},</if>
            <if test="htsl != null">htsl = #{htsl},</if>
            <if test="jhjhsl != null">jhjhsl = #{jhjhsl},</if>
            <if test="jhjhpc != null">jhjhpc = #{jhjhpc},</if>
            <if test="jhjhje != null">jhjhje = #{jhjhje},</if>
            <if test="sjjhsl != null">sjjhsl = #{sjjhsl},</if>
            <if test="gyjhzt != null">gyjhzt = #{gyjhzt},</if>
            <if test="cgpzlx != null">cgpzlx = #{cgpzlx},</if>
            <if test="jhjhrq != null">jhjhrq = #{jhjhrq},</if>
            <if test="jhdd != null">jhdd = #{jhdd},</if>
            <if test="jhlxr != null">jhlxr = #{jhlxr},</if>
            <if test="lxfs != null">lxfs = #{lxfs},</if>
            <if test="ecp != null">ecp = #{ecp},</if>
            <if test="xmdw != null">xmdw = #{xmdw},</if>
            <if test="odr != null">odr = #{odr},</if>
            <if test="rcde != null">rcde = #{rcde},</if>
            <if test="cgpz != null">cgpz = #{cgpz},</if>
            <if test="yrk != null">yrk = #{yrk},</if>
            <if test="yck != null">yck = #{yck},</if>
            <if test="ste != null">ste = #{ste},</if>
            <if test="tem != null">tem = #{tem},</if>
            <if test="intme != null">intme = #{intme},</if>
            <if test="updtme != null">updtme = #{updtme},</if>
            <if test="rAmt != null">r_amt = #{rAmt},</if>
            <if test="cAmt != null">c_amt = #{cAmt},</if>
            <if test="crtim != null">crtim = #{crtim},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlnById" parameterType="Long">
        delete from pln where id = #{id}
    </delete>

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