<?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.rymcu.forest.mapper.ForestFileMapper">
    <resultMap id="BaseResultMap" type="com.rymcu.forest.entity.ForestFile">
        <id column="id" property="id"/>
        <result column="md5_value" property="md5Value"/>
        <result column="file_path" property="filePath"/>
        <result column="file_url" property="fileUrl"/>
        <result column="created_time" property="createdTime"/>
        <result column="updated_time" property="updatedTime"/>
        <result column="created_by" property="createdBy"/>
    </resultMap>

    <insert id="insertForestFile">
        insert into forest_file (md5_value, file_path, file_url, created_time, created_by)
        values (#{md5Value}, #{filePath}, #{fileUrl}, sysdate(), #{createdBy})
    </insert>

    <select id="getFileUrlByMd5" resultType="java.lang.String">
        select file_url
        from forest_file
        where md5_value = #{md5Value}
    </select>

</mapper>