<?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.ylx.massage.mapper.MomentMediaMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ylx.massage.domain.MomentMedia">
        <id column="id" property="id"/>
        <result column="moment_id" property="momentId"/>
        <result column="media_url" property="mediaUrl"/>
        <result column="media_type" property="mediaType"/>
        <result column="sort_order" property="sortOrder"/>
        <result column="create_time" property="createTime"/>
        <result column="file_size" property="fileSize"/>
        <result column="file_format" property="fileFormat"/>
    </resultMap>

    <!-- 根据动态ID查询媒体列表 -->
    <select id="selectMediaListByMomentId" resultMap="BaseResultMap">
        SELECT
            *
        FROM
            t_moment_media
        WHERE
            moment_id = #{momentId}
        ORDER BY
            sort_order ASC
    </select>

</mapper>
