标识所有未读资源为已读
This commit is contained in:
parent
36db201d67
commit
64e37fcbb8
|
@ -18,6 +18,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
@ -37,6 +38,8 @@ public class SysNoticeController {
|
||||||
private SysNoticeService sysNoticeService;
|
private SysNoticeService sysNoticeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNoticeUserService sysNoticeUserService;
|
private SysNoticeUserService sysNoticeUserService;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@ApiOperation("分页")
|
@ApiOperation("分页")
|
||||||
|
@ -92,6 +95,13 @@ public class SysNoticeController {
|
||||||
return new Result();
|
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")
|
@GetMapping("mynotice/unread")
|
||||||
@ApiOperation("我的通知未读数")
|
@ApiOperation("我的通知未读数")
|
||||||
public Result<Integer> unRead() {
|
public Result<Integer> unRead() {
|
||||||
|
|
Loading…
Reference in New Issue