xin
4 days ago 982313135d1c239fe3b20e4c5664781f92d40aca
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?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.oying.modules.message.mapper.MesMsgRecordMapper">
    <resultMap id="BaseResultMap" type="com.oying.modules.message.domain.MesMsgRecord">
        <id column="id" property="id"/>
        <result column="template_id" property="templateId"/>
        <result column="receiver_id" property="receiverId"/>
        <result column="platform" property="platform"/>
        <result column="msg_type" property="msgType"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
        <result column="biz_id" property="bizId"/>
        <result column="biz_type" property="bizType"/>
        <result column="is_read" property="isRead"/>
        <result column="read_time" property="readTime"/>
        <result column="extra" property="extra"/>
        <result column="create_by" property="createBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_by" property="updateBy"/>
        <result column="update_time" property="updateTime"/>
        <!-- 新增字段映射 -->
        <result column="order_id" property="orderId"/>
        <result column="buyer_id" property="buyerId"/>
        <result column="order_no" property="orderNo"/>
        <result column="shop_id" property="shopId"/>
        <result column="shop_name" property="shopName"/>
        <result column="rider_id" property="riderId"/>
        <result column="rider_name" property="riderName"/>
    </resultMap>
    <!-- 为 MesMsgRecordQueryPollDto 创建专门的 resultMap -->
    <resultMap id="PollResultMap" type="com.oying.modules.message.domain.myDto.MesMsgRecordQueryPollDto">
        <id column="id" property="id"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
    </resultMap>
    <!-- 为 MesMsgRecordQuerySystemDto 创建专门的 resultMap -->
    <resultMap id="SystemResultMap" type="com.oying.modules.message.domain.myDto.MesMsgRecordQuerySystemDto">
        <id column="id" property="id"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
    </resultMap>
 
 
 
 
    <sql id="Base_Column_List">
        id, template_id, receiver_id, platform, msg_type, title, content, biz_id, biz_type, is_read, read_time, extra, create_by, create_time, update_by, update_time
    </sql>
    <!-- 与 MesMsgRecordQueryPollDto 字段对应的 SQL 片段 -->
    <sql id="Poll_Column_List">
        id, title, content
    </sql>
    <!-- 与 MesMsgRecordQuerySystemDto 字段对应的 SQL 片段 -->
    <sql id="System_Column_List">
        id, title, content
    </sql>
    <update id="batchMarkRead">
        UPDATE mes_msg_record
        SET is_read = 1,
        read_time = NOW()
        WHERE id IN
        <foreach item="item" collection="msgIds" separator="," open="(" close=")">
            #{item}
        </foreach>
        AND platform = #{platform}
    </update>
 
    <select id="findAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from mes_msg_record
        <where>
        </where>
        order by id desc
    </select>
    <!-- 使用专门的 resultMap 进行映射 -->
    <select id="PollMes" parameterType="java.lang.Long" resultMap="PollResultMap">
        <!-- 根据平台 查询未读消息 -->
        select
        <include refid="Poll_Column_List"/>
        from mes_msg_record
        <where>
            <if test="platform != null">
                platform = #{platform}
            </if>
            and is_read = 0
        </where>
        order by id desc
    </select>
    <select id="queryAllSysNotice"
            resultMap="SystemResultMap">
        select
        <include refid="System_Column_List"/>
        from mes_msg_record
        <where>
#         系统1
        msg_type = 1
        </where>
        order by id desc
    </select>
    <select id="queryorder" resultType="com.oying.modules.message.domain.myDto.MesMsgRecordQueryOrderDto"
            parameterType="java.lang.Long">
#         根据店铺号 给出订单号与订单消息
        select  id,content,order_no
        from mes_msg_record
        <where>
            <if test="shopId != null">
                shop_id = #{shopId}
            </if>
        </where>
 
    </select>
</mapper>