<?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.ycl.jxkg.mapper.MessageUserMapper">
|
<resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.entity.MessageUser">
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
<result column="message_id" jdbcType="INTEGER" property="messageId"/>
|
<result column="receive_user_id" jdbcType="INTEGER" property="receiveUserId"/>
|
<result column="receive_user_name" jdbcType="VARCHAR" property="receiveUserName"/>
|
<result column="receive_real_name" jdbcType="VARCHAR" property="receiveRealName"/>
|
<result column="readed" jdbcType="BIT" property="readed"/>
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="read_time" jdbcType="TIMESTAMP" property="readTime"/>
|
</resultMap>
|
<sql id="Base_Column_List">
|
id
|
, message_id, receive_user_id, receive_user_name, receive_real_name, readed, create_time,
|
read_time
|
</sql>
|
|
<select id="selectByMessageIds" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from t_message_user
|
where message_id in
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
|
<insert id="inserts" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
insert into t_message_user (message_id, receive_user_id,
|
receive_user_name, receive_real_name, readed,
|
create_time)
|
values
|
<foreach collection="list" item="item" index="index"
|
separator=",">
|
(#{item.messageId,jdbcType=INTEGER}, #{item.receiveUserId,jdbcType=INTEGER},
|
#{item.receiveUserName,jdbcType=VARCHAR}, #{item.receiveRealName,jdbcType=VARCHAR},
|
#{item.readed,jdbcType=BIT},
|
#{item.createTime,jdbcType=TIMESTAMP})
|
</foreach>
|
</insert>
|
|
|
<select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.domain.vo.student.user.MessageRequestVO">
|
select
|
<include refid="Base_Column_List"/>
|
from t_message_user
|
where receive_user_id = #{receiveUserId}
|
</select>
|
|
|
<select id="unReadCount" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
select count(*)
|
from t_message_user
|
where readed = 'f'
|
and receive_user_id = #{userId}
|
</select>
|
</mapper>
|