From 7fb7b39bedae57a957be706bc9b866d89f7316f2 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期三, 26 八月 2026 14:28:02 +0800
Subject: [PATCH] feat: 添加清除当前用户的所有消息接口
---
src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java | 41 +++++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java b/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
index 40458bf..f08099f 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
@@ -14,6 +14,7 @@
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysNotice;
import com.ruoyi.project.system.service.ISysNoticeService;
@@ -50,50 +51,54 @@
* 鏍规嵁閫氱煡鍏憡缂栧彿鑾峰彇璇︾粏淇℃伅
*/
@GetMapping(value = "/{noticeId}")
- public R<?> getInfo(@PathVariable Long noticeId) {
- return R.ok(noticeService.selectNoticeById(noticeId));
+ public AjaxResult getInfo(@PathVariable Long noticeId) {
+ return success(noticeService.selectNoticeById(noticeId));
}
/**
* 鏂板閫氱煡鍏憡
*/
@PostMapping
- public R<?> add(@Validated @RequestBody SysNotice notice) {
- noticeService.insertNotice(notice);
- return R.ok();
+ public AjaxResult add(@Validated @RequestBody SysNotice notice) {
+ return toAjax(noticeService.insertNotice(notice));
}
/**
* 淇敼閫氱煡鍏憡
*/
@PutMapping
- public R<?> edit(@Validated @RequestBody SysNotice notice) {
- noticeService.updateNotice(notice);
- return R.ok();
+ public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
+ return toAjax(noticeService.updateNotice(notice));
}
/**
* 鍒犻櫎閫氱煡鍏憡
*/
@DeleteMapping("/{noticeIds}")
- public R<?> remove(@PathVariable Long[] noticeIds) {
- noticeService.deleteNoticeByIds(noticeIds);
- return R.ok();
+ public AjaxResult remove(@PathVariable Long[] noticeIds) {
+ return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
/**
* 涓�閿凡璇�
*/
@PostMapping("/readAll")
- public R<?> readAll() {
- noticeService.readAll();
- return R.ok();
+ public AjaxResult readAll() {
+ return toAjax(noticeService.readAll());
+ }
+
+ /**
+ * 娓呴櫎褰撳墠鐧诲綍鐢ㄦ埛鐨勫叏閮ㄦ秷鎭�
+ */
+ @DeleteMapping("/clearAll")
+ public R clearAll() {
+ return R.ok(noticeService.clearAll());
}
@PostMapping("appReadNotice")
@Operation(summary = "绉诲姩绔牴鎹秷鎭疘D杩涜宸茶")
- public R<?> appReadNotice(@RequestParam("noticeId") Long noticeId) {
- noticeService.appReadNotice(noticeId);
- return R.ok();
+ public AjaxResult appReadNotice(@RequestParam("noticeId") Long noticeId) {
+ boolean result = noticeService.appReadNotice(noticeId);
+ return toAjax(result);
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3