From 73f23e669da5324dd94f12ce3a0f186e695bb4bf Mon Sep 17 00:00:00 2001 From: haotianmingyue <2421912570@qq.com> Date: Mon, 30 Dec 2024 16:43:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF--=E6=B7=BB=E5=8A=A0--?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=82=B9=E8=B5=9E=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/AppSystemController.java | 16 ++++ .../ruoyi/system/domain/dto/WorkLikeDto.java | 91 +++++++++++++++++++ .../mapper/SysUserNotificationMapper.java | 7 ++ .../system/service/ISysUserLikeService.java | 3 + .../service/ISysUserNotificationService.java | 5 + .../impl/SysUserNotificationServiceImpl.java | 9 ++ .../system/SysUserNotificationMapper.xml | 21 +++++ 7 files changed, 152 insertions(+) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/WorkLikeDto.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppSystemController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppSystemController.java index 008c7e41..2e32c23c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppSystemController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppSystemController.java @@ -1514,6 +1514,22 @@ public class AppSystemController extends BaseController { } + //消息--获取点赞列表 + @Transactional + @GetMapping("/getWorkLikeList") + public TableDataInfo getWorkLikeList() + { + Long userId = getUserId(); + + // 点了之后所有的点赞信息应该已读 + userNotificationService.readNotifiaction(userId, "2", "1"); + + // 先从系统通知中获取 + List addLikeList = userNotificationService.getWorkLikeList(userId); + return getDataTable(addLikeList); + + } + // 新增点赞信息 @GetMapping("/addLike/{workId}") @Transactional diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/WorkLikeDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/WorkLikeDto.java new file mode 100644 index 00000000..475fc6bd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/WorkLikeDto.java @@ -0,0 +1,91 @@ +package com.ruoyi.system.domain.dto; + +import java.util.Date; + +public class WorkLikeDto { + + private Long id; + private Long userId; + private String nickName; + private String avatar; + private Long workId; + private String workName; + private String workAddress; + private String detail; + + private Date createTime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public Long getWorkId() { + return workId; + } + + public void setWorkId(Long workId) { + this.workId = workId; + } + + public String getWorkName() { + return workName; + } + + public void setWorkName(String workName) { + this.workName = workName; + } + + public String getWorkAddress() { + return workAddress; + } + + public void setWorkAddress(String workAddress) { + this.workAddress = workAddress; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java index 690f1f47..20f0059a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java @@ -4,6 +4,7 @@ import java.util.Date; import java.util.List; import com.ruoyi.system.domain.SysUserNotification; import com.ruoyi.system.domain.dto.SysNotificationDto; +import com.ruoyi.system.domain.dto.WorkLikeDto; import org.apache.ibatis.annotations.Param; /** @@ -83,4 +84,10 @@ public interface SysUserNotificationMapper * 消息--查看系统消息 * */ public List getSystemMessage(Long userId); + + /* + + *消息--查看新增点赞消息 + */ + public List getWorkLikeList(Long userId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserLikeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserLikeService.java index bdbbdff5..2316a5ed 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserLikeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserLikeService.java @@ -2,6 +2,7 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.SysUserLike; +import com.ruoyi.system.domain.dto.WorkLikeDto; /** * 用户点赞Service接口 @@ -62,4 +63,6 @@ public interface ISysUserLikeService /* * 根据userId和用户作品id, 查询给这个用户点赞的消息*/ public List selectSysUserLikeByUserIdAndTargetId(Long userId); + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserNotificationService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserNotificationService.java index 9f0300d7..d829a135 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserNotificationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserNotificationService.java @@ -3,6 +3,7 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.SysUserNotification; import com.ruoyi.system.domain.dto.SysNotificationDto; +import com.ruoyi.system.domain.dto.WorkLikeDto; import com.ruoyi.system.domain.vo.UserMessageVo; /** @@ -85,4 +86,8 @@ public interface ISysUserNotificationService * */ public List getSystemMessage(Long userId); + /* + * 消息--查看点赞消息列表 + * */ + public List getWorkLikeList(Long userId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java index e224f064..8c39702a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java @@ -6,6 +6,7 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.system.domain.SysUserFollow; import com.ruoyi.system.domain.SysUserLike; import com.ruoyi.system.domain.dto.SysNotificationDto; +import com.ruoyi.system.domain.dto.WorkLikeDto; import com.ruoyi.system.domain.vo.UserMessageVo; import com.ruoyi.system.service.ISysUserFollowService; import com.ruoyi.system.service.ISysUserLikeService; @@ -189,4 +190,12 @@ public class SysUserNotificationServiceImpl implements ISysUserNotificationServi public List getSystemMessage(Long userId){ return sysUserNotificationMapper.getSystemMessage(userId); } + + /* + * 消息--查看点赞消息列表 + * */ + @Override + public List getWorkLikeList(Long userId){ + return sysUserNotificationMapper.getWorkLikeList(userId); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml index e8532687..261c82c7 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml @@ -25,6 +25,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + select id, user_id, sender_id, type, target_id, target_type, status, create_time, update_time , detail from sys_user_notification @@ -67,6 +80,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_user_notification where user_id = #{userId} and status = '0' and type = '2' + insert into sys_user_notification