74 lines
2.5 KiB
XML
74 lines
2.5 KiB
XML
<?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.qiwenshare.file.mapper.FileMapper">
|
|
|
|
|
|
<insert id="batchInsertFile" parameterType="java.util.List">
|
|
INSERT ignore INTO file (userId, fileName,timeStampName, fileUrl,
|
|
filePath, extendName, uploadTime, fileSize, isDir)
|
|
VALUES
|
|
<foreach collection="list" item="file" index="index" separator=",">
|
|
(#{file.userId}, #{file.fileName},#{file.timeStampName},
|
|
#{file.fileUrl}, #{file.filePath}, #{file.extendName}, #{file.uploadTime},
|
|
#{file.fileSize}, #{file.isDir})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="replaceFilePath" parameterType="java.lang.String">
|
|
UPDATE file SET filepath=REPLACE(filepath, #{oldFilePath}, #{filePath}) WHERE filepath LIKE N'${oldFilePath}%';
|
|
</update>
|
|
|
|
<!-- <update id="updateFile" parameterType="java">-->
|
|
<!-- <choose>-->
|
|
<!-- <when test="isDir == 1">-->
|
|
<!-- UPDATE file SET filename=#{fileName}, uploadTime = #{uploadTime}-->
|
|
<!-- where fileId = #{fileId};-->
|
|
<!-- UPDATE file SET filepath=REPLACE(filepath, #{oldFilePath}, #{filePath}) WHERE filepath LIKE N'${oldFilePath}%';-->
|
|
<!-- </when>-->
|
|
<!-- <otherwise>-->
|
|
<!-- update file-->
|
|
<!-- <set>-->
|
|
<!-- <if test="fileName != null">-->
|
|
<!-- fileName = #{fileName},-->
|
|
<!-- </if>-->
|
|
<!-- <if test="uploadTime != null">-->
|
|
<!-- uploadTime = #{uploadTime},-->
|
|
<!-- </if>-->
|
|
<!-- <if test="fileUrl != null">-->
|
|
<!-- fileUrl = #{fileUrl},-->
|
|
<!-- </if>-->
|
|
<!-- </set>-->
|
|
<!-- where fileId = #{fileId}-->
|
|
<!-- </otherwise>-->
|
|
<!-- </choose>-->
|
|
|
|
<!-- </update>-->
|
|
|
|
|
|
<update id="updateFilepathByFilepath">
|
|
UPDATE file SET filePath=REPLACE(filePath, #{param1}, #{param2})
|
|
WHERE filePath like N'${param1}%'
|
|
</update>
|
|
|
|
<update id="updateFilepathByPathAndName">
|
|
update file set filePath = #{param2}
|
|
where filePath = #{param1} and fileName = #{param3}
|
|
<if test="param4 != null">
|
|
and extendName = #{param4}
|
|
</if>
|
|
<if test="param4 == null">
|
|
and extendName is null
|
|
</if>
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper> |