Blame view

service-user/src/main/resources/mapper/property/MessageNotifyMapper.xml 1.55 KB
88e030b7   王彪总   init project
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
  <?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="MessageNotifyV1ServiceDaoImpl">
  
      <insert id="saveMessageNotify" parameterType="com.java110.po.property.MessageNotifyPo">
          INSERT INTO message_notify(id, user_id, title, content, msg_type, relate_id, is_read, create_time)
          VALUES(#{id}, #{userId}, #{title}, #{content}, #{msgType}, #{relateId}, 0, NOW())
      </insert>
  
      <update id="updateMessageRead" parameterType="map">
          UPDATE message_notify SET is_read = 1 WHERE id = #{id}
      </update>
  
      <select id="queryMessageNotifies" parameterType="map" resultType="map">
          SELECT * FROM message_notify WHERE 1=1
          <if test="userId != null and userId != ''">AND user_id = #{userId}</if>
          <if test="isRead != null and isRead != ''">AND is_read = #{isRead}</if>
          <if test="msgType != null and msgType != ''">AND msg_type = #{msgType}</if>
          ORDER BY create_time DESC
          <if test="page != null and page != '' and row != null and row != ''">
              LIMIT #{page}, #{row}
          </if>
      </select>
  
      <select id="queryMessageNotifiesCount" parameterType="map" resultType="map">
          SELECT COUNT(1) count FROM message_notify WHERE 1=1
          <if test="userId != null and userId != ''">AND user_id = #{userId}</if>
          <if test="isRead != null and isRead != ''">AND is_read = #{isRead}</if>
          <if test="msgType != null and msgType != ''">AND msg_type = #{msgType}</if>
      </select>
  
  </mapper>