From 115e610fbebd2f711ad5e6a1c26b9a9747230928 Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Sun, 28 Apr 2024 09:53:41 +0800 Subject: [PATCH] '123' --- .../system/SysNoticeController.java | 4 +- .../ruoyi/system/domain/SysNoticeUser.java | 10 +++- .../ruoyi/system/mapper/SysNoticeMapper.java | 5 +- .../system/service/ISysNoticeService.java | 5 +- .../service/impl/SysNoticeServiceImpl.java | 7 ++- .../mapper/system/SysNoticeMapper.xml | 18 +++++-- .../src/layout/components/NavbarNotice.vue | 50 +++++++++++++++++-- 7 files changed, 78 insertions(+), 21 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index 8de16a1..5c5edcf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -137,7 +137,9 @@ public class SysNoticeController extends BaseController { String userName = getLoginUser().getUsername();//当前登陆者 String noticeType = sysNoticeUser.getNoticeType();//消息类型 - List list = noticeService.navbarNoticeMorelist(userName,noticeType); + sysNoticeUser.setCurrentUserName(userName); + sysNoticeUser.setNoticeType(noticeType); + List list = noticeService.navbarNoticeMorelist(sysNoticeUser); Map map = new HashMap<>(); List> listMap = new ArrayList>(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNoticeUser.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNoticeUser.java index fc2afa2..2f86879 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNoticeUser.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNoticeUser.java @@ -1,9 +1,11 @@ package com.ruoyi.system.domain; +import com.ruoyi.common.core.domain.BaseEntity; + import java.text.SimpleDateFormat; import java.util.Date; -public class SysNoticeUser { +public class SysNoticeUser extends BaseEntity { private Long noticeId; private String noticeTitle; @@ -14,6 +16,8 @@ public class SysNoticeUser { private String sendUser; private Date sendTime; + private String currentUserName;//当前用户 + public Long getNoticeId() { return noticeId; } @@ -51,4 +55,8 @@ public class SysNoticeUser { public void setSendTime(Date sendTime) { this.sendTime = sendTime; } public String getSendTimeFormat() { return new SimpleDateFormat("yyyy-MM-dd").format(sendTime); } + + public String getCurrentUserName() { return currentUserName; } + + public void setCurrentUserName(String currentUserName) { this.currentUserName = currentUserName; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java index 254877f..b1b06c2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java @@ -70,11 +70,10 @@ public interface SysNoticeMapper /** * 导航面板 消息通知-更多 - * @param userName - * @param noticeType + * @param sysNoticeUser * @return */ - List navbarNoticeMorelist(@Param("userName") String userName,@Param("noticeType") String noticeType); + List navbarNoticeMorelist(SysNoticeUser sysNoticeUser); /** * 批量插入消息-用户 中间表 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java index 6a35e03..ccba7b7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java @@ -69,11 +69,10 @@ public interface ISysNoticeService /** * 导航面板 消息通知-更多 - * @param userName - * @param noticeType + * @param sysNoticeUser * @return */ - List navbarNoticeMorelist(String userName, String noticeType); + List navbarNoticeMorelist(SysNoticeUser sysNoticeUser); /** * 批量插入消息-用户 中间表 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java index 52436ee..6262aba 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java @@ -126,13 +126,12 @@ public class SysNoticeServiceImpl implements ISysNoticeService /** * 导航面板 消息通知-更多 - * @param userName - * @param noticeType + * @param sysNoticeUser * @return */ @Override - public List navbarNoticeMorelist(String userName, String noticeType) { - return noticeMapper.navbarNoticeMorelist(userName,noticeType); + public List navbarNoticeMorelist(SysNoticeUser sysNoticeUser) { + return noticeMapper.navbarNoticeMorelist(sysNoticeUser); } /** diff --git a/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml index e12ddda..c08bc7c 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -92,10 +92,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" inner join sys_user_notice b on a.notice_id = b.noticeId and b.userId = #{userName} - and CONVERT(date, a.create_time) = CONVERT(date, GETDATE()) + and CONVERT(date, b.sendTime) = CONVERT(date, GETDATE()) and a.status = '0' and b.isRead = '0' - order by create_time desc + order by b.sendTime desc diff --git a/ruoyi-ui/src/layout/components/NavbarNotice.vue b/ruoyi-ui/src/layout/components/NavbarNotice.vue index c8b0132..0e8da9f 100644 --- a/ruoyi-ui/src/layout/components/NavbarNotice.vue +++ b/ruoyi-ui/src/layout/components/NavbarNotice.vue @@ -62,13 +62,31 @@
+ + + + + + 搜索 + 重置 + +

{{item.noticeTitle}}

-

{{item.sendUser}} 提交于 {{parseTime(item.sendTime, '{y}-{m}-{d} {h}:{i}:{s}')}}

+ {{item.sendUser}} 提交于 {{parseTime(item.sendTime, '{y}-{m}-{d} {h}:{i}:{s}')}} + {{item.isRead=='1'?'已读':'未读'}}
- 详情 + 详情
@@ -121,7 +139,10 @@ // 表单参数 form: {}, //查询参数 - queryParams:{} + queryParams:{}, + + // 日期范围 + dateRange: [], } }, mounted() { @@ -162,14 +183,35 @@ }, /** 显示更多消息 */ moreNote(noticeType){ + this.noteMore = []; this.queryParams.noticeType = noticeType; - navbarNoticeMorelist(this.queryParams).then(response => { + navbarNoticeMorelist(this.addDateRange(this.queryParams, this.dateRange)).then(response => { console.log(response) this.noteMoreTitle = noticeType=='1'?"系统通知消息":noticeType=='2'?"系统公告消息":"业务通知消息"; this.noteMoreVisible = true this.noteMore = response }); }, + /** 搜索按钮操作 */ + handleQuery() { + this.moreNote(this.queryParams.noticeType) + }, + /** 重置按钮操作 */ + resetQuery() { + this.dateRange = []; + this.resetForm("queryForm"); + this.handleQuery(); + }, + /**获取更多消息中详情*/ + clickMoreNote(data) { + getNavbarNotice(data.noticeId).then(response => { + this.form = response.data; + this.noteTitle = "消息详情" + this.noteVisible = true + this.moreNote(data.noticeType) + this.getList() + }); + }, initWebSocket() { var userName = this.$store.state.user.name;