<?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.SjZysxMapper">
    
    <resultMap type="SjZysx" id="SjZysxResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="zysx"    column="zysx"    />
        <result property="lb"    column="lb"    />
        <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="selectSjZysxVo">
        select id, jh, zysx, lb, bz, created_by, created_time, update_by, update_time from sj_zysx
    </sql>

    <select id="selectSjZysxList" parameterType="SjZysx" resultMap="SjZysxResult">
        <include refid="selectSjZysxVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="zysx != null  and zysx != ''"> and zysx = #{zysx}</if>
            <if test="lb != null  and lb != ''"> and lb = #{lb}</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="selectSjZysxById" parameterType="Long" resultMap="SjZysxResult">
        <include refid="selectSjZysxVo"/>
        where id = #{id}
    </select>
    <select id="selectSjZysxByJh" resultType="com.ruoyi.project.zjsgfa.domain.SjZysx">
        <include refid="selectSjZysxVo"/>
        where jh = #{jh} and lb=#{lb}
    </select>

    <insert id="insertSjZysx" parameterType="SjZysx" useGeneratedKeys="true" keyProperty="id">
        insert into sj_zysx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="zysx != null">zysx,</if>
            <if test="lb != null">lb,</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="zysx != null">#{zysx},</if>
            <if test="lb != null">#{lb},</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>

    <update id="updateSjZysx" parameterType="SjZysx">
        update sj_zysx
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="zysx != null">zysx = #{zysx},</if>
            <if test="lb != null">lb = #{lb},</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="deleteSjZysxById" parameterType="Long">
        delete from sj_zysx where id = #{id}
    </delete>

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