From 74cc2bb0e173acfa2871d22c998a0b095e172ee8 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 27 Aug 2021 13:25:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=9C=AA=E8=AF=BB=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E4=B8=80=E9=94=AE=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=B7=B2=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/controller/sys/MsgController.java | 7 ++++++- .../io/dataease/service/message/SysMsgService.java | 8 ++++++++ frontend/src/api/system/msg.js | 8 ++++++++ frontend/src/lang/en.js | 1 + frontend/src/lang/tw.js | 1 + frontend/src/lang/zh.js | 1 + frontend/src/views/msg/unread.vue | 10 ++++++++-- 7 files changed, 33 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/sys/MsgController.java b/backend/src/main/java/io/dataease/controller/sys/MsgController.java index 729edbae37..b100aea861 100644 --- a/backend/src/main/java/io/dataease/controller/sys/MsgController.java +++ b/backend/src/main/java/io/dataease/controller/sys/MsgController.java @@ -6,7 +6,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.base.domain.SysMsgChannel; import io.dataease.base.domain.SysMsgSetting; import io.dataease.base.domain.SysMsgType; -import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.PageUtils; import io.dataease.commons.utils.Pager; @@ -71,6 +70,12 @@ public class MsgController { sysMsgService.setBatchReaded(msgIds); } + @ApiOperation("全部设置已读") + @PostMapping("/allRead") + public void allRead() { + sysMsgService.setAllRead(); + } + @ApiOperation("批量删除") @PostMapping("/batchDelete") public void batchDelete(@RequestBody List msgIds) { diff --git a/backend/src/main/java/io/dataease/service/message/SysMsgService.java b/backend/src/main/java/io/dataease/service/message/SysMsgService.java index 798e0b42a2..4344b0e247 100644 --- a/backend/src/main/java/io/dataease/service/message/SysMsgService.java +++ b/backend/src/main/java/io/dataease/service/message/SysMsgService.java @@ -312,4 +312,12 @@ public class SysMsgService { return sourceLists; } + public void setAllRead() { + SysMsg record = new SysMsg(); + record.setStatus(true); + SysMsgExample example = new SysMsgExample(); + example.createCriteria().andUserIdEqualTo(AuthUtils.getUser().getUserId()).andStatusEqualTo(false); + sysMsgMapper.updateByExampleSelective(record, example); + } + } diff --git a/frontend/src/api/system/msg.js b/frontend/src/api/system/msg.js index 45ac7c687b..4dc120ae61 100644 --- a/frontend/src/api/system/msg.js +++ b/frontend/src/api/system/msg.js @@ -35,6 +35,14 @@ export function batchRead(data) { }) } +export function allRead() { + return request({ + url: '/api/sys_msg/allRead', + method: 'post', + loading: true + }) +} + export function batchDelete(data) { return request({ url: '/api/sys_msg/batchDelete', diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 011ffcfa21..5cb0caf85a 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1351,6 +1351,7 @@ export default { read_time: 'Read Time', type: 'Message Type', mark_readed: 'Mark As Read', + all_mark_readed: 'Mark All As Read', please_select: 'Please select at least one message', mark_success: 'Mark read successfully', receive_manage: 'Receive Manage', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index f251e2d5a6..18808a6284 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1350,6 +1350,7 @@ export default { read_time: '查看時間', type: '消息類型', mark_readed: '標記已讀', + all_mark_readed: '全部已讀', please_select: '請至少選擇一條消息', mark_success: '標記已讀成功', receive_manage: '接收管理', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index add3e55efc..fdc3dbea72 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1353,6 +1353,7 @@ export default { read_time: '查看时间', type: '消息类型', mark_readed: '标记已读', + all_mark_readed: '全部已读', please_select: '请至少选择一条消息', mark_success: '标记已读成功', receive_manage: '接收管理', diff --git a/frontend/src/views/msg/unread.vue b/frontend/src/views/msg/unread.vue index 60b8c81c54..629b59f839 100644 --- a/frontend/src/views/msg/unread.vue +++ b/frontend/src/views/msg/unread.vue @@ -18,7 +18,7 @@ > { + this.$success(this.$t('webmsg.mark_success')) + this.search() + }) + }, markReaded() { if (this.multipleSelection.length === 0) { this.$warning(this.$t('webmsg.please_select'))