消息通知系统

This commit is contained in:
2024-08-15 16:25:44 +08:00
parent 704e3c25bf
commit 085dac0630
20 changed files with 768 additions and 136 deletions

View File

@@ -0,0 +1,20 @@
package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.Notification;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
public interface NotificationMapper extends CommonMapper<Notification> {
List<Map<String, Object>> getTypeCount(Long receiverId);
/** 解决mybatis-plus自动过滤 is_deleted为1的数据 问题 */
Notification getUniqueLikeAndFollow(String type, Long senderId, Long receiverId, Long portfolioId);
void updateUniqueLikeAndFollow(Long id, LocalDateTime time);
void deleteNotification(Long id, LocalDateTime time);
}

View File

@@ -0,0 +1,7 @@
package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.SysNotificationReadStatus;
public interface SysNotificationReadStatusMapper extends CommonMapper<SysNotificationReadStatus> {
}

View File

@@ -99,4 +99,9 @@ public class Account implements Serializable {
* 4 参加活动获取30天有效期和6000个积分的用户
*/
private Integer systemUser;
/**
* 头像
*/
private String avatar;
}

View File

@@ -0,0 +1,67 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@TableName("t_notification")
@Data
public class Notification extends BaseEntity{
/**
* 操作类型 system/like/comment/follow
*/
private String type;
/**
* 发起操作者用户id
*/
private Long senderId;
/**
* 被操作对象用户id
*/
private Long receiverId;
/**
* 点赞评论时的作品id
*/
private Long portfolioId;
/**
* 消息内容
*/
private String content;
/**
* 评论id
*/
private Long commentId;
/**
* 个人消息已读状态
*/
private Integer isRead;
/**
* 系统消息发布状态
*/
private Integer publishFlag;
/**
* 是否被删除
*/
private Integer isDeleted;
public Notification() {
}
public Notification(String type, Long senderId, Long receiverId, Long portfolioId) {
this.type = type;
this.senderId = senderId;
this.receiverId = receiverId;
this.portfolioId = portfolioId;
}
public Notification(String type, Long senderId, Long receiverId, Long portfolioId, String content, Long commentId) {
this.type = type;
this.senderId = senderId;
this.receiverId = receiverId;
this.portfolioId = portfolioId;
this.content = content;
this.commentId = commentId;
}
}

View File

@@ -0,0 +1,26 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = true)
@TableName("t_sys_notification_read_status")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysNotificationReadStatus extends BaseEntity{
/**
* 系统消息id
*/
private Long system_notification_id;
/**
* 已读当前消息的用户id将被存储
*/
private Long account_id;
}