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

    <resultMap type="JygxCljwh" id="JygxCljwhResult">
        <result property="cljid"    column="cljid"    />
        <result property="px"    column="px"    />
        <result property="mcbt"    column="mcbt"    />
        <result property="lj"    column="lj"    />
        <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"    />
        <result property="tzfs"    column="tzfs"    />
        <result property="fbzt"    column="fbzt"    />
        <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"    />
    </resultMap>

    <sql id="selectJygxCljwhVo">
        select cljid, px, mcbt, lj, yl1, yl2, yl3, yl4, yl5, tzfs, fbzt, create_by, create_time, update_by, update_time, remark from jygx_cljwh
    </sql>

    <select id="selectJygxCljwhList" parameterType="JygxCljwh" resultMap="JygxCljwhResult">
        <include refid="selectJygxCljwhVo"/>
        <where>
            <if test="px != null "> and px = #{px}</if>
            <if test="mcbt != null  and mcbt != ''"> and mcbt = #{mcbt}</if>
            <if test="lj != null  and lj != ''"> and lj = #{lj}</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>
            <if test="tzfs != null  and tzfs != ''"> and tzfs = #{tzfs}</if>
            <if test="fbzt != null  and fbzt != ''"> and fbzt = #{fbzt}</if>
        </where>
        ORDER BY ifnull (px,999999) asc
    </select>

    <select id="selectJygxCljwhByCljid" parameterType="Long" resultMap="JygxCljwhResult">
        <include refid="selectJygxCljwhVo"/>
        where cljid = #{cljid}
    </select>

    <insert id="insertJygxCljwh" parameterType="JygxCljwh" useGeneratedKeys="true" keyProperty="cljid">
        insert into jygx_cljwh
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="px != null">px,</if>
            <if test="mcbt != null">mcbt,</if>
            <if test="lj != null">lj,</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>
            <if test="tzfs != null">tzfs,</if>
            <if test="fbzt != null">fbzt,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="px != null">#{px},</if>
            <if test="mcbt != null">#{mcbt},</if>
            <if test="lj != null">#{lj},</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>
            <if test="tzfs != null">#{tzfs},</if>
            <if test="fbzt != null">#{fbzt},</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>
         </trim>
    </insert>

    <update id="updateJygxCljwh" parameterType="JygxCljwh">
        update jygx_cljwh
        <trim prefix="SET" suffixOverrides=",">
            <if test="px != null">px = #{px},</if>
            <if test="mcbt != null">mcbt = #{mcbt},</if>
            <if test="lj != null">lj = #{lj},</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>
            <if test="tzfs != null">tzfs = #{tzfs},</if>
            <if test="fbzt != null">fbzt = #{fbzt},</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>
        </trim>
        where cljid = #{cljid}
    </update>

    <delete id="deleteJygxCljwhByCljid" parameterType="Long">
        delete from jygx_cljwh where cljid = #{cljid}
    </delete>

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