<?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.SjTgTgxnsjMapper">
    
    <resultMap type="SjTgTgxnsj" id="SjTgTgxnsjResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="wj"    column="wj"    />
        <result property="gj"    column="gj"    />
        <result property="bh"    column="bh"    />
        <result property="kx"    column="kx"    />
        <result property="mmzl"    column="mmzl"    />
        <result property="jgwj"    column="jgwj"    />
        <result property="klqd"    column="klqd"    />
        <result property="kjqd"    column="kjqd"    />
        <result property="knyqd"    column="knyqd"    />
        <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"    />
    </resultMap>

    <sql id="selectSjTgTgxnsjVo">
        select id, jh, wj, gj, bh, kx, mmzl, jgwj, klqd, kjqd, knyqd, bz, created_by, created_time, update_by, update_time from sj_tg_tgxnsj
    </sql>

    <select id="selectSjTgTgxnsjList" parameterType="SjTgTgxnsj" resultMap="SjTgTgxnsjResult">
        <include refid="selectSjTgTgxnsjVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="wj != null "> and wj = #{wj}</if>
            <if test="gj != null  and gj != ''"> and gj = #{gj}</if>
            <if test="bh != null "> and bh = #{bh}</if>
            <if test="kx != null  and kx != ''"> and kx = #{kx}</if>
            <if test="mmzl != null "> and mmzl = #{mmzl}</if>
            <if test="jgwj != null "> and jgwj = #{jgwj}</if>
            <if test="klqd != null "> and klqd = #{klqd}</if>
            <if test="kjqd != null "> and kjqd = #{kjqd}</if>
            <if test="knyqd != null "> and knyqd = #{knyqd}</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="selectSjTgTgxnsjById" parameterType="Long" resultMap="SjTgTgxnsjResult">
        <include refid="selectSjTgTgxnsjVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjTgTgxnsj" parameterType="SjTgTgxnsj" useGeneratedKeys="true" keyProperty="id">
        insert into sj_tg_tgxnsj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="wj != null">wj,</if>
            <if test="gj != null">gj,</if>
            <if test="bh != null">bh,</if>
            <if test="kx != null">kx,</if>
            <if test="mmzl != null">mmzl,</if>
            <if test="jgwj != null">jgwj,</if>
            <if test="klqd != null">klqd,</if>
            <if test="kjqd != null">kjqd,</if>
            <if test="knyqd != null">knyqd,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="wj != null">#{wj},</if>
            <if test="gj != null">#{gj},</if>
            <if test="bh != null">#{bh},</if>
            <if test="kx != null">#{kx},</if>
            <if test="mmzl != null">#{mmzl},</if>
            <if test="jgwj != null">#{jgwj},</if>
            <if test="klqd != null">#{klqd},</if>
            <if test="kjqd != null">#{kjqd},</if>
            <if test="knyqd != null">#{knyqd},</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>
         </trim>
    </insert>
    <insert id="insertSjTgTgxnsjBatch">
        INSERT INTO sj_tg_tgxnsj
        (jh, wj, gj, bh, kx, mmzl, jgwj, klqd, kjqd, knyqd, bz)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.wj},
            #{item.gj},
            #{item.bh},
            #{item.kx},
            #{item.mmzl},
            #{item.jgwj},
            #{item.klqd},
            #{item.kjqd},
            #{item.knyqd},
            #{item.bz}
            )
        </foreach>
    </insert>

    <update id="updateSjTgTgxnsj" parameterType="SjTgTgxnsj">
        update sj_tg_tgxnsj
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="wj != null">wj = #{wj},</if>
            <if test="gj != null">gj = #{gj},</if>
            <if test="bh != null">bh = #{bh},</if>
            <if test="kx != null">kx = #{kx},</if>
            <if test="mmzl != null">mmzl = #{mmzl},</if>
            <if test="jgwj != null">jgwj = #{jgwj},</if>
            <if test="klqd != null">klqd = #{klqd},</if>
            <if test="kjqd != null">kjqd = #{kjqd},</if>
            <if test="knyqd != null">knyqd = #{knyqd},</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="deleteSjTgTgxnsjById" parameterType="Long">
        delete from sj_tg_tgxnsj where id = #{id}
    </delete>

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