<?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.SjJygjGdfdcsMapper">
    
    <resultMap type="SjJygjGdfdcs" id="SjJygjGdfdcsResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="js"    column="js"    />
        <result property="jx"    column="jx"    />
        <result property="fw"    column="fw"    />
        <result property="cs"    column="cs"    />
        <result property="spwy"    column="spwy"    />
        <result property="nbwy"    column="nbwy"    />
        <result property="dxwy"    column="dxwy"    />
        <result property="qjbhl"    column="qjbhl"    />
        <result property="gjm"    column="gjm"    />
        <result property="bd"    column="bd"    />
        <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="selectSjJygjGdfdcsVo">
        select id, jh, js, jx, fw, cs, spwy, nbwy, dxwy, qjbhl, gjm, bd, bz, created_by, created_time, update_by, update_time from sj_jygj_gdfdcs
    </sql>

    <select id="selectSjJygjGdfdcsList" parameterType="SjJygjGdfdcs" resultMap="SjJygjGdfdcsResult">
        <include refid="selectSjJygjGdfdcsVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="js != null "> and js = #{js}</if>
            <if test="jx != null "> and jx = #{jx}</if>
            <if test="fw != null "> and fw = #{fw}</if>
            <if test="cs != null "> and cs = #{cs}</if>
            <if test="spwy != null "> and spwy = #{spwy}</if>
            <if test="nbwy != null "> and nbwy = #{nbwy}</if>
            <if test="dxwy != null "> and dxwy = #{dxwy}</if>
            <if test="qjbhl != null "> and qjbhl = #{qjbhl}</if>
            <if test="gjm != null "> and gjm = #{gjm}</if>
            <if test="bd != null  and bd != ''"> and bd = #{bd}</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="selectSjJygjGdfdcsById" parameterType="Long" resultMap="SjJygjGdfdcsResult">
        <include refid="selectSjJygjGdfdcsVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjJygjGdfdcs" parameterType="SjJygjGdfdcs" useGeneratedKeys="true" keyProperty="id">
        insert into sj_jygj_gdfdcs
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="js != null">js,</if>
            <if test="jx != null">jx,</if>
            <if test="fw != null">fw,</if>
            <if test="cs != null">cs,</if>
            <if test="spwy != null">spwy,</if>
            <if test="nbwy != null">nbwy,</if>
            <if test="dxwy != null">dxwy,</if>
            <if test="qjbhl != null">qjbhl,</if>
            <if test="gjm != null">gjm,</if>
            <if test="bd != null">bd,</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="js != null">#{js},</if>
            <if test="jx != null">#{jx},</if>
            <if test="fw != null">#{fw},</if>
            <if test="cs != null">#{cs},</if>
            <if test="spwy != null">#{spwy},</if>
            <if test="nbwy != null">#{nbwy},</if>
            <if test="dxwy != null">#{dxwy},</if>
            <if test="qjbhl != null">#{qjbhl},</if>
            <if test="gjm != null">#{gjm},</if>
            <if test="bd != null">#{bd},</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="insertSjJygjGdfdcsBatch">
        INSERT INTO sj_jygj_gdfdcs
        (jh, js, jx, fw, cs, spwy, nbwy, dxwy, qjbhl, gjm, bd, bz)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.js},
            #{item.jx},
            #{item.fw},
            #{item.cs},
            #{item.spwy},
            #{item.nbwy},
            #{item.dxwy},
            #{item.qjbhl},
            #{item.gjm},
            #{item.bd},
            #{item.bz}
            )
        </foreach>
    </insert>

    <update id="updateSjJygjGdfdcs" parameterType="SjJygjGdfdcs">
        update sj_jygj_gdfdcs
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="js != null">js = #{js},</if>
            <if test="jx != null">jx = #{jx},</if>
            <if test="fw != null">fw = #{fw},</if>
            <if test="cs != null">cs = #{cs},</if>
            <if test="spwy != null">spwy = #{spwy},</if>
            <if test="nbwy != null">nbwy = #{nbwy},</if>
            <if test="dxwy != null">dxwy = #{dxwy},</if>
            <if test="qjbhl != null">qjbhl = #{qjbhl},</if>
            <if test="gjm != null">gjm = #{gjm},</if>
            <if test="bd != null">bd = #{bd},</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="deleteSjJygjGdfdcsById" parameterType="Long">
        delete from sj_jygj_gdfdcs where id = #{id}
    </delete>

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