Files
timeline-server/timeline-user-service/src/main/resources/com/timeline/user/dao/FriendNotifyMapper.xml
jiangh277 4c7d59f87b init
2025-12-24 14:17:19 +08:00

32 lines
1.1 KiB
XML

<?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.timeline.user.dao.FriendNotifyMapper">
<insert id="insert" parameterType="com.timeline.user.entity.FriendNotify">
INSERT INTO friend_notify (from_user_id, to_user_id, type, status, content, create_time)
VALUES (#{fromUserId}, #{toUserId}, #{type}, #{status}, #{content}, #{createTime})
</insert>
<select id="selectUnread" resultType="com.timeline.user.entity.FriendNotify">
SELECT * FROM friend_notify
WHERE to_user_id = #{toUserId} AND status = 'unread'
ORDER BY create_time DESC
</select>
<select id="selectAllByUser" resultType="com.timeline.user.entity.FriendNotify">
SELECT * FROM friend_notify
WHERE to_user_id = #{toUserId}
ORDER BY create_time DESC
</select>
<update id="markRead">
UPDATE friend_notify
SET status = 'read', read_time = NOW()
WHERE id = #{id}
</update>
</mapper>