<?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接口路径 -->
<mapper namespace="com.fkzy.warn.mapper.FileMapper">

    <resultMap id="FileVOModel" type="com.fkzy.warn.model.vo.FileVO">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="file_path" property="url" jdbcType="VARCHAR"/>
        <result column="file_name" property="name" jdbcType="VARCHAR"/>
    </resultMap>

    <insert id="saveModel" useGeneratedKeys="true" keyProperty="id" parameterType="com.fkzy.warn.model.File">
        INSERT INTO "gas_service_db"."t_sys_file"
        ("file_path", "file_name", "file_size", "create_time", "creator_id", "is_del")
        VALUES (#{filePath}, #{fileName}, #{fileSize}, #{createTime}, #{creatorId}, 0);

    </insert>


    <select id="selectByFileIds" resultMap="FileVOModel">
        select
        id,
        file_path,
        file_name
        from t_sys_file
        where id in
        <foreach collection="fileIds" item="fileId" separator="," open="(" close=")">
            ${fileId}
        </foreach>
        and is_del = 0
    </select>
</mapper>