Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
917f276a
Commit
917f276a
authored
Feb 22, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息列表更新
parent
fe04a6f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
6 deletions
+30
-6
src/main/java/cn/meteor/beyondclouds/modules/message/api/MessageApi.java
+5
-2
src/main/java/cn/meteor/beyondclouds/modules/message/service/IMessageService.java
+2
-3
src/main/java/cn/meteor/beyondclouds/modules/message/service/impl/MessageServiceImpl.java
+20
-1
src/main/resources/application.yml
+3
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/message/api/MessageApi.java
View file @
917f276a
...
...
@@ -56,12 +56,15 @@ public class MessageApi {
@ApiOperation
(
"我的消息列表"
)
@GetMapping
(
"/my/messages"
)
public
Response
<?>
getMyMessages
(
@Valid
PageForm
pageForm
,
BindingResult
bindingResult
,
@CurrentSubject
Subject
subject
)
{
public
Response
<?>
getMyMessages
(
@Valid
PageForm
pageForm
,
BindingResult
bindingResult
,
@CurrentSubject
Subject
subject
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
if
(
bindingResult
.
hasErrors
())
{
return
Response
.
fieldError
(
bindingResult
.
getFieldError
());
}
// 根据用户获取列表并返回
IPage
<
Message
>
messageIPage
=
messageService
.
getMessagePage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
());
IPage
<
Message
>
messageIPage
=
messageService
.
getMessagePage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
()
,
type
);
PageDTO
<
Message
>
messagePageDTO
=
new
PageDTO
<>(
messageIPage
);
return
Response
.
success
(
messagePageDTO
);
}
...
...
src/main/java/cn/meteor/beyondclouds/modules/message/service/IMessageService.java
View file @
917f276a
...
...
@@ -6,8 +6,6 @@ import cn.meteor.beyondclouds.modules.message.exception.MessageServiceException;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.io.Serializable
;
/**
* <p>
* 服务类
...
...
@@ -35,9 +33,10 @@ public interface IMessageService extends IService<Message> {
* @param pageNumber
* @param pageSize
* @param userId
* @param type
* @return
*/
IPage
<
Message
>
getMessagePage
(
Integer
pageNumber
,
Integer
pageSize
,
String
userId
);
IPage
<
Message
>
getMessagePage
(
Integer
pageNumber
,
Integer
pageSize
,
String
userId
,
String
type
);
/**
* 获取消息详情
...
...
src/main/java/cn/meteor/beyondclouds/modules/message/service/impl/MessageServiceImpl.java
View file @
917f276a
...
...
@@ -14,6 +14,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* <p>
* 服务实现类
...
...
@@ -44,11 +46,28 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
}
@Override
public
IPage
<
Message
>
getMessagePage
(
Integer
pageNumber
,
Integer
pageSize
,
String
userId
)
{
public
IPage
<
Message
>
getMessagePage
(
Integer
pageNumber
,
Integer
pageSize
,
String
userId
,
String
type
)
{
IPage
<
Message
>
page
=
new
Page
<>(
pageNumber
,
pageSize
);
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"to_id"
,
userId
);
if
(
null
!=
type
)
{
switch
(
type
)
{
case
"COMMENT"
:
messageQueryWrapper
.
in
(
"msg_type"
,
List
.
of
(
2
,
3
,
4
,
5
,
6
));
break
;
case
"PRAISE"
:
messageQueryWrapper
.
in
(
"msg_type"
,
List
.
of
(
7
));
break
;
case
"FOLLOW"
:
messageQueryWrapper
.
eq
(
"msg_type"
,
List
.
of
(
1
));
break
;
case
"NOTICE"
:
messageQueryWrapper
.
eq
(
"msg_type"
,
0
);
break
;
}
messageQueryWrapper
.
eq
(
"msg_type"
,
type
);
}
messageQueryWrapper
.
orderByDesc
(
"create_time"
);
return
page
(
page
,
messageQueryWrapper
);
}
...
...
src/main/resources/application.yml
View file @
917f276a
...
...
@@ -81,6 +81,9 @@ logging:
cn
:
meteor
:
beyondclouds
:
debug
com
:
corundumstudio
:
info
# 云里云外
beyondclouds
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment