<?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.DzgzzbMapper">
    
    <resultMap type="Dzgzzb" id="DzgzzbResult">
        <result property="id"    column="id"    />
        <result property="dzfc"    column="dzfc"    />
        <result property="dcdm"    column="dcdm"    />
        <result property="jcm"    column="jcm"    />
        <result property="zyyx"    column="zyyx"    />
        <result property="yxms"    column="yxms"    />
        <result property="tsyx"    column="tsyx"    />
        <result property="zxhd"    column="zxhd"    />
        <result property="zdhd"    column="zdhd"    />
    </resultMap>

    <sql id="selectDzgzzbVo">
        select id, dzfc, dcdm, jcm, zyyx, yxms, tsyx, zxhd, zdhd from dzgzzb
    </sql>

    <select id="selectDzgzzbList" parameterType="Dzgzzb" resultMap="DzgzzbResult">
        <include refid="selectDzgzzbVo"/>
        <where>  
            <if test="dzfc != null  and dzfc != ''"> and dzfc = #{dzfc}</if>
            <if test="dcdm != null  and dcdm != ''"> and dcdm = #{dcdm}</if>
            <if test="jcm != null  and jcm != ''"> and jcm = #{jcm}</if>
            <if test="zyyx != null  and zyyx != ''"> and zyyx = #{zyyx}</if>
            <if test="yxms != null  and yxms != ''"> and yxms = #{yxms}</if>
            <if test="tsyx != null  and tsyx != ''"> and tsyx = #{tsyx}</if>
            <if test="zxhd != null "> and zxhd = #{zxhd}</if>
            <if test="zdhd != null "> and zdhd = #{zdhd}</if>
        </where>
    </select>
    
    <select id="selectDzgzzbById" parameterType="Long" resultMap="DzgzzbResult">
        <include refid="selectDzgzzbVo"/>
        where id = #{id}
    </select>

    <insert id="insertDzgzzb" parameterType="Dzgzzb" useGeneratedKeys="true" keyProperty="id">
        insert into dzgzzb
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dzfc != null">dzfc,</if>
            <if test="dcdm != null">dcdm,</if>
            <if test="jcm != null">jcm,</if>
            <if test="zyyx != null">zyyx,</if>
            <if test="yxms != null">yxms,</if>
            <if test="tsyx != null">tsyx,</if>
            <if test="zxhd != null">zxhd,</if>
            <if test="zdhd != null">zdhd,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dzfc != null">#{dzfc},</if>
            <if test="dcdm != null">#{dcdm},</if>
            <if test="jcm != null">#{jcm},</if>
            <if test="zyyx != null">#{zyyx},</if>
            <if test="yxms != null">#{yxms},</if>
            <if test="tsyx != null">#{tsyx},</if>
            <if test="zxhd != null">#{zxhd},</if>
            <if test="zdhd != null">#{zdhd},</if>
         </trim>
    </insert>

    <update id="updateDzgzzb" parameterType="Dzgzzb">
        update dzgzzb
        <trim prefix="SET" suffixOverrides=",">
            <if test="dzfc != null">dzfc = #{dzfc},</if>
            <if test="dcdm != null">dcdm = #{dcdm},</if>
            <if test="jcm != null">jcm = #{jcm},</if>
            <if test="zyyx != null">zyyx = #{zyyx},</if>
            <if test="yxms != null">yxms = #{yxms},</if>
            <if test="tsyx != null">tsyx = #{tsyx},</if>
            <if test="zxhd != null">zxhd = #{zxhd},</if>
            <if test="zdhd != null">zdhd = #{zdhd},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDzgzzbById" parameterType="Long">
        delete from dzgzzb where id = #{id}
    </delete>

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