From 3af559c5e406339e6bd6aaf7db7773b9b8ffd058 Mon Sep 17 00:00:00 2001 From: cccccyb <995134776@qq.com> Date: Tue, 30 May 2023 03:09:15 +0800 Subject: [PATCH] delete the function of visitByMyself and optimize the loading of noticeReceiveBySelf --- .../pinnacle/service/impl/NoticeServiceImpl.java | 16 ++++++---------- ui/src/components/notice/NoticeCommitForm.vue | 7 ++----- ui/src/components/notice/NoticeViewCard.vue | 5 +++-- ui/src/pages/notice/AlReadView.vue | 3 ++- ui/src/pages/notice/AllReceiveNoticeView.vue | 7 ++++++- ui/src/pages/notice/NoticeManage.vue | 2 +- ui/src/pages/notice/ToReadView.vue | 3 ++- ui/src/store/notice.ts | 7 +++---- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeServiceImpl.java b/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeServiceImpl.java index 7fe5532..79b643b 100644 --- a/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeServiceImpl.java +++ b/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeServiceImpl.java @@ -69,13 +69,13 @@ public class NoticeServiceImpl extends ServiceImpl impleme public Boolean deleteById(Long nid) { LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); lqw.eq(NoticeReceive::getNoticeId, nid); - Boolean flag = noticeReceiveMapper.delete(lqw) > 0; + boolean flag = noticeReceiveMapper.delete(lqw) > 0; return flag && noticeMapper.deleteById(nid) > 0; } @Override public Boolean deleteBatchByIds(List noticeIds) { - Boolean flag = false; + boolean flag = false; for (Long nid : noticeIds) { LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); @@ -109,18 +109,12 @@ public class NoticeServiceImpl extends ServiceImpl impleme @Override public Boolean addNotice(Notice notice) { - Boolean noticeFlag, noticeRecFlag = false; + boolean noticeFlag, noticeRecFlag = false; notice.setSenderId(WebUtil.getLoginUser().getUser().getId()); // notice.setSenderId(1652714496280469506L); noticeFlag = noticeMapper.insert(notice) > 0; Long noticeId = notice.getId(); - if (notice.getReceivers().size() == 0) { - //该公告仅发布者自己可见 - NoticeReceive noticeReceive = new NoticeReceive(); - noticeReceive.setNoticeId(noticeId); - noticeReceive.setUserId(WebUtil.getLoginUser().getUser().getId()); - noticeRecFlag = noticeReceiveMapper.insert(noticeReceive) > 0; - } else { + if (notice.getReceivers().size() != 0) { for (Long receiveId : notice.getReceivers()) { NoticeReceive noticeReceive = new NoticeReceive(); @@ -131,6 +125,8 @@ public class NoticeServiceImpl extends ServiceImpl impleme break; } } + } else { + noticeFlag = false; } return noticeFlag && noticeRecFlag; } diff --git a/ui/src/components/notice/NoticeCommitForm.vue b/ui/src/components/notice/NoticeCommitForm.vue index a0dea39..9b13cc5 100644 --- a/ui/src/components/notice/NoticeCommitForm.vue +++ b/ui/src/components/notice/NoticeCommitForm.vue @@ -63,10 +63,7 @@ size="large" /> - - - - + 0) { for (let i = 0; i < this.addData.receivers.length; i++) { receiveId.push(this.addData.receivers[i][1]) } diff --git a/ui/src/components/notice/NoticeViewCard.vue b/ui/src/components/notice/NoticeViewCard.vue index 16caf0f..839a2f1 100644 --- a/ui/src/components/notice/NoticeViewCard.vue +++ b/ui/src/components/notice/NoticeViewCard.vue @@ -1,5 +1,5 @@ diff --git a/ui/src/pages/notice/NoticeManage.vue b/ui/src/pages/notice/NoticeManage.vue index f5115fc..6f41e24 100644 --- a/ui/src/pages/notice/NoticeManage.vue +++ b/ui/src/pages/notice/NoticeManage.vue @@ -111,7 +111,7 @@ export default { message: '删除成功.', type: 'success' }) - noticeStore.selectAllNotice(1, 5) + noticeStore.selectAllNotice(this.currentPage, this.pageSize) } else if (response.data.code === 20034) { ElMessage({ message: response.data.msg, diff --git a/ui/src/pages/notice/ToReadView.vue b/ui/src/pages/notice/ToReadView.vue index 77d6823..ab014a5 100644 --- a/ui/src/pages/notice/ToReadView.vue +++ b/ui/src/pages/notice/ToReadView.vue @@ -10,10 +10,11 @@ export default { }, methods: {}, mounted() { - noticeStore.selectAllNoticeSelf(0) noticeStore.$patch((state) => { + state.showLoading = true state.currentViewPage = 'ToRead' }) + noticeStore.selectAllNoticeSelf(0) } } diff --git a/ui/src/store/notice.ts b/ui/src/store/notice.ts index 15715ed..a4cbbab 100644 --- a/ui/src/store/notice.ts +++ b/ui/src/store/notice.ts @@ -76,6 +76,7 @@ export const useNoticeStore = defineStore('notice', { } ], loading: true, + showLoading: true, dialogShowVisible: false, dialogAddVisible: false, dialogEditVisible: false, @@ -143,11 +144,9 @@ export const useNoticeStore = defineStore('notice', { .then((response) => { if (response.data.code === 20021) { this.selectData = response.data.data - if (this.selectData.length !== 0) { - this.loading = false - } + this.showLoading = false } else { - this.loading = false + this.showLoading = false ElMessage({ message: response.data.msg, type: 'error'