<?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.SjDcfxDzfcMapper">
    
    <resultMap type="SjDcfxDzfc" id="SjDcfxDzfcResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="dzfc"    column="dzfc"    />
        <result property="cs"    column="cs"    />
        <result property="xs"    column="xs"    />
        <result property="yxts"    column="yxts"    />
        <result property="yqsts"    column="yqsts"    />
        <result property="gzts"    column="gzts"    />
    </resultMap>

    <sql id="selectSjDcfxDzfcVo">
        select id, jh, dzfc, cs, xs, yxts, yqsts, gzts from sj_dcfx_dzfc
    </sql>

    <select id="selectSjDcfxDzfcList" parameterType="SjDcfxDzfc" resultMap="SjDcfxDzfcResult">
        <include refid="selectSjDcfxDzfcVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="dzfc != null  and dzfc != ''"> and dzfc = #{dzfc}</if>
            <if test="cs != null "> and cs = #{cs}</if>
            <if test="xs != null "> and xs = #{xs}</if>
            <if test="yxts != null  and yxts != ''"> and yxts = #{yxts}</if>
            <if test="yqsts != null  and yqsts != ''"> and yqsts = #{yqsts}</if>
            <if test="gzts != null  and gzts != ''"> and gzts = #{gzts}</if>
        </where>
    </select>
    
    <select id="selectSjDcfxDzfcById" parameterType="Long" resultMap="SjDcfxDzfcResult">
        <include refid="selectSjDcfxDzfcVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjDcfxDzfc" parameterType="SjDcfxDzfc" useGeneratedKeys="true" keyProperty="id">
        insert into sj_dcfx_dzfc
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="dzfc != null">dzfc,</if>
            <if test="cs != null">cs,</if>
            <if test="xs != null">xs,</if>
            <if test="yxts != null">yxts,</if>
            <if test="yqsts != null">yqsts,</if>
            <if test="gzts != null">gzts,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="dzfc != null">#{dzfc},</if>
            <if test="cs != null">#{cs},</if>
            <if test="xs != null">#{xs},</if>
            <if test="yxts != null">#{yxts},</if>
            <if test="yqsts != null">#{yqsts},</if>
            <if test="gzts != null">#{gzts},</if>
         </trim>
    </insert>
    <insert id="insertSjDcfxDzfcBatch">
        INSERT INTO sj_dcfx_dzfc
        (jh, dzfc, cs, xs, yxts, yqsts, gzts)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.dzfc},
            #{item.cs},
            #{item.xs},
            #{item.yxts},
            #{item.yqsts},
            #{item.gzts}
            )
        </foreach>

    </insert>

    <update id="updateSjDcfxDzfc" parameterType="SjDcfxDzfc">
        update sj_dcfx_dzfc
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="dzfc != null">dzfc = #{dzfc},</if>
            <if test="cs != null">cs = #{cs},</if>
            <if test="xs != null">xs = #{xs},</if>
            <if test="yxts != null">yxts = #{yxts},</if>
            <if test="yqsts != null">yqsts = #{yqsts},</if>
            <if test="gzts != null">gzts = #{gzts},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjDcfxDzfcById" parameterType="Long">
        delete from sj_dcfx_dzfc where id = #{id}
    </delete>

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