You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
3.1 KiB
70 lines
3.1 KiB
<?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.jyjz.xiaoyao.ocr.dataDao.OcrMsgMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.ocr.dataobject.OcrMsg">
|
|
<id column="id" property="id" />
|
|
<result column="titile" property="titile" />
|
|
<result column="msg_content" property="msgContent" />
|
|
<result column="sender" property="sender" />
|
|
<result column="msg_category" property="msgCategory" />
|
|
<result column="receive_user_type" property="receiveUserType" />
|
|
<result column="bus_json" property="busJson" />
|
|
<result column="create_time" property="createTime" />
|
|
<result column="create_by" property="createBy" />
|
|
<result column="update_time" property="updateTime" />
|
|
<result column="update_by" property="updateBy" />
|
|
<result column="receive_user_ids" property="receiveUserIds" />
|
|
<result column="open_type" property="openType" />
|
|
<result column="open_page" property="openPage" />
|
|
<result column="send_status" property="sendStatus" />
|
|
<result column="send_time" property="sendTime" />
|
|
<result column="cancel_time" property="cancelTime" />
|
|
</resultMap>
|
|
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">
|
|
id, titile, msg_content AS msgContent, sender, msg_category AS msgCategory, receive_user_type AS receiveUserType, bus_json AS busJson, create_time AS createTime, create_by AS createBy, update_time AS updateTime, update_by AS updateBy, receive_user_ids AS receiveUserIds, open_type AS openType, open_page AS openPage, send_status AS sendStatus, send_time AS sendTime, cancel_time AS cancelTime
|
|
</sql>
|
|
|
|
<select id="selectPage" resultType="map">
|
|
SELECT
|
|
m.id as id,
|
|
m.titile as titile,
|
|
<if test='msgCategory == "2" '>"系统管理员" AS userName,</if>
|
|
m.bus_json AS busJson,
|
|
r.read_flag as readFlag,
|
|
m.send_time AS sendTime
|
|
FROM
|
|
ocr_msg m LEFT JOIN ocr_msg_read r ON m.id = r.msg_id
|
|
WHERE
|
|
m.msg_category = #{msgCategory}
|
|
AND m.send_status = '1'
|
|
AND (m.receive_user_type = 2 or FIND_IN_SET('${userid}', m.receive_user_ids))
|
|
order by CASE WHEN r.read_flag IS NULL THEN 0 ELSE 1 END,m.create_time desc
|
|
</select>
|
|
|
|
<select id="selectone" resultType="map">
|
|
SELECT
|
|
titile,
|
|
msg_content AS msgContent,
|
|
'系统管理员' AS userNcame,
|
|
sender,
|
|
msg_category AS msgCategory,
|
|
send_time AS sendTime
|
|
FROM
|
|
ocr_msg
|
|
WHERE
|
|
id = #{id}
|
|
</select>
|
|
|
|
<select id="selectUnreadMsgCount" resultType="int">
|
|
select count(om.id) from ocr_msg om
|
|
left join ocr_msg_read omr on om.id = omr.msg_id
|
|
where (om.receive_user_ids like CONCAT('%', #{userId}, '%') or om.receive_user_type = 2) and omr.read_flag is NULL
|
|
</select>
|
|
|
|
|
|
</mapper>
|