<?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.SjH2sMapper">
    
    <resultMap type="SjH2s" id="SjH2sResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="js"    column="js"    />
        <result property="gczt"    column="gczt"    />
        <result property="cw"    column="cw"    />
        <result property="xsbd"    column="xsbd"    />
        <result property="xsgc"    column="xsgc"    />
        <result property="jcsj"    column="jcsj"    />
        <result property="jcfs"    column="jcfs"    />
        <result property="wyjkfw"    column="wyjkfw"    />
        <result property="wyjkjl"    column="wyjkjl"    />
        <result property="wybdfw"    column="wybdfw"    />
        <result property="wybdjl"    column="wybdjl"    />
        <result property="bz"    column="bz"    />
        <result property="createdBy"    column="created_by"    />
        <result property="createdTime"    column="created_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="ljjh"    column="ljjh"    />
    </resultMap>

    <sql id="selectSjH2sVo">
        select id, jh, js, ljjh, gczt, cw, xsbd, xsgc, jcsj, jcfs, wyjkfw, wyjkjl, wybdfw, wybdjl, bz, created_by, created_time, update_by, update_time from sj_h2s
    </sql>

    <select id="selectSjH2sList" parameterType="SjH2s" resultMap="SjH2sResult">
        <include refid="selectSjH2sVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="ljjh != null  and ljjh != ''"> and ljjh = #{ljjh}</if>
            <if test="js != null "> and js = #{js}</if>
            <if test="gczt != null  and gczt != ''"> and gczt = #{gczt}</if>
            <if test="cw != null  and cw != ''"> and cw = #{cw}</if>
            <if test="xsbd != null "> and xsbd = #{xsbd}</if>
            <if test="xsgc != null  and xsgc != ''"> and xsgc = #{xsgc}</if>
            <if test="jcsj != null  and jcsj != ''"> and jcsj = #{jcsj}</if>
            <if test="jcfs != null  and jcfs != ''"> and jcfs = #{jcfs}</if>
            <if test="wyjkfw != null "> and wyjkfw = #{wyjkfw}</if>
            <if test="wyjkjl != null "> and wyjkjl = #{wyjkjl}</if>
            <if test="wybdfw != null "> and wybdfw = #{wybdfw}</if>
            <if test="wybdjl != null "> and wybdjl = #{wybdjl}</if>
            <if test="bz != null  and bz != ''"> and bz = #{bz}</if>
            <if test="createdBy != null  and createdBy != ''"> and created_by = #{createdBy}</if>
            <if test="createdTime != null "> and created_time = #{createdTime}</if>
        </where>
    </select>
    
    <select id="selectSjH2sById" parameterType="Long" resultMap="SjH2sResult">
        <include refid="selectSjH2sVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjH2s" parameterType="SjH2s" useGeneratedKeys="true" keyProperty="id">
        insert into sj_h2s
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="js != null">js,</if>
            <if test="gczt != null">gczt,</if>
            <if test="cw != null">cw,</if>
            <if test="xsbd != null">xsbd,</if>
            <if test="xsgc != null">xsgc,</if>
            <if test="jcsj != null">jcsj,</if>
            <if test="jcfs != null">jcfs,</if>
            <if test="wyjkfw != null">wyjkfw,</if>
            <if test="wyjkjl != null">wyjkjl,</if>
            <if test="wybdfw != null">wybdfw,</if>
            <if test="wybdjl != null">wybdjl,</if>
            <if test="bz != null">bz,</if>
            <if test="createdBy != null">created_by,</if>
            <if test="createdTime != null">created_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="ljjh != null">ljjh,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="js != null">#{js},</if>
            <if test="gczt != null">#{gczt},</if>
            <if test="cw != null">#{cw},</if>
            <if test="xsbd != null">#{xsbd},</if>
            <if test="xsgc != null">#{xsgc},</if>
            <if test="jcsj != null">#{jcsj},</if>
            <if test="jcfs != null">#{jcfs},</if>
            <if test="wyjkfw != null">#{wyjkfw},</if>
            <if test="wyjkjl != null">#{wyjkjl},</if>
            <if test="wybdfw != null">#{wybdfw},</if>
            <if test="wybdjl != null">#{wybdjl},</if>
            <if test="bz != null">#{bz},</if>
            <if test="createdBy != null">#{createdBy},</if>
            <if test="createdTime != null">#{createdTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="ljjh != null">#{ljjh},</if>
         </trim>
    </insert>
    <insert id="insertSjH2sBatch">
        INSERT INTO sj_h2s
        (jh, js, gczt, cw,ljjh, xsbd, xsgc, jcsj, jcfs, wyjkfw, wyjkjl, wybdfw, wybdjl, bz)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.js},
            #{item.gczt},
            #{item.cw},
            #{item.ljjh},
            #{item.xsbd},
            #{item.xsgc},
            #{item.jcsj},
            #{item.jcfs},
            #{item.wyjkfw},
            #{item.wyjkjl},
            #{item.wybdfw},
            #{item.wybdjl},
            #{item.bz}
            )
        </foreach>

    </insert>

    <update id="updateSjH2s" parameterType="SjH2s">
        update sj_h2s
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="ljjh != null">ljjh = #{ljjh},</if>
            <if test="js != null">js = #{js},</if>
            <if test="gczt != null">gczt = #{gczt},</if>
            <if test="cw != null">cw = #{cw},</if>
            <if test="xsbd != null">xsbd = #{xsbd},</if>
            <if test="xsgc != null">xsgc = #{xsgc},</if>
            <if test="jcsj != null">jcsj = #{jcsj},</if>
            <if test="jcfs != null">jcfs = #{jcfs},</if>
            <if test="wyjkfw != null">wyjkfw = #{wyjkfw},</if>
            <if test="wyjkjl != null">wyjkjl = #{wyjkjl},</if>
            <if test="wybdfw != null">wybdfw = #{wybdfw},</if>
            <if test="wybdjl != null">wybdjl = #{wybdjl},</if>
            <if test="bz != null">bz = #{bz},</if>
            <if test="createdBy != null">created_by = #{createdBy},</if>
            <if test="createdTime != null">created_time = #{createdTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjH2sById" parameterType="Long">
        delete from sj_h2s where id = #{id}
    </delete>

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