<?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.pz.system.mapper.SessionListMapper"> <resultMap type="com.pz.system.domain.SessionList" id="SessionListResult"> <result property="id" column="id"/> <result property="userId" column="user_id"/> <result property="toUserId" column="to_user_id"/> <result property="unReadCount" column="un_read_count"/> </resultMap> <update id="addUnReadCount"> UPDATE session_list SET un_read_count = un_read_count + 1 WHERE user_id = #{userId} AND to_user_id = #{toUserId} </update> <update id="delUnReadCount"> UPDATE session_list SET un_read_count = 0 WHERE user_id = #{fromUserId} AND to_user_id = #{toUserId} </update> <select id="selectIdByUser" resultType="java.lang.Integer"> SELECT id FROM session_list WHERE user_id = #{fromId} AND to_user_id = #{toId} or user_id = #{toId} AND to_user_id = #{fromId} </select> </mapper>