Bläddra i källkod

公告 只能编辑自己的 超管除外

tags/24080901
PoffyZhang 1 år sedan
förälder
incheckning
2827166fc8
2 ändrade filer med 38 tillägg och 0 borttagningar
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java
  2. +31
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java Visa fil

@@ -59,6 +59,13 @@ public class NoticeController {
noticeManage.topped(id.getId());
}

@GetMapping("/list")
@ApiOperation("工作台公告列表(非编辑)")
public PageVo<NoticeListItemVO> list(@RequestParam(required = false, defaultValue = "3") Integer limit,
@RequestParam(required = false) Integer type) {
return noticeManage.list(limit, type);
}

@GetMapping("/dashboard/list")
@ApiOperation("工作台公告列表")
public PageVo<NoticeListItemVO> dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit,


+ 31
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java Visa fil

@@ -121,6 +121,13 @@ public class NoticeManage {
noticeService.updateById(notice);
}

public PageVo<NoticeListItemVO> list(Integer limit, Integer type) {
NoticeListReq req = new NoticeListReq();
req.setPageSize(limit);
req.setEnabled(true);
req.setType(type);
return listByManagerByPermission(req);
}

public PageVo<NoticeListItemVO> dashboardList(Integer limit, Integer type) {
NoticeListReq req = new NoticeListReq();
@@ -154,6 +161,30 @@ public class NoticeManage {
return PageVo.of(tempDataList, page.getTotal());
}

public PageVo<NoticeListItemVO> listByManagerByPermission(NoticeListReq req) {
LambdaQueryWrapper<Notice> 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<Notice> page = noticeService.page(req.page(), wrapper);
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<NoticeListItemVO> 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<String,List<NoticeListItemVO>> listToMapByManager(NoticeListReq req,UserFullInfoDTO user) {
LambdaQueryWrapper<Notice> wrapper = Wrappers.lambdaQuery(Notice.class)
.eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled())


Laddar…
Avbryt
Spara