<?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.SjTgTgqdjhMapper">
    
    <resultMap type="SjTgTgqdjh" id="SjTgTgqdjhResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="kc"    column="kc"    />
        <result property="jd"    column="jd"    />
        <result property="mmzl"    column="mmzl"    />
        <result property="djz"    column="djz"    />
        <result property="ljz"    column="ljz"    />
        <result property="zdzhkwj"    column="zdzhkwj"    />
        <result property="aqxskwj"    column="aqxskwj"    />
        <result property="zdzhkny"    column="zdzhkny"    />
        <result property="aqxskny"    column="aqxskny"    />
        <result property="zdzhkl"    column="zdzhkl"    />
        <result property="aqxskl"    column="aqxskl"    />
        <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="selectSjTgTgqdjhVo">
        select id, jh, kc, jd, mmzl, djz, ljz, zdzhkwj, aqxskwj, zdzhkny, aqxskny, zdzhkl, aqxskl, bz, created_by, created_time, update_by, update_time from sj_tg_tgqdjh
    </sql>

    <select id="selectSjTgTgqdjhList" parameterType="SjTgTgqdjh" resultMap="SjTgTgqdjhResult">
        <include refid="selectSjTgTgqdjhVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="jd != null  and jd != ''"> and jd = #{jd}</if>
            <if test="mmzl != null "> and mmzl = #{mmzl}</if>
            <if test="djz != null "> and djz = #{djz}</if>
            <if test="ljz != null "> and ljz = #{ljz}</if>
            <if test="zdzhkwj != null "> and zdzhkwj = #{zdzhkwj}</if>
            <if test="aqxskwj != null "> and aqxskwj = #{aqxskwj}</if>
            <if test="zdzhkny != null "> and zdzhkny = #{zdzhkny}</if>
            <if test="aqxskny != null "> and aqxskny = #{aqxskny}</if>
            <if test="zdzhkl != null "> and zdzhkl = #{zdzhkl}</if>
            <if test="aqxskl != null "> and aqxskl = #{aqxskl}</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="selectSjTgTgqdjhById" parameterType="Long" resultMap="SjTgTgqdjhResult">
        <include refid="selectSjTgTgqdjhVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjTgTgqdjh" parameterType="SjTgTgqdjh" useGeneratedKeys="true" keyProperty="id">
        insert into sj_tg_tgqdjh
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="kc != null">kc,</if>
            <if test="jd != null">jd,</if>
            <if test="mmzl != null">mmzl,</if>
            <if test="djz != null">djz,</if>
            <if test="ljz != null">ljz,</if>
            <if test="zdzhkwj != null">zdzhkwj,</if>
            <if test="aqxskwj != null">aqxskwj,</if>
            <if test="zdzhkny != null">zdzhkny,</if>
            <if test="aqxskny != null">aqxskny,</if>
            <if test="zdzhkl != null">zdzhkl,</if>
            <if test="aqxskl != null">aqxskl,</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="kc != null">#{kc},</if>
            <if test="jd != null">#{jd},</if>
            <if test="mmzl != null">#{mmzl},</if>
            <if test="djz != null">#{djz},</if>
            <if test="ljz != null">#{ljz},</if>
            <if test="zdzhkwj != null">#{zdzhkwj},</if>
            <if test="aqxskwj != null">#{aqxskwj},</if>
            <if test="zdzhkny != null">#{zdzhkny},</if>
            <if test="aqxskny != null">#{aqxskny},</if>
            <if test="zdzhkl != null">#{zdzhkl},</if>
            <if test="aqxskl != null">#{aqxskl},</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="insertSjTgTgqdjhBatch">

        INSERT INTO sj_tg_tgqdjh
        (jh, kc, jd, mmzl, djz, ljz, zdzhkwj, aqxskwj, zdzhkny, aqxskny, zdzhkl, aqxskl, bz)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.kc},
            #{item.jd},
            #{item.mmzl},
            #{item.djz},
            #{item.ljz},
            #{item.zdzhkwj},
            #{item.aqxskwj},
            #{item.zdzhkny},
            #{item.aqxskny},
            #{item.zdzhkl},
            #{item.aqxskl},
            #{item.bz}
            )
        </foreach>

    </insert>

    <update id="updateSjTgTgqdjh" parameterType="SjTgTgqdjh">
        update sj_tg_tgqdjh
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="kc != null">kc = #{kc},</if>
            <if test="jd != null">jd = #{jd},</if>
            <if test="mmzl != null">mmzl = #{mmzl},</if>
            <if test="djz != null">djz = #{djz},</if>
            <if test="ljz != null">ljz = #{ljz},</if>
            <if test="zdzhkwj != null">zdzhkwj = #{zdzhkwj},</if>
            <if test="aqxskwj != null">aqxskwj = #{aqxskwj},</if>
            <if test="zdzhkny != null">zdzhkny = #{zdzhkny},</if>
            <if test="aqxskny != null">aqxskny = #{aqxskny},</if>
            <if test="zdzhkl != null">zdzhkl = #{zdzhkl},</if>
            <if test="aqxskl != null">aqxskl = #{aqxskl},</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="deleteSjTgTgqdjhById" parameterType="Long">
        delete from sj_tg_tgqdjh where id = #{id}
    </delete>

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