|
|
@@ -3,13 +3,13 @@
|
|
|
|
|
|
<mapper namespace="cn.reghao.tnb.content.app.disk.db.mapper.DiskFileMapper">
|
|
|
<insert id="save" useGeneratedKeys="true" keyProperty="id">
|
|
|
- insert into my_disk_file
|
|
|
+ insert into disk_file
|
|
|
(`channel_code`,`file_id`,`pid`,`path`,`filename`,`file_type`,`sha256sum`,`size`,`owner`)
|
|
|
values
|
|
|
(#{channelCode},#{fileId},#{pid},#{path},#{filename},#{fileType},#{sha256sum},#{size},#{owner})
|
|
|
</insert>
|
|
|
<insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
|
|
|
- insert into my_disk_file
|
|
|
+ insert into disk_file
|
|
|
(`channel_code`,`file_id`,`pid`,`path`,`filename`,`file_type`,`sha256sum`,`size`,`owner`)
|
|
|
values
|
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
|
@@ -18,12 +18,12 @@
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateMoveDiskFile">
|
|
|
- update my_disk_file
|
|
|
+ update disk_file
|
|
|
set update_time=now(),pid=#{pid},`path`=#{path}
|
|
|
where file_id=#{fileId}
|
|
|
</update>
|
|
|
<update id="updateDeleteDiskFiles">
|
|
|
- update my_disk_file
|
|
|
+ update disk_file
|
|
|
set update_time=now(),deleted=1
|
|
|
where file_id in
|
|
|
<foreach collection="collection" item="id" index="index" open="(" close=")" separator=",">
|
|
|
@@ -31,19 +31,19 @@
|
|
|
</foreach>
|
|
|
</update>
|
|
|
<update id="updateDeleteByPathPrefix">
|
|
|
- update my_disk_file
|
|
|
+ update disk_file
|
|
|
set update_time=now(),deleted=1
|
|
|
where `owner`=#{owner} and `path` like concat(#{pathPrefix},'%')
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteByAlbumIdAndPostId">
|
|
|
- delete from my_disk_file
|
|
|
+ delete from disk_file
|
|
|
where album_id=#{albumId} and post_id=#{postId}
|
|
|
</delete>
|
|
|
|
|
|
<select id="countByDiskQuery" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
<where>
|
|
|
deleted=0
|
|
|
<if test="fileType != null">
|
|
|
@@ -68,7 +68,7 @@
|
|
|
</select>
|
|
|
<select id="findDiskQueryByPage" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
|
|
|
select *
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
<where>
|
|
|
deleted=0
|
|
|
<if test="diskQuery.fileType != null">
|
|
|
@@ -97,14 +97,14 @@
|
|
|
</select>
|
|
|
<select id="findFileTypeCountByGroup" resultType="cn.reghao.tnb.content.app.disk.model.vo.DiskFileCount">
|
|
|
select file,count(*) as total
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
group by file_type
|
|
|
order by total desc
|
|
|
</select>
|
|
|
|
|
|
<select id="findByFileIds" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
|
|
|
select *
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
where deleted=0 and file_id in
|
|
|
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
|
|
|
#{id}
|
|
|
@@ -112,7 +112,7 @@
|
|
|
</select>
|
|
|
<select id="findByParentIds" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
|
|
|
select *
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
where deleted=0 and pid in
|
|
|
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
|
|
|
#{id}
|
|
|
@@ -120,18 +120,18 @@
|
|
|
</select>
|
|
|
<select id="findRoot" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
|
|
|
select *
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
where file_id='0'
|
|
|
</select>
|
|
|
<select id="findByPathPrefix" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
|
|
|
select *
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
where deleted=0 and file_id!=#{fileId} and `path` like concat(#{pathPrefix})
|
|
|
</select>
|
|
|
|
|
|
<select id="countSha256sumGroupByDiskQuery" resultType="java.lang.String">
|
|
|
select sha256sum
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
where deleted=0 and `owner`=#{userId} and file_type=#{fileType} and sha256sum not in (
|
|
|
select sha256sum
|
|
|
from my_disk_album_file A
|
|
|
@@ -145,7 +145,7 @@
|
|
|
</select>
|
|
|
<select id="findSha256sumGroupByPage" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
|
|
|
select *
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
where deleted=0 and `owner`=#{userId} and file_type=#{fileType} and sha256sum not in (
|
|
|
select sha256sum
|
|
|
from my_disk_album_file A
|
|
|
@@ -159,7 +159,7 @@
|
|
|
</select>
|
|
|
<select id="findSha256sumGroup" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
|
|
|
select *
|
|
|
- from my_disk_file
|
|
|
+ from disk_file
|
|
|
where deleted=0 and sha256sum in
|
|
|
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
|
|
|
#{id}
|