xieb
2023-10-19 1dd5d8f8a616f5cf3caa7828d46989c7d3dcafc4
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
<?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="cn.gistack.sm.message.mapper.MessageRecordMapper">
    <!--namespace根据自己需要创建的的mapper的路径和名称填写-->
 
    <!--查询用户未读消息数量-->
    <select id="getNotReadNumber" resultType="java.lang.Integer">
        select count(*) from sm_message_record where is_deleted = 0 and status = 0 and recipient = #{userId}
    </select>
 
    <!--自定义分页列表-->
    <select id="selectMessageRecordPageList" resultType="cn.gistack.sm.message.vo.MessageRecordVO">
        select * from sm_message_record where is_deleted = 0
        <if test="messageRecord.status!=null">
            and status = #{messageRecord.status}
        </if>
        <if test="messageRecord.recipient!=null and messageRecord.recipient!=''">
            and recipient = #{messageRecord.recipient}
        </if>
        <if test="messageRecord.theme!=null and messageRecord.theme!=''">
            and theme like concat('%',#{messageRecord.recipient},'%')
        </if>
        <if test="messageRecord.content!=null and messageRecord.content!=''">
            and content like concat('%',#{messageRecord.content},'%')
        </if>
        <if test="messageRecord.source!=null and messageRecord.source!=''">
            and source = #{messageRecord.source}
        </if>
 
        <if test="messageRecord.createTime != null">
            AND DATE_FORMAT(create_time,'%Y-%m-%d')  = DATE_FORMAT(#{messageRecord.createTime},'%Y-%m-%d')
        </if>
 
 
        ORDER BY ID DESC
    </select>
</mapper>