<?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.securitycontrol.background.mapper.SourceFileMapper">
    <insert id="addSource">
        insert into tb_resource_file(id,file_type,file_id,file_suffix,
        file_name,source_id,source_type,del_flag,update_time)
        value ( #{id},#{fileType},#{fileId},#{suffix},#{fileName},
                #{sourceId},#{sourceType},0,now())
    </insert>
    <update id="updateSource">
        update   tb_resource_file set
        file_type=#{fileType},file_id=#{fileId},file_suffix=#{suffix},
        file_name=#{fileName},source_id=#{sourceId},
            source_type=#{sourceType},update_time=now()
            where  file_id=#{fileId}
    </update>
    <update id="deleteSource" >
          update  tb_resource_file set del_flag=1
                where  file_id=#{fileId}
    </update>
    <select id="getSourceList" resultType="com.securitycontrol.entity.file.FileExportVo">
        select id,file_type  fileType,file_id fileId,file_suffix suffix,
                file_name fileName,source_id sourceId,source_type sourceType,update_time updaetTime
                from  tb_resource_file
                where source_id=#{sourceId}  AND  source_type=#{sourceType}
                and del_flag=0
    </select>

</mapper>