|
@@ -4,16 +4,16 @@
|
|
|
<mapper namespace="cn.reghao.oss.store.db.mapper.DataBlockMapper">
|
|
<mapper namespace="cn.reghao.oss.store.db.mapper.DataBlockMapper">
|
|
|
<insert id="save" useGeneratedKeys="true" keyProperty="id">
|
|
<insert id="save" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into data_block
|
|
insert into data_block
|
|
|
- (`id`,`deleted`,`create_time`,`update_time`,`content_id`,`index`,`block_id`,`host`,`absolute_path`,`size`,`start`,`end`)
|
|
|
|
|
|
|
+ (`id`,`deleted`,`create_time`,`update_time`,`content_id`,`index`,`block_id`,`host`,`base_dir`,`relative_dir`,`absolute_path`,`size`,`start`,`end`)
|
|
|
values
|
|
values
|
|
|
- (#{id},#{deleted},#{createTime},#{updateTime},#{contentId},#{index},#{blockId},#{host},#{absolutePath},#{size},#{start},#{end})
|
|
|
|
|
|
|
+ (#{id},#{deleted},#{createTime},#{updateTime},#{contentId},#{index},#{blockId},#{host},#{baseDir},#{relativeDir},#{absolutePath},#{size},#{start},#{end})
|
|
|
</insert>
|
|
</insert>
|
|
|
<insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
|
|
<insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into data_block
|
|
insert into data_block
|
|
|
- (`id`,`deleted`,`create_time`,`update_time`,`content_id`,`index`,`block_id`,`host`,`absolute_path`,`size`,`start`,`end`)
|
|
|
|
|
|
|
+ (`id`,`deleted`,`create_time`,`update_time`,`content_id`,`index`,`block_id`,`host`,`base_dir`,`relative_dir`,`absolute_path`,`size`,`start`,`end`)
|
|
|
values
|
|
values
|
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
|
- (#{item.id},#{item.deleted},#{item.createTime},#{item.updateTime},#{item.contentId},#{item.index},#{item.blockId},#{item.host},#{item.absolutePath},#{item.size},#{item.start},#{item.end})
|
|
|
|
|
|
|
+ (#{item.id},#{item.deleted},#{item.createTime},#{item.updateTime},#{item.contentId},#{item.index},#{item.blockId},#{item.host},#{item.baseDir},#{item.relativeDir},#{item.absolutePath},#{item.size},#{item.start},#{item.end})
|
|
|
</foreach>
|
|
</foreach>
|
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
|
@@ -34,4 +34,32 @@
|
|
|
from data_block
|
|
from data_block
|
|
|
where content_id=#{contentId}
|
|
where content_id=#{contentId}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <select id="findSubDirCount" resultType="cn.reghao.oss.store.model.vo.SubDirCount">
|
|
|
|
|
+ select relative_dir,count(*) as total
|
|
|
|
|
+ from data_block
|
|
|
|
|
+ group by relative_dir
|
|
|
|
|
+ order by total asc
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <update id="updateParent">
|
|
|
|
|
+ update data_block
|
|
|
|
|
+ set relative_dir=#{relativeDir}
|
|
|
|
|
+ where id=#{id}
|
|
|
|
|
+ </update>
|
|
|
|
|
+ <update id="updateBatch">
|
|
|
|
|
+ update data_block
|
|
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
|
|
+ <trim prefix="relative_dir =case" suffix="end,">
|
|
|
|
|
+ <foreach collection="list" item="item" index="index">
|
|
|
|
|
+ when id=#{item.id} then #{item.relativeDir}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ id in
|
|
|
|
|
+ <foreach collection="list" item="item" separator="," open="(" close=")">
|
|
|
|
|
+ #{item.id}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </update>
|
|
|
</mapper>
|
|
</mapper>
|