| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?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="platform.modules.sys.dao.MessageDao">
- <!-- 查找对应单位的消息列表 -->
- <select id="findMessageList" resultType="platform.modules.sys.entity.Message">
- SELECT
- m.*,
- d.is_read as is_read,
- d.id as message_detail_id
- from c_message_detail d
- left join c_message m on d.message_id = m.id
- where m.del_flag=0 and d.del_flag=0
- <if test="push_id != null and push_id != '' and push_user_id != null and push_user_id != ''">
- and (d.push_id = #{push_id} or d.push_user_id = #{push_user_id})
- </if>
- <if test="push_id != null and push_id != '' and (push_user_id == null or push_user_id == '')">
- and d.push_id = #{push_id}
- </if>
- <if test="push_user_id != null and push_user_id != '' and (push_id == null or push_id == '')">
- and d.push_id = #{push_user_id}
- </if>
- <if test="push_user_type != null and push_user_type != ''">
- and d.user_type = #{push_user_type}
- </if>
- <if test="business_type != null and business_type != ''">
- and m.business_type = #{business_type}
- </if>
- <if test="keyword != null and keyword != ''">
- and m.title LIKE CONCAT ('%',#{keyword},'%')
- </if>
- <if test="is_read != null ">
- and d.is_read = #{is_read}
- </if>
- order by d.create_time desc
- </select>
- <!-- 首页查询我的消息列表 -->
- <select id="findMyMessageList" resultType="platform.modules.sys.entity.Message">
- SELECT
- m.*,
- d.is_read as is_read,
- d.id as message_detail_id
- from c_message_detail d
- left join c_message m on d.message_id = m.id
- where m.del_flag=0 and d.del_flag=0 and d.is_read = 0
- <if test="push_id != null and push_id != ''">
- and d.push_id = #{push_id}
- </if>
- <if test="push_user_id != null and push_user_id != ''">
- and d.push_id = #{push_user_id}
- </if>
- <if test="push_user_type != null and push_user_type != ''">
- and d.user_type = #{push_user_type}
- </if>
- order by d.create_time desc
- limit 0,5
- </select>
- <select id="findMyUnreadMessageList" resultType="platform.modules.sys.entity.Message">
- SELECT
- m.*
- from c_message_detail d
- left join c_message m on d.message_id = m.id
- where m.del_flag=0 and d.del_flag=0
- <if test="push_id != null and push_id != ''">
- and d.push_id = #{push_id}
- </if>
- <if test="push_user_id != null and push_user_id != ''">
- and d.push_id = #{push_user_id}
- </if>
- <if test="push_user_type != null and push_user_type != ''">
- and d.user_type = #{push_user_type}
- </if>
- and d.is_read = 0
- </select>
- <select id="selectByBusinessTypeAndApplyId" resultType="platform.modules.sys.entity.Message">
- SELECT
- *
- from c_message
- where business_type = #{businessType}
- and apply_id = #{applyId}
- </select>
- </mapper>
|