123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?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.ubitech.ttc.dao.ImMessageMapper">
- <!-- 开启二级缓存 -->
- <!--<cache type="org.mybatis.caches.ehcache.EhcacheCache">-->
- <!--<property name="timeToIdleSeconds" value="3600"/>-->
- <!--<property name="timeToLiveSeconds" value="3600"/>-->
- <!--<property name="maxEntriesLocalHeap" value="1000"/>-->
- <!--<property name="maxEntriesLocalDisk" value="10000000"/>-->
- <!--<property name="memoryStoreEvictionPolicy" value="LRU"/>-->
- <!--</cache>-->
- <select id="getUserMessage" resultType="cn.ubitech.ttc.model.im.IMMessageModel">
- SELECT i.*
- FROM (select *
- from im_message
- where userid = #{userid} and reciverid = #{reciverid} and type = #{type}
- and isactive = 1
- union select *
- from im_message
- where userid = #{reciverid} and reciverid = #{userid} and type = #{type} and isactive = 1) i
- <if test='snowflakeid != "0"'>
- where i.messageid < #{snowflakeid}
- </if>
- ORDER by i.messagetime DESC
- </select>
- <select id="getUserMessageCount" resultType="java.lang.Integer">
- SELECT count(*)
- from (
- SELECT i.*
- FROM (select *
- from im_message
- where userid = #{userid} and reciverid = #{reciverid} and type = #{type}
- and isactive = 1
- union select *
- from im_message
- where
- userid = #{userid} and reciverid = #{reciverid} and type = #{type} and isactive = 1) i
- <if test='snowflakeid != "0"'>
- where i.messageid < #{snowflakeid}
- </if>
- ) b
- </select>
- </mapper>
|