| New file |
| | |
| | | <?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> |
| | | <!-- 使用Map作为参数类型,支持多参数传递 --> |
| | | <select id="PollMes" parameterType="map" resultMap="PollResultMap"> |
| | | <!-- 根据平台和消息类型查询未读消息 --> |
| | | select |
| | | <include refid="Poll_Column_List"/> |
| | | from mes_msg_record |
| | | <where> |
| | | <if test="platform != null"> |
| | | platform = #{platform} |
| | | </if> |
| | | <if test="msgType != null"> |
| | | and msg_type = #{msgType} |
| | | </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> |
| | | <select id="PollMesAll" parameterType="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="queryorderPending" |
| | | resultType="com.oying.modules.message.domain.myDto.MesMsgRecordQueryOrderDto" |
| | | parameterType="map"> |
| | | SELECT id, content, order_no |
| | | FROM mes_msg_record |
| | | WHERE content = #{content} |
| | | AND shop_id = #{shopId} |
| | | ORDER BY id DESC |
| | | </select> |
| | | <select id="queryBuyerOrderMessages" |
| | | resultType="com.oying.modules.message.domain.myDto.MesMsgRecordQueryOrderDto" |
| | | parameterType="java.lang.Long"> |
| | | select id, content, order_no |
| | | from mes_msg_record |
| | | where buyer_id = #{buyerId} |
| | | order by id desc |
| | | </select> |
| | | <select id="queryBuyerOrderMessagesComplete" |
| | | resultType="com.oying.modules.message.domain.myDto.MesMsgRecordQueryOrderDto" |
| | | parameterType="java.lang.Long"> |
| | | select id, content, order_no |
| | | from mes_msg_record |
| | | where buyer_id = #{buyerId} |
| | | and content = '订单完成' |
| | | order by id desc |
| | | </select> |
| | | |
| | | </mapper> |