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.

58 lines
2.3 KiB

6 years ago
<?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.ccsens.tall.persist.dao.SysOperationDao">
<resultMap id="MessageQuery" type="com.ccsens.tall.bean.vo.ProjectMessageVo$Query">
<result column="id" jdbcType="BIGINT" property="id"></result>
<result column="operation_id" jdbcType="BIGINT" property="operationId"></result>
<result column="send_type" jdbcType="TINYINT" property="sendType"></result>
<result column="read_status" jdbcType="TINYINT" property="readStatus"></result>
<result column="created_at" jdbcType="TIMESTAMP" property="createTime"></result>
<collection property="messages" select="queryContent" column="operation_id" javaType="java.util.List" ofType="com.ccsens.tall.bean.vo.MessageVo$Message">
<result column="content" jdbcType="VARCHAR" property="content"></result>
<result column="type" jdbcType="TINYINT" property="type"></result>
<result column="settings" jdbcType="VARCHAR" property="settings"></result>
</collection>
</resultMap>
<select id="queryUnreadNum" resultType="com.ccsens.tall.bean.vo.ProjectMessageVo$UnreadNum">
SELECT
count( * ) AS unreadNum
FROM
t_sys_operation o,
t_sys_message_send s
WHERE
o.id = s.operation_id
AND s.receiver_id = #{userId}
AND s.send_type = #{sendType}
AND s.init_read =0
AND s.rec_status = 0
AND o.rec_status = 0
</select>
<select id="queryMsg" resultMap="MessageQuery">
SELECT
id, operation_id, send_type, created_at, read_status
FROM
t_sys_message_send
WHERE
receiver_id = #{userId}
AND send_type = 0
AND rec_status = 0
ORDER BY
created_at DESC
</select>
<select id="queryContent" resultType="com.ccsens.tall.bean.vo.MessageVo$Message">
SELECT
content,
type,
settings
FROM
t_sys_operation_message
WHERE
operation_id = #{operationId}
AND rec_status = 0
ORDER BY
sort
</select>
</mapper>