标识所有未读资源为已读

This commit is contained in:
wangliwen 2022-06-21 19:09:49 +08:00
parent 36db201d67
commit 64e37fcbb8
1 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -37,6 +38,8 @@ public class SysNoticeController {
private SysNoticeService sysNoticeService;
@Autowired
private SysNoticeUserService sysNoticeUserService;
@Autowired
private JdbcTemplate jdbcTemplate;
@GetMapping("page")
@ApiOperation("分页")
@ -92,6 +95,13 @@ public class SysNoticeController {
return new Result();
}
@PutMapping("mynotice/readall")
@ApiOperation("标记我的所有未读通知为已读")
public Result readAll() {
jdbcTemplate.update(String.format("UPDATE sys_notice_user SET read_status = 1,read_date =NOW() WHERE receiver_id = %s AND read_status = 0;"), SecurityUser.getUserId().toString());
return new Result();
}
@GetMapping("mynotice/unread")
@ApiOperation("我的通知未读数")
public Result<Integer> unRead() {