Commit ed621bf1 by 段启岩

优化消息

parent cf1bc6d4
......@@ -14,10 +14,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import javax.validation.Valid;
/**
......@@ -55,7 +54,10 @@ public class MessageApi {
@ApiOperation("我的消息列表")
@GetMapping("/my/messages")
public Response<PageVO<Message>> getMyMessages(@Valid PageForm pageForm, @CurrentSubject Subject subject) {
public Response<?> getMyMessages(@Valid PageForm pageForm, BindingResult bindingResult, @CurrentSubject Subject subject) {
if (bindingResult.hasErrors()) {
return Response.fieldError(bindingResult.getFieldError());
}
// 根据用户获取列表并返回
IPage<Message> messageIPage = messageService.getMessagePage(pageForm.getPage(), pageForm.getSize(), (String) subject.getId());
PageVO<Message> messagePageVO = new PageVO<>(messageIPage);
......
......@@ -43,13 +43,6 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
update(updateWrapper);
}
/**
* 获取我的消息列表
* @param pageNumber
* @param pageSize
* @param userId
* @return IPage<Message>
*/
@Override
public IPage<Message> getMessagePage(Integer pageNumber, Integer pageSize, String userId) {
......@@ -66,7 +59,7 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
//1. 检测是否存在该消息
Message message =getById(messageId);
if (message == null) {
throw new MessageServiceException(MessageErrorCode.MESSAGE_NOT_EXISTS);
throw new MessageServiceException(MessageErrorCode.MESSAGE_NOT_EXIST);
}
//2. 返回消息详情
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment