| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?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="cn.reghao.oss.store.db.mapper.DataBlockMapper">
- <insert id="save" useGeneratedKeys="true" keyProperty="id">
- insert into data_block
- (`content_id`,`block_id`,`host`,`absolute_path`,`size`)
- values
- (#{contentId},#{blockId},#{host},#{absolutePath},#{size})
- </insert>
- <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
- insert into data_block
- (`content_id`,`block_id`,`host`,`absolute_path`,`size`)
- values
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.contentId},#{item.blockId},#{item.host},#{item.absolutePath},#{item.size})
- </foreach>
- </insert>
- <delete id="delete">
- delete from data_block
- where content_id=#{contentId}
- </delete>
- <select id="findDataBlocks" resultType="cn.reghao.oss.store.model.po.DataBlock">
- select *
- from data_block
- where id>#{nextId}
- limit #{pageSize}
- </select>
- <select id="findByContentId" resultType="cn.reghao.oss.store.model.po.DataBlock">
- select *
- from data_block
- where content_id=#{contentId}
- </select>
- <select id="findSubDirCount" resultType="cn.reghao.jutil.jdk.store.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>
|