<?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.SjZqfxMapper">
    
    <resultMap type="SjZqfx" id="SjZqfxResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="ljjh"    column="ljjh"    />
        <result property="jtm"    column="jtm"    />
        <result property="ksjs"    column="ksjs"    />
        <result property="js"    column="js"    />
        <result property="kc"    column="kc"    />
        <result property="jc"    column="jc"    />
        <result property="cw"    column="cw"    />
        <result property="zjzq"    column="zjzq"    />
        <result property="zjycsl"    column="zjycsl"    />
        <result property="zjsczq"    column="zjsczq"    />
        <result property="zjsl"    column="zjsl"    />
        <result property="zwzq"    column="zwzq"    />
        <result property="wjycsl"    column="wjycsl"    />
        <result property="wjsczq"    column="wjsczq"    />
        <result property="zjycms"    column="zjycms"    />
        <result property="wjycms"    column="wjycms"    />
    </resultMap>

    <sql id="selectSjZqfxVo">
        select id, jh, ljjh, jtm, ksjs, js, kc, jc, cw, zjzq, zjycsl, zjsczq, zjsl, zwzq, wjycsl, wjsczq, zjycms, wjycms from sj_zqfx
    </sql>

    <select id="selectSjZqfxList" parameterType="SjZqfx" resultMap="SjZqfxResult">
        <include refid="selectSjZqfxVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="ljjh != null  and ljjh != ''"> and ljjh = #{ljjh}</if>
            <if test="jtm != null  and jtm != ''"> and jtm = #{jtm}</if>
            <if test="ksjs != null "> and ksjs = #{ksjs}</if>
            <if test="js != null "> and js = #{js}</if>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="jc != null "> and jc = #{jc}</if>
            <if test="cw != null  and cw != ''"> and cw = #{cw}</if>
            <if test="zjzq != null "> and zjzq = #{zjzq}</if>
            <if test="zjycsl != null "> and zjycsl = #{zjycsl}</if>
            <if test="zjsczq != null "> and zjsczq = #{zjsczq}</if>
            <if test="zjsl != null "> and zjsl = #{zjsl}</if>
            <if test="zwzq != null "> and zwzq = #{zwzq}</if>
            <if test="wjycsl != null "> and wjycsl = #{wjycsl}</if>
            <if test="wjsczq != null "> and wjsczq = #{wjsczq}</if>
            <if test="zjycms != null  and zjycms != ''"> and zjycms = #{zjycms}</if>
            <if test="wjycms != null  and wjycms != ''"> and wjycms = #{wjycms}</if>
        </where>
    </select>
    
    <select id="selectSjZqfxById" parameterType="Long" resultMap="SjZqfxResult">
        <include refid="selectSjZqfxVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjZqfx" parameterType="SjZqfx" useGeneratedKeys="true" keyProperty="id">
        insert into sj_zqfx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="ljjh != null">ljjh,</if>
            <if test="jtm != null">jtm,</if>
            <if test="ksjs != null">ksjs,</if>
            <if test="js != null">js,</if>
            <if test="kc != null">kc,</if>
            <if test="jc != null">jc,</if>
            <if test="cw != null">cw,</if>
            <if test="zjzq != null">zjzq,</if>
            <if test="zjycsl != null">zjycsl,</if>
            <if test="zjsczq != null">zjsczq,</if>
            <if test="zjsl != null">zjsl,</if>
            <if test="zwzq != null">zwzq,</if>
            <if test="wjycsl != null">wjycsl,</if>
            <if test="wjsczq != null">wjsczq,</if>
            <if test="zjycms != null">zjycms,</if>
            <if test="wjycms != null">wjycms,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="ljjh != null">#{ljjh},</if>
            <if test="jtm != null">#{jtm},</if>
            <if test="ksjs != null">#{ksjs},</if>
            <if test="js != null">#{js},</if>
            <if test="kc != null">#{kc},</if>
            <if test="jc != null">#{jc},</if>
            <if test="cw != null">#{cw},</if>
            <if test="zjzq != null">#{zjzq},</if>
            <if test="zjycsl != null">#{zjycsl},</if>
            <if test="zjsczq != null">#{zjsczq},</if>
            <if test="zjsl != null">#{zjsl},</if>
            <if test="zwzq != null">#{zwzq},</if>
            <if test="wjycsl != null">#{wjycsl},</if>
            <if test="wjsczq != null">#{wjsczq},</if>
            <if test="zjycms != null">#{zjycms},</if>
            <if test="wjycms != null">#{wjycms},</if>
         </trim>
    </insert>
    <insert id="insertSjZqfxBatch">

        INSERT INTO sj_zqfx
        (
        jh, ljjh, jtm, ksjs, js, kc, jc, cw,
        zjzq, zjycsl, zjsczq, zjsl, zwzq,
        wjycsl, wjsczq, zjycms, wjycms
        )
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.ljjh},
            #{item.jtm},
            #{item.ksjs},
            #{item.js},
            #{item.kc},
            #{item.jc},
            #{item.cw},
            #{item.zjzq},
            #{item.zjycsl},
            #{item.zjsczq},
            #{item.zjsl},
            #{item.zwzq},
            #{item.wjycsl},
            #{item.wjsczq},
            #{item.zjycms},
            #{item.wjycms}
            )
        </foreach>
    </insert>

    <update id="updateSjZqfx" parameterType="SjZqfx">
        update sj_zqfx
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="ljjh != null">ljjh = #{ljjh},</if>
            <if test="jtm != null">jtm = #{jtm},</if>
            <if test="ksjs != null">ksjs = #{ksjs},</if>
            <if test="js != null">js = #{js},</if>
            <if test="kc != null">kc = #{kc},</if>
            <if test="jc != null">jc = #{jc},</if>
            <if test="cw != null">cw = #{cw},</if>
            <if test="zjzq != null">zjzq = #{zjzq},</if>
            <if test="zjycsl != null">zjycsl = #{zjycsl},</if>
            <if test="zjsczq != null">zjsczq = #{zjsczq},</if>
            <if test="zjsl != null">zjsl = #{zjsl},</if>
            <if test="zwzq != null">zwzq = #{zwzq},</if>
            <if test="wjycsl != null">wjycsl = #{wjycsl},</if>
            <if test="wjsczq != null">wjsczq = #{wjsczq},</if>
            <if test="zjycms != null">zjycms = #{zjycms},</if>
            <if test="wjycms != null">wjycms = #{wjycms},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjZqfxById" parameterType="Long">
        delete from sj_zqfx where id = #{id}
    </delete>

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