Browse Source

没有文件时不进行附件查询

tags/24080901
WendyYang 1 year ago
parent
commit
15cda0c835
2 changed files with 10 additions and 4 deletions
  1. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java
  2. +5
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java

+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java View File

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.sys.controller;


import com.ningdatech.basic.model.IdVo; import com.ningdatech.basic.model.IdVo;
import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.sys.entity.req.NoticeListReq; import com.ningdatech.pmapi.sys.entity.req.NoticeListReq;
import com.ningdatech.pmapi.sys.entity.req.NoticeSaveReq; import com.ningdatech.pmapi.sys.entity.req.NoticeSaveReq;
import com.ningdatech.pmapi.sys.entity.req.NoticeStatusModifyReq; import com.ningdatech.pmapi.sys.entity.req.NoticeStatusModifyReq;
@@ -24,7 +25,7 @@ import javax.validation.Valid;
* @since 2022-07-21 * @since 2022-07-21
*/ */
@RestController @RestController
@Api(tags = "消息管理")
@Api(tags = "公告管理")
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/api/v1/notice") @RequestMapping("/api/v1/notice")
public class NoticeController { public class NoticeController {
@@ -33,6 +34,7 @@ public class NoticeController {


@PostMapping("/save") @PostMapping("/save")
@ApiOperation("新增通知") @ApiOperation("新增通知")
@WebLog("新增公告")
public IdVo<Long> save(@Valid @RequestBody NoticeSaveReq req) { public IdVo<Long> save(@Valid @RequestBody NoticeSaveReq req) {
return noticeManage.saveOrModify(req); return noticeManage.saveOrModify(req);
} }
@@ -45,6 +47,7 @@ public class NoticeController {


@PostMapping("/enabled") @PostMapping("/enabled")
@ApiOperation("启用禁用") @ApiOperation("启用禁用")
@WebLog("启用禁用")
public Boolean save(@Valid @RequestBody NoticeStatusModifyReq req) { public Boolean save(@Valid @RequestBody NoticeStatusModifyReq req) {
return noticeManage.changeEnabled(req); return noticeManage.changeEnabled(req);
} }
@@ -63,6 +66,7 @@ public class NoticeController {


@DeleteMapping("/del") @DeleteMapping("/del")
@ApiOperation("删除公告") @ApiOperation("删除公告")
@WebLog("删除公告")
public void delNotice(@RequestBody IdVo<Long> req) { public void delNotice(@RequestBody IdVo<Long> req) {
noticeManage.delNotice(req.getId()); noticeManage.delNotice(req.getId());
} }


+ 5
- 3
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java View File

@@ -50,8 +50,10 @@ public class NoticeManage {
Notice notice = noticeService.getById(id); Notice notice = noticeService.getById(id);
NoticeDetailVO detail = BeanUtil.copyProperties(notice, NoticeDetailVO.class); NoticeDetailVO detail = BeanUtil.copyProperties(notice, NoticeDetailVO.class);
List<Long> fileIds = BizUtils.splitToLong(notice.getAttachment()); List<Long> fileIds = BizUtils.splitToLong(notice.getAttachment());
List<AttachFileVo> attachFiles = fileService.getByIds(fileIds);
detail.setAttachments(attachFiles);
if (!fileIds.isEmpty()) {
List<AttachFileVo> attachFiles = fileService.getByIds(fileIds);
detail.setAttachments(attachFiles);
}
return detail; return detail;
} }


@@ -92,7 +94,7 @@ public class NoticeManage {
return PageVo.of(tempDataList, page.getTotal()); return PageVo.of(tempDataList, page.getTotal());
} }


public void delNotice(Long id){
public void delNotice(Long id) {
noticeService.removeById(id); noticeService.removeById(id);
} }




Loading…
Cancel
Save