fuliqi
2024-10-17 8546b3d285af4235a0ef615a0c6e89486ae2c806
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?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>