From 2827166fc8bad2a49e0481b068f3bd72d0af0f76 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 13:46:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=91=8A=20=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=87=AA=E5=B7=B1=E7=9A=84=20=E8=B6=85?= =?UTF-8?q?=E7=AE=A1=E9=99=A4=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/sys/controller/NoticeController.java | 7 +++++ .../ningdatech/pmapi/sys/manage/NoticeManage.java | 31 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java index 92e42b4..3fcbbe8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java @@ -59,6 +59,13 @@ public class NoticeController { noticeManage.topped(id.getId()); } + @GetMapping("/list") + @ApiOperation("工作台公告列表(非编辑)") + public PageVo list(@RequestParam(required = false, defaultValue = "3") Integer limit, + @RequestParam(required = false) Integer type) { + return noticeManage.list(limit, type); + } + @GetMapping("/dashboard/list") @ApiOperation("工作台公告列表") public PageVo dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit, diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index f138d6b..4f5be93 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -121,6 +121,13 @@ public class NoticeManage { noticeService.updateById(notice); } + public PageVo list(Integer limit, Integer type) { + NoticeListReq req = new NoticeListReq(); + req.setPageSize(limit); + req.setEnabled(true); + req.setType(type); + return listByManagerByPermission(req); + } public PageVo dashboardList(Integer limit, Integer type) { NoticeListReq req = new NoticeListReq(); @@ -154,6 +161,30 @@ public class NoticeManage { return PageVo.of(tempDataList, page.getTotal()); } + public PageVo listByManagerByPermission(NoticeListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) + .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) + .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) + .eq(req.getType() != null, Notice::getType, req.getType()) + .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + permissionsWrapper(wrapper,user); + Page page = noticeService.page(req.page(), wrapper); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List tempDataList = CollUtils.convert(page.getRecords(), w -> NoticeListItemVO + .builder() + .id(w.getId()) + .type(w.getType()) + .title(w.getTitle()) + .enabled(w.getEnabled()) + .createOn(w.getCreateOn()) + .topped(w.getToppedTime() != null) + .build()); + return PageVo.of(tempDataList, page.getTotal()); + } + public Map> listToMapByManager(NoticeListReq req,UserFullInfoDTO user) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled())