add AttachmentVariant

This commit is contained in:
Timi
2026-08-21 23:43:40 +08:00
parent 3a3809b661
commit 2e9225852d
15 changed files with 827 additions and 258 deletions
@@ -26,33 +26,4 @@
</if>
ORDER BY `created_at`
</select>
<select id="selectThumb" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT
*
FROM
`attachment`
WHERE
biz_type = #{bizType}
AND biz_id = #{sourceId}
AND attach_type = 'THUMB'
<choose>
<when test="requestWidth != null">
AND JSON_EXTRACT(metadata, '$.requestWidth') = #{requestWidth}
</when>
<otherwise>
AND JSON_EXTRACT(metadata, '$.requestWidth') IS NULL
</otherwise>
</choose>
<choose>
<when test="requestHeight != null">
AND JSON_EXTRACT(metadata, '$.requestHeight') = #{requestHeight}
</when>
<otherwise>
AND JSON_EXTRACT(metadata, '$.requestHeight') IS NULL
</otherwise>
</choose>
AND is_destroyed = FALSE
AND UNIX_TIMESTAMP() * 1000 &lt; destroy_at
LIMIT 1
</select>
</mapper>