<?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.zhentao.mapper.CaseImageMapper">
    
    <!-- 根据案例ID查询图片列表 -->
    <select id="selectByCaseId" resultType="com.zhentao.entity.CaseImage">
        SELECT 
            image_id,
            case_id,
            timeline_id,
            image_url,
            image_desc,
            sort_order
        FROM case_image
        WHERE case_id = #{caseId}
        AND timeline_id IS NULL
        ORDER BY sort_order ASC
    </select>
    
    <!-- 根据时间线ID查询图片列表 -->
    <select id="selectByTimelineId" resultType="com.zhentao.entity.CaseImage">
        SELECT 
            image_id,
            case_id,
            timeline_id,
            image_url,
            image_desc,
            sort_order
        FROM case_image
        WHERE timeline_id = #{timelineId}
        ORDER BY sort_order ASC
    </select>
    
</mapper>

