<?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.SjDcfxTsyxMapper">
    
    <resultMap type="SjDcfxTsyx" id="SjDcfxTsyxResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="tsyx"    column="tsyx"    />
        <result property="cw"    column="cw"    />
        <result property="jds"    column="jds"    />
    </resultMap>

    <sql id="selectSjDcfxTsyxVo">
        select id, jh, tsyx, cw, jds from sj_dcfx_tsyx
    </sql>

    <select id="selectSjDcfxTsyxList" parameterType="SjDcfxTsyx" resultMap="SjDcfxTsyxResult">
        <include refid="selectSjDcfxTsyxVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="tsyx != null  and tsyx != ''"> and tsyx = #{tsyx}</if>
            <if test="cw != null  and cw != ''"> and cw = #{cw}</if>
            <if test="jds != null "> and jds = #{jds}</if>
        </where>
    </select>
    
    <select id="selectSjDcfxTsyxById" parameterType="Long" resultMap="SjDcfxTsyxResult">
        <include refid="selectSjDcfxTsyxVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjDcfxTsyx" parameterType="SjDcfxTsyx" useGeneratedKeys="true" keyProperty="id">
        insert into sj_dcfx_tsyx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="tsyx != null">tsyx,</if>
            <if test="cw != null">cw,</if>
            <if test="jds != null">jds,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="tsyx != null">#{tsyx},</if>
            <if test="cw != null">#{cw},</if>
            <if test="jds != null">#{jds},</if>
         </trim>
    </insert>
    <insert id="insertSjDcfxTsyxBatch">
        insert into sj_dcfx_tsyx (jh,tsyx,cw,jds) values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.jh},#{item.tsyx},#{item.cw},#{item.jds})
        </foreach>
    </insert>

    <update id="updateSjDcfxTsyx" parameterType="SjDcfxTsyx">
        update sj_dcfx_tsyx
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="tsyx != null">tsyx = #{tsyx},</if>
            <if test="cw != null">cw = #{cw},</if>
            <if test="jds != null">jds = #{jds},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjDcfxTsyxById" parameterType="Long">
        delete from sj_dcfx_tsyx where id = #{id}
    </delete>

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