auth-server-java/service/src/main/java/cn/bunny/services/controller/MessageReceivedController.java

94 lines
4.3 KiB
Java
Raw Normal View History

2024-11-01 00:09:11 +08:00
package cn.bunny.services.controller;
2024-11-04 01:10:47 +08:00
import cn.bunny.dao.dto.system.message.MessageReceivedDto;
import cn.bunny.dao.dto.system.message.MessageReceivedUpdateDto;
import cn.bunny.dao.dto.system.message.MessageUserDto;
2024-11-03 21:33:44 +08:00
import cn.bunny.dao.entity.system.Message;
2025-01-01 17:28:40 +08:00
import cn.bunny.dao.vo.result.PageResult;
import cn.bunny.dao.vo.result.Result;
import cn.bunny.dao.vo.result.ResultCodeEnum;
2024-11-03 21:33:44 +08:00
import cn.bunny.dao.vo.system.message.MessageReceivedWithMessageVo;
2024-11-04 01:10:47 +08:00
import cn.bunny.dao.vo.system.message.MessageUserVo;
import cn.bunny.services.service.MessageReceivedService;
2024-11-03 21:33:44 +08:00
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
2024-11-03 21:33:44 +08:00
import io.swagger.v3.oas.annotations.Parameter;
2024-11-02 17:03:38 +08:00
import io.swagger.v3.oas.annotations.tags.Tag;
2024-11-03 18:56:38 +08:00
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
2024-11-03 18:56:38 +08:00
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
import java.util.List;
2024-11-01 00:09:11 +08:00
/**
* <p>
* 前端控制器
2024-11-01 00:09:11 +08:00
* </p>
*
* @author Bunny
* @since 2024-10-31
*/
2024-11-04 14:49:30 +08:00
@Tag(name = "消息接收(用户消息)", description = "消息接收(用户消息)相关接口")
2024-11-01 00:09:11 +08:00
@RestController
2025-02-17 19:43:01 +08:00
@RequestMapping("/api/messageReceived")
2024-11-01 00:09:11 +08:00
public class MessageReceivedController {
@Autowired
private MessageReceivedService messageReceivedService;
2024-11-04 14:49:30 +08:00
@Operation(summary = "管理员分页查询用户消息", description = "管理员分页查询用户消息")
2024-11-03 21:33:44 +08:00
@GetMapping("getMessageReceivedList/{page}/{limit}")
public Mono<Result<PageResult<MessageReceivedWithMessageVo>>> getMessageReceivedList(
@Parameter(name = "page", description = "当前页", required = true)
@PathVariable("page") Integer page,
@Parameter(name = "limit", description = "每页记录数", required = true)
@PathVariable("limit") Integer limit,
2024-11-04 01:10:47 +08:00
MessageReceivedDto dto) {
2024-11-03 21:33:44 +08:00
Page<Message> pageParams = new Page<>(page, limit);
PageResult<MessageReceivedWithMessageVo> pageResult = messageReceivedService.getMessageReceivedList(pageParams, dto);
return Mono.just(Result.success(pageResult));
}
2024-11-04 14:49:30 +08:00
@Operation(summary = "管理员将用户消息标为已读", description = "管理员将用户消息标为已读")
2024-11-04 01:10:47 +08:00
@PutMapping("updateMarkMessageReceived")
public Mono<Result<String>> updateMarkMessageReceived(@Valid @RequestBody MessageReceivedUpdateDto dto) {
messageReceivedService.updateMarkMessageReceived(dto);
2024-11-03 21:33:44 +08:00
return Mono.just(Result.success());
}
2024-11-04 14:49:30 +08:00
@Operation(summary = "管理删除用户消息", description = "管理删除用户消息")
2024-11-03 21:33:44 +08:00
@DeleteMapping("deleteMessageReceivedByIds")
public Mono<Result<String>> deleteMessageReceivedByIds(@RequestBody List<Long> ids) {
messageReceivedService.deleteMessageReceivedByIds(ids);
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
}
2024-11-04 01:10:47 +08:00
@Operation(summary = "分页查询用户消息", description = "分页查询用户消息")
@GetMapping("noManage/getUserMessageList/{page}/{limit}")
public Mono<Result<PageResult<MessageUserVo>>> getUserMessageList(
@Parameter(name = "page", description = "当前页", required = true)
@PathVariable("page") Integer page,
@Parameter(name = "limit", description = "每页记录数", required = true)
@PathVariable("limit") Integer limit,
MessageUserDto dto) {
Page<Message> pageParams = new Page<>(page, limit);
PageResult<MessageUserVo> pageResult = messageReceivedService.getUserMessageList(pageParams, dto);
return Mono.just(Result.success(pageResult));
}
2024-11-03 18:56:38 +08:00
2024-11-03 21:33:44 +08:00
@Operation(summary = "用户将消息标为已读", description = "用户将消息标为已读")
2024-11-04 01:10:47 +08:00
@PutMapping("noManage/userMarkAsRead")
public Mono<Result<String>> userMarkAsRead(@Valid @RequestBody List<Long> ids) {
messageReceivedService.userMarkAsRead(ids);
2024-11-03 21:33:44 +08:00
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
}
2024-11-04 01:10:47 +08:00
@Operation(summary = "用户删除消息", description = "用户删除消息")
@DeleteMapping("noManage/deleteUserMessageByIds")
public Mono<Result<String>> deleteUserMessageByIds(@RequestBody List<Long> ids) {
messageReceivedService.deleteUserMessageByIds(ids);
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
2024-11-03 18:56:38 +08:00
}
2024-11-01 00:09:11 +08:00
}