<?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.bonus.bracelet.mapper.ResourceFileMapper">

    <!--添加文件资源-->
    <insert id="addFile">
        INSERT INTO sys_file_source
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fileName != null and fileName!=''">file_name,</if>
            <if test="fileSuffix != null and fileSuffix!=''">file_suffix,</if>
            <if test="filePath != null and filePath!=''">file_path,</if>
            <if test="fileType != null">file_type,</if>
            <if test="sourceId != null and sourceId!=''">source_id,</if>
            <if test="sourceType != null and sourceType!=''">source_type,</if>
            create_time,
            create_user,
            update_time,
            update_user,
            del_flag
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fileName != null and fileName!=''">#{fileName},</if>
            <if test="fileSuffix != null and fileSuffix!=''">#{fileSuffix},</if>
            <if test="filePath != null and filePath!=''">#{filePath},</if>
            <if test="fileType != null">#{fileType},</if>
            <if test="sourceId != null and sourceId!=''">#{sourceId},</if>
            <if test="sourceType != null and sourceType!=''">#{sourceType},</if>
            #{createTime},
            #{createUser},
            #{updateTime},
            #{updateUser},
            #{delFlag}
        </trim>
    </insert>
    <!--删除资源文件-->
    <update id="delResourceFile">
        UPDATE sys_file_source SET del_flag = 1 WHERE id = #{fileId}
    </update>
</mapper>