<?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.SjZsjqkMapper">
    
    <resultMap type="SjZsjqk" id="SjZsjqkResult">
        <result property="sjjh"    column="sjjh"    />
        <result property="jh"    column="jh"    />
        <result property="jhbm"    column="jhbm"    />
        <result property="zqlxmc"    column="zqlxmc"    />
        <result property="cwmc"    column="cwmc"    />
        <result property="sdfw"    column="sdfw"    />
        <result property="jkyl"    column="jkyl"    />
        <result property="dcyl"    column="dcyl"    />
        <result property="rzl"    column="rzl"    />
        <result property="ljzrl"    column="ljzrl"    />
        <result property="zrzt"    column="zrzt"    />
        <result property="jkjl"    column="jkjl"    />
        <result property="jdjl"    column="jdjl"    />
        <result property="sftz"    column="sftz"    />
    </resultMap>

    <sql id="selectSjZsjqkVo">
        select sjjh, jh, jhbm, zqlxmc, cwmc, sdfw, jkyl, dcyl, rzl, ljzrl, zrzt, jkjl, jdjl, sftz from sj_zsjqk
    </sql>

    <select id="selectSjZsjqkList" parameterType="SjZsjqk" resultMap="SjZsjqkResult">
        <include refid="selectSjZsjqkVo"/>
        <where>  
            <if test="sjjh != null  and sjjh != ''"> and sjjh = #{sjjh}</if>
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="jhbm != null  and jhbm != ''"> and jhbm = #{jhbm}</if>
            <if test="zqlxmc != null  and zqlxmc != ''"> and zqlxmc = #{zqlxmc}</if>
            <if test="cwmc != null  and cwmc != ''"> and cwmc = #{cwmc}</if>
            <if test="sdfw != null  and sdfw != ''"> and sdfw = #{sdfw}</if>
            <if test="jkyl != null "> and jkyl = #{jkyl}</if>
            <if test="dcyl != null "> and dcyl = #{dcyl}</if>
            <if test="rzl != null "> and rzl = #{rzl}</if>
            <if test="ljzrl != null "> and ljzrl = #{ljzrl}</if>
            <if test="zrzt != null  and zrzt != ''"> and zrzt = #{zrzt}</if>
            <if test="jkjl != null "> and jkjl = #{jkjl}</if>
            <if test="jdjl != null "> and jdjl = #{jdjl}</if>
            <if test="sftz != null  and sftz != ''"> and sftz = #{sftz}</if>
        </where>
    </select>
    
    <select id="selectSjZsjqkBySjjh" parameterType="String" resultMap="SjZsjqkResult">
        <include refid="selectSjZsjqkVo"/>
        where sjjh = #{sjjh}
    </select>

    <insert id="insertSjZsjqk" parameterType="SjZsjqk">
        insert into sj_zsjqk
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="sjjh != null">sjjh,</if>
            <if test="jh != null">jh,</if>
            <if test="jhbm != null">jhbm,</if>
            <if test="zqlxmc != null">zqlxmc,</if>
            <if test="cwmc != null">cwmc,</if>
            <if test="sdfw != null">sdfw,</if>
            <if test="jkyl != null">jkyl,</if>
            <if test="dcyl != null">dcyl,</if>
            <if test="rzl != null">rzl,</if>
            <if test="ljzrl != null">ljzrl,</if>
            <if test="zrzt != null">zrzt,</if>
            <if test="jkjl != null">jkjl,</if>
            <if test="jdjl != null">jdjl,</if>
            <if test="sftz != null">sftz,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sjjh != null">#{sjjh},</if>
            <if test="jh != null">#{jh},</if>
            <if test="jhbm != null">#{jhbm},</if>
            <if test="zqlxmc != null">#{zqlxmc},</if>
            <if test="cwmc != null">#{cwmc},</if>
            <if test="sdfw != null">#{sdfw},</if>
            <if test="jkyl != null">#{jkyl},</if>
            <if test="dcyl != null">#{dcyl},</if>
            <if test="rzl != null">#{rzl},</if>
            <if test="ljzrl != null">#{ljzrl},</if>
            <if test="zrzt != null">#{zrzt},</if>
            <if test="jkjl != null">#{jkjl},</if>
            <if test="jdjl != null">#{jdjl},</if>
            <if test="sftz != null">#{sftz},</if>
         </trim>
    </insert>
    <insert id="insertSjZsjqkBatch">
        INSERT INTO sj_zsjqk
        (
        sjjh, jh, jhbm, zqlxmc, cwmc, sdfw,
        jkyl, dcyl, rzl, ljzrl, zrzt,
        jkjl, jdjl, sftz
        )
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.sjjh},
            #{item.jh},
            #{item.jhbm},
            #{item.zqlxmc},
            #{item.cwmc},
            #{item.sdfw},
            #{item.jkyl},
            #{item.dcyl},
            #{item.rzl},
            #{item.ljzrl},
            #{item.zrzt},
            #{item.jkjl},
            #{item.jdjl},
            #{item.sftz}
            )
        </foreach>

    </insert>

    <update id="updateSjZsjqk" parameterType="SjZsjqk">
        update sj_zsjqk
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="jhbm != null">jhbm = #{jhbm},</if>
            <if test="zqlxmc != null">zqlxmc = #{zqlxmc},</if>
            <if test="cwmc != null">cwmc = #{cwmc},</if>
            <if test="sdfw != null">sdfw = #{sdfw},</if>
            <if test="jkyl != null">jkyl = #{jkyl},</if>
            <if test="dcyl != null">dcyl = #{dcyl},</if>
            <if test="rzl != null">rzl = #{rzl},</if>
            <if test="ljzrl != null">ljzrl = #{ljzrl},</if>
            <if test="zrzt != null">zrzt = #{zrzt},</if>
            <if test="jkjl != null">jkjl = #{jkjl},</if>
            <if test="jdjl != null">jdjl = #{jdjl},</if>
            <if test="sftz != null">sftz = #{sftz},</if>
        </trim>
        where sjjh = #{sjjh}
    </update>

    <delete id="deleteSjZsjqkBySjjh" parameterType="String">
        delete from sj_zsjqk where sjjh = #{sjjh}
    </delete>

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