1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

add the function of deleteNoticeType and modify the router of notice.ts

This commit is contained in:
cccccyb
2023-05-25 01:27:57 +08:00
parent c060a762af
commit 16325f21de
10 changed files with 243 additions and 165 deletions

View File

@@ -35,7 +35,7 @@ public class NoticeController {
//根据公告id查公告信息及发布人
@GetMapping("/{nid}")
public ResponseResult selectByNoticeId(@PathVariable Long nid) {
public ResponseResult<Notice> selectByNoticeId(@PathVariable Long nid) {
Notice noticeById = noticeService.selectByNoticeId(nid);
Integer code = noticeById != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
String msg = noticeById != null ? "" : "数据查询失败,请重试!";
@@ -44,7 +44,7 @@ public class NoticeController {
//查询所有公告或模糊查询
@GetMapping
public ResponseResult selectAllNotice(String title, String type, String startTime, String endTime) {
public ResponseResult<List<Notice>> selectAllNotice(String title, String type, String startTime, String endTime) {
List<Notice> noticeList;
if (!StringUtils.hasText(title) && !StringUtils.hasText(type) && !StringUtils.hasText(startTime) && !StringUtils.hasText(endTime)) {
noticeList = noticeService.selectAllNotice();
@@ -59,7 +59,7 @@ public class NoticeController {
//根据登录用户id查询所接收的公告
@GetMapping("/self")
public ResponseResult selectByUserId(Integer readStatus) {
public ResponseResult<List<Notice>> selectByUserId(Integer readStatus) {
List<Notice> noticesByUserId = noticeReceiveService.selectByUserId(readStatus);
Integer code = noticesByUserId != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
String msg = noticesByUserId != null ? "" : "数据查询失败,请重试!";
@@ -68,52 +68,52 @@ public class NoticeController {
//修改登录用户所接收公告的阅读状态
@PutMapping("/modify_notice_read")
public ResponseResult modifyNoticeIsRead(@RequestBody Notice notice) {
public ResponseResult<?> modifyNoticeIsRead(@RequestBody Notice notice) {
boolean updateById = false;
if (null != notice) {
updateById = noticeReceiveService.modifyNoticeIsRead(notice);
}
String msg = updateById ? "" : "服务器出错,请重试!";
return ResponseResult.build(updateById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, updateById);
return ResponseResult.build(updateById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, null);
}
//更新公告
@PutMapping
public ResponseResult updateNotice(@RequestBody Notice notice) {
public ResponseResult<?> updateNotice(@RequestBody Notice notice) {
boolean updateById = noticeService.updateNotice(notice);
String msg = updateById ? "" : "数据修改失败,请重试!";
return ResponseResult.build(updateById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, updateById);
return ResponseResult.build(updateById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, null);
}
//修改公告置顶状态
@PutMapping("/update_notice_top")
public ResponseResult updateNoticeTop(@RequestBody Notice notice) {
public ResponseResult<?> updateNoticeTop(@RequestBody Notice notice) {
String operationMessage = notice.getTop() == 1 ? "取消置顶" : "置顶";
boolean updateResult = noticeService.updateNoticeTop(notice);
String msg = updateResult ? "已成功" + operationMessage : operationMessage + "失败,请重试!";
return ResponseResult.build(updateResult ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, updateResult);
return ResponseResult.build(updateResult ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, null);
}
//添加公告
@PostMapping
public ResponseResult addNotice(@RequestBody Notice notice) {
public ResponseResult<?> addNotice(@RequestBody Notice notice) {
Boolean insertNotice = noticeService.addNotice(notice);
String msg = insertNotice ? "" : "数据添加失败,请重试!";
return ResponseResult.build(insertNotice ? ResponseCode.DATABASE_SAVE_OK : ResponseCode.DATABASE_SAVE_ERROR, msg, insertNotice);
return ResponseResult.build(insertNotice ? ResponseCode.DATABASE_SAVE_OK : ResponseCode.DATABASE_SAVE_ERROR, msg,null);
}
//删除公告
@DeleteMapping("/{nid}")
public ResponseResult deleteByNoticeId(@PathVariable Long nid) {
public ResponseResult<?> deleteByNoticeId(@PathVariable Long nid) {
boolean removeById = noticeService.deleteById(nid);
String msg = removeById ? "" : "数据删除失败,请重试!";
return ResponseResult.build(removeById ? ResponseCode.DATABASE_DELETE_OK : ResponseCode.DATABASE_DELETE_ERROR, msg, removeById);
return ResponseResult.build(removeById ? ResponseCode.DATABASE_DELETE_OK : ResponseCode.DATABASE_DELETE_ERROR, msg, null);
}
//分页查询所有公告或分页模糊查询
@GetMapping("/page")
public ResponseResult selectPageAllNotice(Integer currentPage, Integer pageSize, String title, String type, String startTime, String endTime) {
public ResponseResult<List<Notice>> selectPageAllNotice(Integer currentPage, Integer pageSize, String title, String type, String startTime, String endTime) {
IPage<Notice> noticePageList;
Page<?> page = new Page();
if (null != currentPage && null != pageSize) {