|
@@ -1,18 +1,16 @@
|
|
package com.bosshand.virgo.controller;
|
|
package com.bosshand.virgo.controller;
|
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
-
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.bosshand.virgo.core.response.Response;
|
|
import com.bosshand.virgo.core.response.Response;
|
|
import com.bosshand.virgo.message.model.NotificationMessage;
|
|
import com.bosshand.virgo.message.model.NotificationMessage;
|
|
import com.bosshand.virgo.message.service.MessageService;
|
|
import com.bosshand.virgo.message.service.MessageService;
|
|
-
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(value = "message")
|
|
@RequestMapping(value = "message")
|
|
@@ -21,6 +19,17 @@ public class MessageController {
|
|
@Autowired
|
|
@Autowired
|
|
private MessageService messageService;
|
|
private MessageService messageService;
|
|
|
|
|
|
|
|
+ @ApiOperation("分页获取消息列表")
|
|
|
|
+ @RequestMapping(value = "/{currPage}/{pageSize}", method = RequestMethod.POST)
|
|
|
|
+ public Response list(@RequestBody NotificationMessage notificationMessage, @PathVariable int currPage, @PathVariable int pageSize) {
|
|
|
|
+ int totalCount = messageService.getTotalCount(notificationMessage);
|
|
|
|
+ List<NotificationMessage> dataList = messageService.getLimit(notificationMessage, currPage, pageSize);
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
+ result.put("dataList", dataList);
|
|
|
|
+ result.put("totalCount", totalCount);
|
|
|
|
+ return Response.ok(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation(value = "个人消息列表", notes = "个人消息列表")
|
|
@ApiOperation(value = "个人消息列表", notes = "个人消息列表")
|
|
@RequestMapping(value = "/{userId}", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/{userId}", method = RequestMethod.GET)
|
|
public Response getByUserId(@PathVariable long userId) {
|
|
public Response getByUserId(@PathVariable long userId) {
|