<?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.system.mapper.SysFileSourceMapper">


    <insert id="addFileSource">
        INSERT INTO sys_file_source(
            file_name, file_suffix, file_path,
            file_type,  source_id, source_type,
            create_time,create_user,update_time,
            update_user, del_flag
        ) VALUE(
            #{fileName},#{fileSuffix},#{filePath},
            #{fileType},#{sourceId},#{sourceType},
            now(),#{createUser},now(),
            #{updateUser},0
        )
    </insert>
    <delete id="delSourceFileById">
        update   sys_file_source set del_flag=1 WHERE id=#{id}
    </delete>
    <delete id="delSourceFileBySourceId">
        update   sys_file_source set del_flag=1 WHERE source_id=#{sourceId}

    </delete>
    <select id="getSourceFileList" resultType="com.bonus.system.api.domain.SysFileSource">
            select id,file_name fileName, file_suffix  fileSuffix, file_path filePath,
                   file_type fileType,  source_id sourceId, source_type sourceType,
                   create_time,create_user createUser,update_time,
                   update_user updateUser
                FROM
                    sys_file_source
            where source_id=#{sourceId}
    </select>
</mapper>