| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.basic.mapper.StorageBlobMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StorageBlob"> |
| | | <id column="id" property="id" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="key" property="key" /> |
| | | <result column="content_type" property="contentType" /> |
| | | <result column="original_filename" property="originalFilename" /> |
| | | <result column="bucket_filename" property="bucketFilename" /> |
| | | <result column="bucket_name" property="bucketName" /> |
| | | <result column="byte_size" property="byteSize" /> |
| | | </resultMap> |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StorageBlob"> |
| | | <id column="id" property="id"/> |
| | | <result column="resource_key" property="resourceKey"/> |
| | | <result column="content_type" property="contentType"/> |
| | | <result column="original_filename" property="originalFilename"/> |
| | | <result column="uid_filename" property="uidFilename"/> |
| | | <result column="byte_size" property="byteSize"/> |
| | | <result column="path" property="path"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, create_time, key, content_type, original_filename,bucket_filename,bucket_name, byte_size |
| | | </sql> |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, resource_key, content_type, original_filename, uid_filename, byte_size, path |
| | | </sql> |
| | | |
| | | </mapper> |
| | | <select id="selectOrphanBlobsByIdRange" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM storage_blob sb |
| | | LEFT JOIN storage_attachment sa |
| | | ON sa.storage_blob_id = sb.id |
| | | AND sa.deleted = 0 |
| | | WHERE sb.id <![CDATA[>]]> #{lastId} |
| | | AND sa.id IS NULL |
| | | ORDER BY sb.id ASC |
| | | LIMIT #{limit} |
| | | </select> |
| | | |
| | | <delete id="deleteByIdList"> |
| | | DELETE FROM storage_blob |
| | | WHERE id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectExistingUidFilenames" resultType="java.lang.String"> |
| | | SELECT uid_filename |
| | | FROM storage_blob |
| | | WHERE uid_filename IN |
| | | <foreach collection="fileNames" item="fileName" open="(" separator="," close=")"> |
| | | #{fileName} |
| | | </foreach> |
| | | </select> |
| | | |
| | | </mapper> |