<?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.SjJygjgdsjMapper">
    
    <resultMap type="SjJygjgdsj" id="SjJygjgdsjResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="jdcs"    column="jdcs"    />
        <result property="jdbhj"    column="jdbhj"    />
        <result property="jdbhfw"    column="jdbhfw"    />
        <result property="zxd"    column="zxd"    />
        <result property="zdjxj"    column="zdjxj"    />
        <result property="cqj"    column="cqj"    />
        <result property="ccqd"    column="ccqd"    />
        <result property="cpj"    column="cpj"    />
        <result property="slj"    column="slj"    />
        <result property="fwxzj"    column="fwxzj"    />
    </resultMap>

    <sql id="selectSjJygjgdsjVo">
        select id, jh, jdcs, jdbhj, jdbhfw, zxd, zdjxj, cqj, ccqd, cpj, slj, fwxzj from sj_jygjgdsj
    </sql>

    <select id="selectSjJygjgdsjList" parameterType="SjJygjgdsj" resultMap="SjJygjgdsjResult">
        <include refid="selectSjJygjgdsjVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="jdcs != null "> and jdcs = #{jdcs}</if>
            <if test="jdbhj != null "> and jdbhj = #{jdbhj}</if>
            <if test="jdbhfw != null "> and jdbhfw = #{jdbhfw}</if>
            <if test="zxd != null "> and zxd = #{zxd}</if>
            <if test="zdjxj != null "> and zdjxj = #{zdjxj}</if>
            <if test="cqj != null "> and cqj = #{cqj}</if>
            <if test="ccqd != null "> and ccqd = #{ccqd}</if>
            <if test="cpj != null "> and cpj = #{cpj}</if>
            <if test="slj != null "> and slj = #{slj}</if>
            <if test="fwxzj != null "> and fwxzj = #{fwxzj}</if>
        </where>
    </select>
    
    <select id="selectSjJygjgdsjById" parameterType="Long" resultMap="SjJygjgdsjResult">
        <include refid="selectSjJygjgdsjVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjJygjgdsj" parameterType="SjJygjgdsj" useGeneratedKeys="true" keyProperty="id">
        insert into sj_jygjgdsj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="jdcs != null">jdcs,</if>
            <if test="jdbhj != null">jdbhj,</if>
            <if test="jdbhfw != null">jdbhfw,</if>
            <if test="zxd != null">zxd,</if>
            <if test="zdjxj != null">zdjxj,</if>
            <if test="cqj != null">cqj,</if>
            <if test="ccqd != null">ccqd,</if>
            <if test="cpj != null">cpj,</if>
            <if test="slj != null">slj,</if>
            <if test="fwxzj != null">fwxzj,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="jdcs != null">#{jdcs},</if>
            <if test="jdbhj != null">#{jdbhj},</if>
            <if test="jdbhfw != null">#{jdbhfw},</if>
            <if test="zxd != null">#{zxd},</if>
            <if test="zdjxj != null">#{zdjxj},</if>
            <if test="cqj != null">#{cqj},</if>
            <if test="ccqd != null">#{ccqd},</if>
            <if test="cpj != null">#{cpj},</if>
            <if test="slj != null">#{slj},</if>
            <if test="fwxzj != null">#{fwxzj},</if>
         </trim>
    </insert>
    <insert id="insertSjJygjgdsjBatch">
        INSERT INTO sj_jygjgdsj
        (jh, jdcs, jdbhj, jdbhfw, zxd, zdjxj, cqj, ccqd, cpj, slj, fwxzj)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.jdcs},
            #{item.jdbhj},
            #{item.jdbhfw},
            #{item.zxd},
            #{item.zdjxj},
            #{item.cqj},
            #{item.ccqd},
            #{item.cpj},
            #{item.slj},
            #{item.fwxzj}
            )
        </foreach>

    </insert>

    <update id="updateSjJygjgdsj" parameterType="SjJygjgdsj">
        update sj_jygjgdsj
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="jdcs != null">jdcs = #{jdcs},</if>
            <if test="jdbhj != null">jdbhj = #{jdbhj},</if>
            <if test="jdbhfw != null">jdbhfw = #{jdbhfw},</if>
            <if test="zxd != null">zxd = #{zxd},</if>
            <if test="zdjxj != null">zdjxj = #{zdjxj},</if>
            <if test="cqj != null">cqj = #{cqj},</if>
            <if test="ccqd != null">ccqd = #{ccqd},</if>
            <if test="cpj != null">cpj = #{cpj},</if>
            <if test="slj != null">slj = #{slj},</if>
            <if test="fwxzj != null">fwxzj = #{fwxzj},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjJygjgdsjById" parameterType="Long">
        delete from sj_jygjgdsj where id = #{id}
    </delete>

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