| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?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.tnb.content.app.disk.db.mapper.DiskFileMapper">
- <insert id="save" useGeneratedKeys="true" keyProperty="id">
- insert into my_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
- (`channel_code`,`file_id`,`pid`,`path`,`filename`,`file_type`,`sha256sum`,`size`,`owner`)
- values
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.channelCode},#{item.fileId},#{item.pid},#{item.path},#{item.filename},#{item.fileType},#{item.sha256sum},#{item.size},#{item.owner})
- </foreach>
- </insert>
- <delete id="deleteByAlbumIdAndPostId">
- delete from my_disk_file
- where album_id=#{albumId} and post_id=#{postId}
- </delete>
- <select id="countByDiskQuery" resultType="java.lang.Integer">
- select count(*)
- from my_disk_file
- <where>
- deleted=0
- <if test="fileType != null">
- and file_type=#{fileType}
- </if>
- <if test="owner != null">
- and owner=#{owner}
- </if>
- <if test="pid != null">
- and pid=#{pid}
- </if>
- <if test="fileId != null">
- and file_id=#{fileId}
- </if>
- <if test="path != null">
- and path=#{path}
- </if>
- <if test="sha256sum != null">
- and sha256sum=#{sha256sum}
- </if>
- </where>
- </select>
- <select id="findDiskQueryByPage" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskFile">
- select *
- from my_disk_file
- <where>
- deleted=0
- <if test="diskQuery.fileType != null">
- and file_type=#{diskQuery.fileType}
- </if>
- <if test="diskQuery.owner != null">
- and owner=#{diskQuery.owner}
- </if>
- <if test="diskQuery.pid != null">
- and pid=#{diskQuery.pid}
- </if>
- <if test="diskQuery.fileId != null">
- and file_id=#{diskQuery.fileId}
- </if>
- <if test="diskQuery.path != null">
- and path=#{diskQuery.path}
- </if>
- <if test="diskQuery.sha256sum != null">
- and sha256sum=#{diskQuery.sha256sum}
- </if>
- </where>
- order by file_type,filename
- </select>
- <select id="findFileTypeCountByGroup" resultType="cn.reghao.tnb.content.app.disk.model.vo.DiskFileCount">
- select file,count(*) as total
- from my_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
- where file_id in
- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- </mapper>
|