|
@@ -55,13 +55,15 @@ public class MessageController {
|
|
|
return bl;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="消息列表")
|
|
|
- @RequestMapping(value = "list",method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value="消息分页列表")
|
|
|
+ @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "status",value = "状态(未读/已读)", required = false, paramType = "form",dataType = "Boolean")
|
|
|
+ @ApiImplicitParam(name = "status",value = "状态(未读false/已读true)", required = false, paramType = "form",dataType = "Boolean")
|
|
|
})
|
|
|
- public MessageResult<Map> list(@RequestParam(value="status",defaultValue="") Boolean status,
|
|
|
- HttpServletRequest request){
|
|
|
+ public MessageResult<Map> pageList(@RequestParam(value="status",defaultValue="") Boolean status,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ HttpServletRequest request){
|
|
|
AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
Company company = companyService.findByCreateBy(principal.getName());
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
@@ -76,7 +78,7 @@ public class MessageController {
|
|
|
searchParams.put("status",status);
|
|
|
}
|
|
|
|
|
|
- Page<Message> page = messageService.pageSearch(searchParams,1,1000,sortList);
|
|
|
+ Page<Message> page = messageService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|
|
@@ -85,11 +87,11 @@ public class MessageController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value="未读消息数量")
|
|
|
- @RequestMapping(value = "unReadCount",method = RequestMethod.POST)
|
|
|
- public MessageResult<Integer> unReadCount(HttpServletRequest request){
|
|
|
+ @GetMapping(value = "unReadCount")
|
|
|
+ public MessageResult<Long> unReadCount(HttpServletRequest request){
|
|
|
AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
Company company = companyService.findByCreateBy(principal.getName());
|
|
|
- MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
+ MessageResult<Long> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
searchParams.put("recipientId",company.getId());
|
|
@@ -98,10 +100,10 @@ public class MessageController {
|
|
|
sortList.add(new Sort("create_time","desc"));
|
|
|
searchParams.put("status",false);
|
|
|
|
|
|
- Page<Message> page = messageService.pageSearch(searchParams,1,1000,sortList);
|
|
|
+ Page<Message> page = messageService.pageSearch(searchParams,1,1,sortList);
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
- msgResult.setData(page.size());
|
|
|
+ msgResult.setData(page.getTotal());
|
|
|
|
|
|
return msgResult;
|
|
|
}
|