<?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.SjZlyqZbyqMapper">
    
    <resultMap type="SjZlyqZbyq" id="SjZlyqZbyqResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="bd"    column="bd"    />
        <result property="bbj"    column="bbj"    />
        <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="selectSjZlyqZbyqVo">
        select id, jh, bd, bbj, bz, created_by, created_time, update_by, update_time from sj_zlyq_zbyq
    </sql>

    <select id="selectSjZlyqZbyqList" parameterType="SjZlyqZbyq" resultMap="SjZlyqZbyqResult">
        <include refid="selectSjZlyqZbyqVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="bd != null  and bd != ''"> and bd = #{bd}</if>
            <if test="bbj != null "> and bbj = #{bbj}</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="selectSjZlyqZbyqById" parameterType="Long" resultMap="SjZlyqZbyqResult">
        <include refid="selectSjZlyqZbyqVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjZlyqZbyq" parameterType="SjZlyqZbyq" useGeneratedKeys="true" keyProperty="id">
        insert into sj_zlyq_zbyq
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="bd != null">bd,</if>
            <if test="bbj != null">bbj,</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="bd != null">#{bd},</if>
            <if test="bbj != null">#{bbj},</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="insertSjZlyqZbyqBatch">
        INSERT INTO sj_zlyq_zbyq
        (jh, bd, bbj, bz)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.bd},
            #{item.bbj},
            #{item.bz}
            )
        </foreach>
    </insert>

    <update id="updateSjZlyqZbyq" parameterType="SjZlyqZbyq">
        update sj_zlyq_zbyq
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="bd != null">bd = #{bd},</if>
            <if test="bbj != null">bbj = #{bbj},</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="deleteSjZlyqZbyqById" parameterType="Long">
        delete from sj_zlyq_zbyq where id = #{id}
    </delete>

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