<?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.SjZjyFdsjMapper">
    
    <resultMap type="SjZjyFdsj" id="SjZjyFdsjResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="kc"    column="kc"    />
        <result property="jd"    column="jd"    />
        <result property="zjytx"    column="zjytx"    />
        <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="selectSjZjyFdsjVo">
        select id, jh, kc, jd, zjytx, bz, created_by, created_time, update_by, update_time from sj_zjy_fdsj
    </sql>

    <select id="selectSjZjyFdsjList" parameterType="SjZjyFdsj" resultMap="SjZjyFdsjResult">
        <include refid="selectSjZjyFdsjVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="jd != null  and jd != ''"> and jd = #{jd}</if>
            <if test="zjytx != null  and zjytx != ''"> and zjytx = #{zjytx}</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="selectSjZjyFdsjById" parameterType="Long" resultMap="SjZjyFdsjResult">
        <include refid="selectSjZjyFdsjVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjZjyFdsj" parameterType="SjZjyFdsj" useGeneratedKeys="true" keyProperty="id">
        insert into sj_zjy_fdsj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="kc != null">kc,</if>
            <if test="jd != null">jd,</if>
            <if test="zjytx != null">zjytx,</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="kc != null">#{kc},</if>
            <if test="jd != null">#{jd},</if>
            <if test="zjytx != null">#{zjytx},</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="insertSjZjyFdsjBatch">
        INSERT INTO sj_zjy_fdsj
        (jh, kc, jd, zjytx, bz)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.kc},
            #{item.jd},
            #{item.zjytx},
            #{item.bz}
            )
        </foreach>
    </insert>

    <update id="updateSjZjyFdsj" parameterType="SjZjyFdsj">
        update sj_zjy_fdsj
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="kc != null">kc = #{kc},</if>
            <if test="jd != null">jd = #{jd},</if>
            <if test="zjytx != null">zjytx = #{zjytx},</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="deleteSjZjyFdsjById" parameterType="Long">
        delete from sj_zjy_fdsj where id = #{id}
    </delete>

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