<?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.SjZtgjsjMapper">
    
    <resultMap type="SjZtgjsj" id="SjZtgjsjResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="ljjh"    column="ljjh"    />
        <result property="kc"    column="kc"    />
        <result property="jd"    column="jd"    />
        <result property="ztcc"    column="ztcc"    />
        <result property="ztxh"    column="ztxh"    />
        <result property="pz"    column="pz"    />
        <result property="mxqk"    column="mxqk"    />
        <result property="qzyy"    column="qzyy"    />
        <result property="cw"    column="cw"    />
        <result property="zjymd"    column="zjymd"    />
        <result property="pl"    column="pl"    />
        <result property="lgby"    column="lgby"    />
        <result property="jc"    column="jc"    />
        <result property="jxzs"    column="jxzs"    />
        <result property="zb"    column="zb"    />
    </resultMap>

    <sql id="selectSjZtgjsjVo">
        select id, jh, ljjh, kc, jd, ztcc, ztxh, pz, mxqk, qzyy, cw, zjymd, pl, lgby, jc, jxzs, zb from sj_ztgjsj
    </sql>

    <select id="selectSjZtgjsjList" parameterType="SjZtgjsj" resultMap="SjZtgjsjResult">
        <include refid="selectSjZtgjsjVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="ljjh != null  and ljjh != ''"> and ljjh = #{ljjh}</if>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="jd != null  and jd != ''"> and jd = #{jd}</if>
            <if test="ztcc != null "> and ztcc = #{ztcc}</if>
            <if test="ztxh != null  and ztxh != ''"> and ztxh = #{ztxh}</if>
            <if test="pz != null  and pz != ''"> and pz = #{pz}</if>
            <if test="mxqk != null  and mxqk != ''"> and mxqk = #{mxqk}</if>
            <if test="qzyy != null  and qzyy != ''"> and qzyy = #{qzyy}</if>
            <if test="cw != null  and cw != ''"> and cw = #{cw}</if>
            <if test="zjymd != null "> and zjymd = #{zjymd}</if>
            <if test="pl != null "> and pl = #{pl}</if>
            <if test="lgby != null "> and lgby = #{lgby}</if>
            <if test="jc != null "> and jc = #{jc}</if>
            <if test="jxzs != null "> and jxzs = #{jxzs}</if>
            <if test="zb != null "> and zb = #{zb}</if>
        </where>
    </select>
    
    <select id="selectSjZtgjsjById" parameterType="Long" resultMap="SjZtgjsjResult">
        <include refid="selectSjZtgjsjVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjZtgjsj" parameterType="SjZtgjsj" useGeneratedKeys="true" keyProperty="id">
        insert into sj_ztgjsj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="ljjh != null">ljjh,</if>
            <if test="kc != null">kc,</if>
            <if test="jd != null">jd,</if>
            <if test="ztcc != null">ztcc,</if>
            <if test="ztxh != null">ztxh,</if>
            <if test="pz != null">pz,</if>
            <if test="mxqk != null">mxqk,</if>
            <if test="qzyy != null">qzyy,</if>
            <if test="cw != null">cw,</if>
            <if test="zjymd != null">zjymd,</if>
            <if test="pl != null">pl,</if>
            <if test="lgby != null">lgby,</if>
            <if test="jc != null">jc,</if>
            <if test="jxzs != null">jxzs,</if>
            <if test="zb != null">zb,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="ljjh != null">#{ljjh},</if>
            <if test="kc != null">#{kc},</if>
            <if test="jd != null">#{jd},</if>
            <if test="ztcc != null">#{ztcc},</if>
            <if test="ztxh != null">#{ztxh},</if>
            <if test="pz != null">#{pz},</if>
            <if test="mxqk != null">#{mxqk},</if>
            <if test="qzyy != null">#{qzyy},</if>
            <if test="cw != null">#{cw},</if>
            <if test="zjymd != null">#{zjymd},</if>
            <if test="pl != null">#{pl},</if>
            <if test="lgby != null">#{lgby},</if>
            <if test="jc != null">#{jc},</if>
            <if test="jxzs != null">#{jxzs},</if>
            <if test="zb != null">#{zb},</if>
         </trim>
    </insert>
    <insert id="insertSjZtgjsjBatch">

        INSERT INTO sj_ztgjsj
        (
        jh, ljjh, kc, jd, ztcc, ztxh, pz, mxqk,
        qzyy, cw, zjymd, pl, lgby, jc, jxzs, zb
        )
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.ljjh},
            #{item.kc},
            #{item.jd},
            #{item.ztcc},
            #{item.ztxh},
            #{item.pz},
            #{item.mxqk},
            #{item.qzyy},
            #{item.cw},
            #{item.zjymd},
            #{item.pl},
            #{item.lgby},
            #{item.jc},
            #{item.jxzs},
            #{item.zb}
            )
        </foreach>
    </insert>

    <update id="updateSjZtgjsj" parameterType="SjZtgjsj">
        update sj_ztgjsj
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="ljjh != null">ljjh = #{ljjh},</if>
            <if test="kc != null">kc = #{kc},</if>
            <if test="jd != null">jd = #{jd},</if>
            <if test="ztcc != null">ztcc = #{ztcc},</if>
            <if test="ztxh != null">ztxh = #{ztxh},</if>
            <if test="pz != null">pz = #{pz},</if>
            <if test="mxqk != null">mxqk = #{mxqk},</if>
            <if test="qzyy != null">qzyy = #{qzyy},</if>
            <if test="cw != null">cw = #{cw},</if>
            <if test="zjymd != null">zjymd = #{zjymd},</if>
            <if test="pl != null">pl = #{pl},</if>
            <if test="lgby != null">lgby = #{lgby},</if>
            <if test="jc != null">jc = #{jc},</if>
            <if test="jxzs != null">jxzs = #{jxzs},</if>
            <if test="zb != null">zb = #{zb},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjZtgjsjById" parameterType="Long">
        delete from sj_ztgjsj where id = #{id}
    </delete>

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