update store diary attachment

This commit is contained in:
Timi
2026-09-01 14:06:13 +08:00
parent e59dc363f4
commit 9ba610de86
8 changed files with 81 additions and 7 deletions
@@ -1,6 +1,54 @@
<?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="com.imyeyu.api.modules.common.mapper.AttachmentMapper">
<select id="selectImageByBizIdList" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT
`ranked`.`id`,
`ranked`.`biz_type`,
`ranked`.`biz_id`,
`ranked`.`attach_type`,
`ranked`.`mongo_id`,
`ranked`.`title`,
`ranked`.`name`,
`ranked`.`mime_type`,
`ranked`.`metadata`,
`ranked`.`size`,
`ranked`.`md5`,
`ranked`.`uploader_ip`,
`ranked`.`is_destroyed`,
`ranked`.`created_at`,
`ranked`.`updated_at`,
`ranked`.`deleted_at`,
`ranked`.`destroy_at`
FROM (
SELECT
`attachment`.*,
ROW_NUMBER() OVER (
PARTITION BY `attachment`.`biz_id`
ORDER BY `attachment`.`created_at`, `attachment`.`id`
) AS `row_num`
FROM `attachment`
WHERE
`biz_type` = #{bizType}
<if test="bizIdList != null and !bizIdList.isEmpty()">
AND `biz_id` IN
<foreach collection="bizIdList" item="bizId" separator="," open="(" close=")">
#{bizId}
</foreach>
</if>
<if test="bizIdList == null or bizIdList.isEmpty()">
AND FALSE
</if>
AND `mime_type` LIKE "image/%"
AND `deleted_at` IS NULL
AND (`destroy_at` IS NULL OR UNIX_TIMESTAMP() &lt; `destroy_at`)
<if test="attachType != null and !attachType.isEmpty()">
AND `attach_type` = #{attachType}
</if>
) `ranked`
WHERE `ranked`.`row_num` = 1
ORDER BY `ranked`.`created_at`, `ranked`.`id`
</select>
<select id="selectAllByBizIdList" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT
*