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
aa83b3c1
Commit
aa83b3c1
authored
Feb 14, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/fix-issue#66'
parents
7633b498
94e94277
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
1 deletions
+68
-1
src/main/java/cn/meteor/beyondclouds/modules/message/api/MessageApi.java
+25
-1
src/main/java/cn/meteor/beyondclouds/modules/message/service/IMessageService.java
+15
-0
src/main/java/cn/meteor/beyondclouds/modules/message/service/impl/MessageServiceImpl.java
+28
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/message/api/MessageApi.java
View file @
aa83b3c1
...
...
@@ -64,7 +64,7 @@ public class MessageApi {
return
Response
.
success
(
messagePageDTO
);
}
@ApiOperation
(
"
消息详情
"
)
@ApiOperation
(
"
删除消息
"
)
@GetMapping
(
"/message/{messageId}"
)
public
Response
getTopic
(
@PathVariable
(
"messageId"
)
String
messageId
)
{
try
{
...
...
@@ -77,5 +77,29 @@ public class MessageApi {
}
@ApiOperation
(
"删除所有消息"
)
@DeleteMapping
(
"/message"
)
public
Response
delAllMessage
(
@CurrentSubject
Subject
subject
)
{
messageService
.
deleteAllMessage
((
String
)
subject
.
getId
());
return
Response
.
success
();
}
@ApiOperation
(
"删除消息"
)
@DeleteMapping
(
"/message/{messageId}"
)
public
Response
delMessage
(
@PathVariable
(
"messageId"
)
String
messageId
,
@CurrentSubject
Subject
subject
)
{
try
{
messageService
.
deleteMessage
(
messageId
,
(
String
)
subject
.
getId
());
return
Response
.
success
();
}
catch
(
MessageServiceException
e
)
{
e
.
printStackTrace
();
return
Response
.
error
(
e
);
}
}
}
src/main/java/cn/meteor/beyondclouds/modules/message/service/IMessageService.java
View file @
aa83b3c1
...
...
@@ -6,6 +6,8 @@ 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>
* 服务类
...
...
@@ -45,4 +47,17 @@ public interface IMessageService extends IService<Message> {
Message
getMessage
(
String
messageId
)
throws
MessageServiceException
;
/**
* 删除单个消息
* @param messageId
* @param userId
* @throws MessageServiceException
*/
void
deleteMessage
(
String
messageId
,
String
userId
)
throws
MessageServiceException
;
/**
* 删除所有消息
* @param userId
*/
void
deleteAllMessage
(
String
userId
);
}
src/main/java/cn/meteor/beyondclouds/modules/message/service/impl/MessageServiceImpl.java
View file @
aa83b3c1
...
...
@@ -65,4 +65,32 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
//2. 返回消息详情
return
message
;
}
@Override
public
void
deleteMessage
(
String
messageId
,
String
userId
)
throws
MessageServiceException
{
//1. 判断有没有这条消息
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"message_id"
,
messageId
)
.
eq
(
"user_id"
,
userId
);
Message
message
=
getOne
(
messageQueryWrapper
);
//2. 若找不到该消息,抛出业务异常
if
(
message
==
null
)
{
throw
new
MessageServiceException
(
MessageErrorCode
.
MESSAGE_NOT_EXIST
);
}
//3. 删除该条消息
removeById
(
messageId
);
}
@Override
public
void
deleteAllMessage
(
String
userId
)
{
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"user_id"
,
userId
);
remove
(
messageQueryWrapper
);
}
}
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