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;
|
|
|
|
import cn.bunny.dao.pojo.result.PageResult;
|
2024-11-01 16:40:45 +08:00
|
|
|
import cn.bunny.dao.pojo.result.Result;
|
2024-11-03 18:56:38 +08:00
|
|
|
import cn.bunny.dao.pojo.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;
|
2024-11-01 16:40:45 +08:00
|
|
|
import cn.bunny.services.service.MessageReceivedService;
|
2024-11-03 21:33:44 +08:00
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
2024-11-01 16:40:45 +08:00
|
|
|
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;
|
2024-11-01 16:40:45 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2024-11-03 18:56:38 +08:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
2024-11-01 16:40:45 +08:00
|
|
|
import reactor.core.publisher.Mono;
|
|
|
|
|
|
|
|
import java.util.List;
|
2024-11-01 00:09:11 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* <p>
|
2024-11-01 16:40:45 +08:00
|
|
|
* 前端控制器
|
2024-11-01 00:09:11 +08:00
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @author Bunny
|
|
|
|
* @since 2024-10-31
|
|
|
|
*/
|
2024-11-02 17:03:38 +08:00
|
|
|
@Tag(name = "消息接受关系", description = "消息接受关系相关接口")
|
2024-11-01 00:09:11 +08:00
|
|
|
@RestController
|
2024-11-01 16:40:45 +08:00
|
|
|
@RequestMapping("/admin/messageReceived")
|
2024-11-01 00:09:11 +08:00
|
|
|
public class MessageReceivedController {
|
|
|
|
|
2024-11-01 16:40:45 +08:00
|
|
|
@Autowired
|
|
|
|
private MessageReceivedService messageReceivedService;
|
|
|
|
|
2024-11-03 21:33:44 +08:00
|
|
|
@Operation(summary = "管理员管理用户消息接收分页查询", description = "管理员管理用户消息接收分页查询")
|
|
|
|
@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));
|
|
|
|
}
|
|
|
|
|
|
|
|
@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());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "管理删除用户接受的消息", description = "管理删除用户接受的消息")
|
|
|
|
@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-01 16:40:45 +08:00
|
|
|
}
|
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
|
|
|
}
|