<?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.WdWdxxMapper">
    
    <resultMap type="WdWdxx" id="WdWdxxResult">
        <result property="id"    column="id"    />
        <result property="glId"    column="gl_id"    />
        <result property="fjmc"    column="fjmc"    />
        <result property="fjdz"    column="fjdz"    />
        <result property="mkmc"    column="mkmc"    />
        <result property="fjlx"    column="fjlx"    />
        <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="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="selectWdWdxxVo">
        select id, gl_id, fjmc, fjdz, mkmc, fjlx, lrr, lrsj, xgr, xgsj, bz, yl1, yl2, yl3, yl4, yl5 from wd_wdxx
    </sql>

    <select id="selectWdWdxxList" parameterType="WdWdxx" resultMap="WdWdxxResult">
        <include refid="selectWdWdxxVo"/>
        <where>  
            <if test="glId != null  and glId != ''"> and gl_id = #{glId}</if>
            <if test="fjmc != null  and fjmc != ''"> and fjmc = #{fjmc}</if>
            <if test="fjdz != null  and fjdz != ''"> and fjdz = #{fjdz}</if>
            <if test="mkmc != null  and mkmc != ''"> and mkmc = #{mkmc}</if>
            <if test="fjlx != null  and fjlx != ''"> and fjlx = #{fjlx}</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="yl1 != null  and yl1 != ''"> and yl1 = #{yl1}</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="selectWdWdxxById" parameterType="Long" resultMap="WdWdxxResult">
        <include refid="selectWdWdxxVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertWdWdxx" parameterType="WdWdxx" useGeneratedKeys="true" keyProperty="id">
        insert into wd_wdxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="glId != null">gl_id,</if>
            <if test="fjmc != null">fjmc,</if>
            <if test="fjdz != null">fjdz,</if>
            <if test="mkmc != null">mkmc,</if>
            <if test="fjlx != null and fjlx != ''">fjlx,</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="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="glId != null">#{glId},</if>
            <if test="fjmc != null">#{fjmc},</if>
            <if test="fjdz != null">#{fjdz},</if>
            <if test="mkmc != null">#{mkmc},</if>
            <if test="fjlx != null and fjlx != ''">#{fjlx},</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="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="updateWdWdxx" parameterType="WdWdxx">
        update wd_wdxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="glId != null">gl_id = #{glId},</if>
            <if test="fjmc != null">fjmc = #{fjmc},</if>
            <if test="fjdz != null">fjdz = #{fjdz},</if>
            <if test="mkmc != null">mkmc = #{mkmc},</if>
            <if test="fjlx != null and fjlx != ''">fjlx = #{fjlx},</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="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="deleteWdWdxxById" parameterType="Long">
        delete from wd_wdxx where id = #{id}
    </delete>

    <delete id="deleteWdWdxxByIds" parameterType="String">
        delete from wd_wdxx where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="deleteWdWdxxByGlIdAndMkmc">
        delete from wd_wdxx where gl_id = #{id} and mkmc=#{mkmc}
    </delete>
</mapper>