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

use pinia to modify notice update function and add pagination to noticeManage page

This commit is contained in:
cccccyb
2023-05-14 22:00:59 +08:00
parent 4a00d46983
commit f309bd7bb9
11 changed files with 331 additions and 162 deletions

View File

@@ -1,5 +1,7 @@
package com.cfive.pinnacle.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cfive.pinnacle.entity.Notice;
import com.cfive.pinnacle.entity.NoticeReceive;
import com.cfive.pinnacle.entity.common.ResponseCode;
@@ -40,7 +42,7 @@ public class NoticeController {
return ResponseResult.build(code, msg, noticeById);
}
//查询所有公告
//查询所有公告或模糊查询
@GetMapping
public ResponseResult selectAllNotice(String title, String type, String startTime, String endTime) {
List<Notice> noticeList;
@@ -88,4 +90,27 @@ public class NoticeController {
return ResponseResult.build(removeById ? ResponseCode.DATABASE_DELETE_OK : ResponseCode.DATABASE_DELETE_ERROR, msg, removeById);
}
//分页查询所有公告或分页模糊查询
@GetMapping("/page")
public ResponseResult 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){
page.setCurrent(currentPage.intValue());
page.setSize(pageSize.intValue());
}else {
// 不进行分页
page.setCurrent(1);
page.setSize(-1);
}
if (!StringUtils.hasText(title) && !StringUtils.hasText(type) && !StringUtils.hasText(startTime) && !StringUtils.hasText(endTime)) {
noticePageList = noticeService.selectPageAllNotice(page);
} else {
noticePageList = noticeService.selectPageByCond(page,title, type, startTime, endTime);
}
int code = noticePageList.getRecords() != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
String msg = noticePageList.getRecords() != null ? String.valueOf(noticePageList.getTotal()) : "数据查询失败,请尝试!";
return ResponseResult.build(code, msg, noticePageList.getRecords());
}
}