<?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.SjFlMapper">
    
    <resultMap type="SjFl" id="SjFlResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="yjlxfs"    column="yjlxfs"    />
        <result property="yfgkcs"    column="yfgkcs"    />
        <result property="wjsgcs"    column="wjsgcs"    />
        <result property="syzn"    column="syzn"    />
        <result property="tsyxzs"    column="tsyxzs"    />
        <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="selectSjFlVo">
        select id, jh, yjlxfs, yfgkcs, wjsgcs, syzn, tsyxzs, created_by, created_time, update_by, update_time from sj_fl
    </sql>

    <select id="selectSjFlList" parameterType="SjFl" resultMap="SjFlResult">
        <include refid="selectSjFlVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="yjlxfs != null  and yjlxfs != ''"> and yjlxfs = #{yjlxfs}</if>
            <if test="yfgkcs != null  and yfgkcs != ''"> and yfgkcs = #{yfgkcs}</if>
            <if test="wjsgcs != null  and wjsgcs != ''"> and wjsgcs = #{wjsgcs}</if>
            <if test="syzn != null  and syzn != ''"> and syzn = #{syzn}</if>
            <if test="tsyxzs != null  and tsyxzs != ''"> and tsyxzs = #{tsyxzs}</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="selectSjFlById" parameterType="Long" resultMap="SjFlResult">
        <include refid="selectSjFlVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjFl" parameterType="SjFl" useGeneratedKeys="true" keyProperty="id">
        insert into sj_fl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="yjlxfs != null">yjlxfs,</if>
            <if test="yfgkcs != null">yfgkcs,</if>
            <if test="wjsgcs != null">wjsgcs,</if>
            <if test="syzn != null">syzn,</if>
            <if test="tsyxzs != null">tsyxzs,</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="yjlxfs != null">#{yjlxfs},</if>
            <if test="yfgkcs != null">#{yfgkcs},</if>
            <if test="wjsgcs != null">#{wjsgcs},</if>
            <if test="syzn != null">#{syzn},</if>
            <if test="tsyxzs != null">#{tsyxzs},</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="updateSjFl" parameterType="SjFl">
        update sj_fl
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="yjlxfs != null">yjlxfs = #{yjlxfs},</if>
            <if test="yfgkcs != null">yfgkcs = #{yfgkcs},</if>
            <if test="wjsgcs != null">wjsgcs = #{wjsgcs},</if>
            <if test="syzn != null">syzn = #{syzn},</if>
            <if test="tsyxzs != null">tsyxzs = #{tsyxzs},</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="deleteSjFlById" parameterType="Long">
        delete from sj_fl where id = #{id}
    </delete>

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