|
|
@@ -8,6 +8,7 @@
|
|
|
<result property="msgId" column="MSG_ID"/>
|
|
|
<result property="fromId" column="FROM_ID"/>
|
|
|
<result property="toId" column="TO_ID"/>
|
|
|
+ <result property="isRead" column="IS_READ"/>
|
|
|
<result property="msgType" column="MSG_TYPE"/>
|
|
|
<result property="content" column="CONTENT"/>
|
|
|
<result property="idIndex" column="ID_INDEX"/>
|
|
|
@@ -24,6 +25,7 @@
|
|
|
<where>
|
|
|
<if test="fromId != null ">and FROM_ID = #{fromId}</if>
|
|
|
<if test="toId != null ">and TO_ID = #{toId}</if>
|
|
|
+ <if test="isRead != null ">and IS_READ = #{isRead}</if>
|
|
|
<if test="msgType != null and msgType != ''">and MSG_TYPE = #{msgType}</if>
|
|
|
<if test="content != null and content != ''">and CONTENT = #{content}</if>
|
|
|
<if test="idIndex != null and idIndex != ''">and ID_INDEX = #{idIndex}</if>
|
|
|
@@ -36,25 +38,26 @@
|
|
|
where MSG_ID = #{msgId}
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectRecordList" resultType="com.doc.chat.domain.ChatMsg" parameterType="String">
|
|
|
- <include refid="selectChatMsgVo"/>
|
|
|
- where ID_INDEX = #{idIndex}
|
|
|
- order by CREATE_TIME desc
|
|
|
- </select>
|
|
|
<select id="selectFriendList" resultType="com.doc.chat.domain.ChatMsg">
|
|
|
<include refid="selectChatMsgVo"/>
|
|
|
where msg_id in (SELECT MAX(msg_id) msg_id
|
|
|
FROM chat_msg
|
|
|
- WHERE from_id = #{user_id} OR to_id = #{user_id}
|
|
|
+ WHERE from_id = #{user_id} OR (to_id = #{user_id} and is_read='Y')
|
|
|
GROUP BY id_index)
|
|
|
ORDER BY create_time desc,msg_id desc
|
|
|
</select>
|
|
|
+ <select id="selectRecordList" resultType="com.doc.chat.domain.ChatMsg">
|
|
|
+ <include refid="selectChatMsgVo"/>
|
|
|
+ where id_index=#{idIndex} and(from_id=#{fromId} or (is_read='Y' and to_id=#{fromId}))
|
|
|
+ order by CREATE_TIME desc
|
|
|
+ </select>
|
|
|
|
|
|
<insert id="insertChatMsg" parameterType="ChatMsg" useGeneratedKeys="true" keyProperty="msgId">
|
|
|
insert into chat_msg
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="fromId != null">FROM_ID,</if>
|
|
|
<if test="toId != null">TO_ID,</if>
|
|
|
+ <if test="isRead != null">IS_READ,</if>
|
|
|
<if test="msgType != null">MSG_TYPE,</if>
|
|
|
<if test="content != null">CONTENT,</if>
|
|
|
<if test="idIndex != null">ID_INDEX,</if>
|
|
|
@@ -63,6 +66,7 @@
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="fromId != null">#{fromId},</if>
|
|
|
<if test="toId != null">#{toId},</if>
|
|
|
+ <if test="isRead != null">#{isRead},</if>
|
|
|
<if test="msgType != null">#{msgType},</if>
|
|
|
<if test="content != null">#{content},</if>
|
|
|
<if test="idIndex != null">#{idIndex},</if>
|
|
|
@@ -75,6 +79,7 @@
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="fromId != null">FROM_ID = #{fromId},</if>
|
|
|
<if test="toId != null">TO_ID = #{toId},</if>
|
|
|
+ <if test="isRead != null">IS_READ=#{isRead},</if>
|
|
|
<if test="msgType != null">MSG_TYPE = #{msgType},</if>
|
|
|
<if test="content != null">CONTENT = #{content},</if>
|
|
|
<if test="idIndex != null">ID_INDEX = #{idIndex},</if>
|