<?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.ruoyi.project.zjsgfa.mapper.SjQkztfxMapper">
    
    <resultMap type="SjQkztfx" id="SjQkztfxResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="kc"    column="kc"    />
        <result property="ztxh"    column="ztxh"    />
        <result property="cj"    column="cj"    />
        <result property="cc"    column="cc"    />
        <result property="ztsl"    column="ztsl"    />
        <result property="ytzl"    column="ytzl"    />
        <result property="etzl"    column="etzl"    />
        <result property="stzl"    column="stzl"    />
        <result property="sitzl"    column="sitzl"    />
        <result property="wtzl"    column="wtzl"    />
        <result property="jcZw"    column="jc_zw"    />
        <result property="jcMax"    column="jc_max"    />
        <result property="jxzsZw"    column="jxzs_zw"    />
        <result property="jxzsMax"    column="jxzs_max"    />
        <result property="qsjsZw"    column="qsjs_zw"    />
    </resultMap>

    <sql id="selectSjQkztfxVo">
        select id, jh, kc, ztxh, cj, cc, ztsl, ytzl, etzl, stzl, sitzl, wtzl, jc_zw, jc_max, jxzs_zw, jxzs_max, qsjs_zw from sj_qkztfx
    </sql>

    <select id="selectSjQkztfxList" parameterType="SjQkztfx" resultMap="SjQkztfxResult">
        <include refid="selectSjQkztfxVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="ztxh != null  and ztxh != ''"> and ztxh = #{ztxh}</if>
            <if test="cj != null  and cj != ''"> and cj = #{cj}</if>
            <if test="cc != null "> and cc = #{cc}</if>
            <if test="ztsl != null "> and ztsl = #{ztsl}</if>
            <if test="ytzl != null "> and ytzl = #{ytzl}</if>
            <if test="etzl != null "> and etzl = #{etzl}</if>
            <if test="stzl != null "> and stzl = #{stzl}</if>
            <if test="sitzl != null "> and sitzl = #{sitzl}</if>
            <if test="wtzl != null "> and wtzl = #{wtzl}</if>
            <if test="jcZw != null "> and jc_zw = #{jcZw}</if>
            <if test="jcMax != null "> and jc_max = #{jcMax}</if>
            <if test="jxzsZw != null "> and jxzs_zw = #{jxzsZw}</if>
            <if test="jxzsMax != null "> and jxzs_max = #{jxzsMax}</if>
            <if test="qsjsZw != null "> and qsjs_zw = #{qsjsZw}</if>
        </where>
    </select>
    
    <select id="selectSjQkztfxById" parameterType="Long" resultMap="SjQkztfxResult">
        <include refid="selectSjQkztfxVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjQkztfx" parameterType="SjQkztfx" useGeneratedKeys="true" keyProperty="id">
        insert into sj_qkztfx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="kc != null">kc,</if>
            <if test="ztxh != null">ztxh,</if>
            <if test="cj != null">cj,</if>
            <if test="cc != null">cc,</if>
            <if test="ztsl != null">ztsl,</if>
            <if test="ytzl != null">ytzl,</if>
            <if test="etzl != null">etzl,</if>
            <if test="stzl != null">stzl,</if>
            <if test="sitzl != null">sitzl,</if>
            <if test="wtzl != null">wtzl,</if>
            <if test="jcZw != null">jc_zw,</if>
            <if test="jcMax != null">jc_max,</if>
            <if test="jxzsZw != null">jxzs_zw,</if>
            <if test="jxzsMax != null">jxzs_max,</if>
            <if test="qsjsZw != null">qsjs_zw,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="kc != null">#{kc},</if>
            <if test="ztxh != null">#{ztxh},</if>
            <if test="cj != null">#{cj},</if>
            <if test="cc != null">#{cc},</if>
            <if test="ztsl != null">#{ztsl},</if>
            <if test="ytzl != null">#{ytzl},</if>
            <if test="etzl != null">#{etzl},</if>
            <if test="stzl != null">#{stzl},</if>
            <if test="sitzl != null">#{sitzl},</if>
            <if test="wtzl != null">#{wtzl},</if>
            <if test="jcZw != null">#{jcZw},</if>
            <if test="jcMax != null">#{jcMax},</if>
            <if test="jxzsZw != null">#{jxzsZw},</if>
            <if test="jxzsMax != null">#{jxzsMax},</if>
            <if test="qsjsZw != null">#{qsjsZw},</if>
         </trim>
    </insert>
    <insert id="insertSjQkztfxBatch">
        INSERT INTO sj_qkztfx
        (
        jh, kc, ztxh, cj, cc, ztsl,
        ytzl, etzl, stzl, sitzl, wtzl,
        jc_zw, jc_max, jxzs_zw, jxzs_max, qsjs_zw
        )
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.kc},
            #{item.ztxh},
            #{item.cj},
            #{item.cc},
            #{item.ztsl},
            #{item.ytzl},
            #{item.etzl},
            #{item.stzl},
            #{item.sitzl},
            #{item.wtzl},
            #{item.jcZw},
            #{item.jcMax},
            #{item.jxzsZw},
            #{item.jxzsMax},
            #{item.qsjsZw}
            )
        </foreach>

    </insert>

    <update id="updateSjQkztfx" parameterType="SjQkztfx">
        update sj_qkztfx
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="kc != null">kc = #{kc},</if>
            <if test="ztxh != null">ztxh = #{ztxh},</if>
            <if test="cj != null">cj = #{cj},</if>
            <if test="cc != null">cc = #{cc},</if>
            <if test="ztsl != null">ztsl = #{ztsl},</if>
            <if test="ytzl != null">ytzl = #{ytzl},</if>
            <if test="etzl != null">etzl = #{etzl},</if>
            <if test="stzl != null">stzl = #{stzl},</if>
            <if test="sitzl != null">sitzl = #{sitzl},</if>
            <if test="wtzl != null">wtzl = #{wtzl},</if>
            <if test="jcZw != null">jc_zw = #{jcZw},</if>
            <if test="jcMax != null">jc_max = #{jcMax},</if>
            <if test="jxzsZw != null">jxzs_zw = #{jxzsZw},</if>
            <if test="jxzsMax != null">jxzs_max = #{jxzsMax},</if>
            <if test="qsjsZw != null">qsjs_zw = #{qsjsZw},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjQkztfxById" parameterType="Long">
        delete from sj_qkztfx where id = #{id}
    </delete>

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