diff --git a/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java b/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java index 93de6ddf..cb7bf161 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java @@ -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 unRead() {