support add media thumb attachment

This commit is contained in:
Timi
2025-11-06 14:47:48 +08:00
parent c270ae177d
commit 2ba868b3b6
7 changed files with 318 additions and 40 deletions
@@ -2,15 +2,47 @@
<!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">
<sql id="table">attachment</sql>
<select id="listByAttachType" resultType="com.imyeyu.api.modules.common.entity.Attachment">
<select id="listByBizId" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT
*
FROM
<include refid="table" />
attachment
WHERE
biz_type = #{bizType}
AND biz_id = #{bizId}
<if test="attachTypes != null and 0 &lt; attachTypes.length">
<if test="bizId != null">
AND biz_id = #{bizId}
</if>
<if test="attachTypes != null and 0 &lt; attachTypes.size()">
AND attach_type IN
<foreach collection="attachTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND deleted_at IS NULL
AND destroy_at IS NULL
<if test="page != null">
<if test="page.orderMap != null and !page.orderMap.isEmpty()">
ORDER BY
<foreach collection="page.orderMap" index="key" item="value" separator=",">
${key} ${value}
</foreach>
</if>
LIMIT
#{page.offset},
#{page.limit}
</if>
</select>
<select id="countByBizId" resultType="long">
SELECT
COUNT(1)
FROM
attachment
WHERE
biz_type = #{bizType}
<if test="bizId != null">
AND biz_id = #{bizId}
</if>
<if test="attachTypes != null and 0 &lt; attachTypes.size()">
AND attach_type IN
<foreach collection="attachTypes" item="item" open="(" separator="," close=")">
#{item}
@@ -19,4 +51,23 @@
AND deleted_at IS NULL
AND destroy_at IS NULL
</select>
</mapper>
<select id="listByMd5s" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT
*
FROM
attachment
WHERE
biz_type = #{bizType}
<if test="bizId != null">
AND biz_id = #{bizId}
</if>
<if test="attachTypes != null and 0 &lt; attachTypes.size()">
AND attach_type IN
<foreach collection="attachTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND deleted_at IS NULL
AND destroy_at IS NULL
</select>
</mapper>