seatonwan9
2025-08-14 e4f9152bcacf02be0cb376dcb225eaf444b8951b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?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.webmanage.mapper.OrderAttachmentMapper">
 
    <!-- 基础结果映射 -->
    <resultMap id="BaseResultMap" type="com.webmanage.entity.OrderAttachment">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="order_id" property="orderId" jdbcType="VARCHAR"/>
        <result column="file_name" property="fileName" jdbcType="VARCHAR"/>
        <result column="original_name" property="originalName" jdbcType="VARCHAR"/>
        <result column="file_type" property="fileType" jdbcType="VARCHAR"/>
        <result column="file_size" property="fileSize" jdbcType="BIGINT"/>
        <result column="file_url" property="fileUrl" jdbcType="VARCHAR"/>
        <result column="file_path" property="filePath" jdbcType="VARCHAR"/>
        <result column="bucket_name" property="bucketName" jdbcType="VARCHAR"/>
        <result column="object_name" property="objectName" jdbcType="VARCHAR"/>
        <result column="upload_user_id" property="uploadUserId" jdbcType="BIGINT"/>
        <result column="upload_user_name" property="uploadUserName" jdbcType="VARCHAR"/>
        <result column="attachment_type" property="attachmentType" jdbcType="VARCHAR"/>
        <result column="description" property="description" jdbcType="LONGVARCHAR"/>
        <result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
        <result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP"/>
        <result column="deleted" property="deleted" jdbcType="INTEGER"/>
    </resultMap>
 
    <!-- 基础字段列表 -->
    <sql id="Base_Column_List">
        id, order_id, file_name, original_name, file_type, file_size, file_url, file_path,
        bucket_name, object_name, upload_user_id, upload_user_name, attachment_type,
        description, created_at, updated_at, deleted
    </sql>
 
    <!-- 根据订单ID查询订单附件列表 -->
    <select id="selectByOrderId" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM order_attachment
        WHERE deleted = 0 AND order_id = #{orderId}
        ORDER BY created_at ASC
    </select>
 
</mapper>