io.github.wslxm.springbootplus2.manage.sys.controller.SysMsgController Maven / Gradle / Ivy
The newest version!
package io.github.wslxm.springbootplus2.manage.sys.controller;
import io.github.wslxm.springbootplus2.core.base.model.BasePage;
import io.github.wslxm.springbootplus2.core.base.controller.BaseController;
import io.github.wslxm.springbootplus2.core.constant.BaseConstant;
import io.github.wslxm.springbootplus2.core.result.Result;
import io.github.wslxm.springbootplus2.manage.sys.model.dto.SysMsgDTO;
import io.github.wslxm.springbootplus2.manage.sys.model.query.SysMsgQuery;
import io.github.wslxm.springbootplus2.manage.sys.model.vo.next.SysMsgFindAllNumVO;
import io.github.wslxm.springbootplus2.manage.sys.model.vo.SysMsgVO;
import io.github.wslxm.springbootplus2.manage.sys.service.SysMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 订单-->及时消息通知表
*
* ::本代码由[兮家小二]提供的代码生成器生成,如有问题,请手动修改 ::作者CSDN:https://blog.csdn.net/qq_41463655
*
* @author wangsong
* @email [email protected]
* @date 2020-09-23 10:40:23
*/
@RestController
@RequestMapping(BaseConstant.Uri.API_ADMIN + "/sys/msg")
@Api(value = "SysMsgController", tags = "base--sys--消息通知")
public class SysMsgController extends BaseController {
@GetMapping(value = "/findPage")
@ApiOperation(value = "列表查询")
public Result> findPage(@ModelAttribute @Validated SysMsgQuery query) {
return Result.success(baseService.findPage(query));
}
@PostMapping
@ApiOperation(value = "添加/发送消息")
public Result insert(@RequestBody @Validated SysMsgDTO dto) {
dto.setIsWebsocket(true);
return Result.success(baseService.insert(dto));
}
@PutMapping(value = "/{id}/read")
@ApiOperation(value = "消息修改为已读")
public Result updRead(@PathVariable String id) {
Result result = Result.successUpdate(baseService.updRead(id));
result.setMsg("已读成功");
return result;
}
@ApiOperation(value = "查询未读数量(当前登录用户)")
@GetMapping(value = "/findUnreadNum")
public Result findUnreadNum() {
return Result.successFind(baseService.findUnreadNum());
}
@ApiOperation(value = "查询全部/已读/未读数量(当前登录用户)")
@GetMapping(value = "/findAllNum")
public Result findAllNum() {
return Result.successFind(baseService.findAllNum());
}
}