Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
hewei
wecloud_im_server
Commits
246811fc
Commit
246811fc
authored
Feb 22, 2022
by
hweeeeeei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成:获取会话详情接口
parent
3003b9e8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
1 deletions
+62
-1
common/src/main/java/com/wecloud/im/controller/ImConversationController.java
+11
-0
common/src/main/java/com/wecloud/im/mapper/ImConversationMapper.java
+2
-0
common/src/main/java/com/wecloud/im/service/ImConversationService.java
+7
-1
common/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+15
-0
common/src/main/resources/mapper/ImConversationMapper.xml
+27
-0
No files found.
common/src/main/java/com/wecloud/im/controller/ImConversationController.java
View file @
246811fc
...
...
@@ -15,9 +15,11 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
...
...
@@ -37,6 +39,15 @@ public class ImConversationController extends BaseController {
@Autowired
private
ImConversationService
imConversationService
;
/**
* 获取会话表详情
*/
@GetMapping
(
"/info"
)
@ApiOperation
(
value
=
"会话表详情"
)
public
ApiResult
<
MyConversationListVo
>
getImConversation
(
@RequestParam
(
"id"
)
Long
id
)
throws
Exception
{
MyConversationListVo
imConversationQueryVo
=
imConversationService
.
getImConversationInfoById
(
id
);
return
ApiResult
.
ok
(
imConversationQueryVo
);
}
/**
* 添加或修改会话名称
...
...
common/src/main/java/com/wecloud/im/mapper/ImConversationMapper.java
View file @
246811fc
...
...
@@ -48,6 +48,8 @@ public interface ImConversationMapper extends BaseMapper<ImConversation> {
*/
List
<
MyConversationListVo
>
getMyImConversationListAndMsgCount
(
@Param
(
"clientId"
)
Long
clientId
);
MyConversationListVo
getImConversationAndMsgCountById
(
@Param
(
"clientId"
)
Long
clientId
,
@Param
(
"conversationId"
)
Long
conversationId
);
/**
* 查询用户加入的所有会话
*
...
...
common/src/main/java/com/wecloud/im/service/ImConversationService.java
View file @
246811fc
...
...
@@ -103,6 +103,11 @@ public interface ImConversationService extends BaseService<ImConversation> {
*/
ImConversationQueryVo
getImConversationById
(
Long
id
)
throws
Exception
;
MyConversationListVo
getImConversationAndMsgCountById
(
Long
clientId
,
Long
conversationId
);
MyConversationListVo
getImConversationInfoById
(
Long
id
)
throws
Exception
;
/**
* 获取分页对象
*
...
...
@@ -110,7 +115,8 @@ public interface ImConversationService extends BaseService<ImConversation> {
* @return
* @throws Exception
*/
Paging
<
ImConversationQueryVo
>
getImConversationPageList
(
ImConversationPageParam
imConversationPageParam
)
throws
Exception
;
Paging
<
ImConversationQueryVo
>
getImConversationPageList
(
ImConversationPageParam
imConversationPageParam
)
throws
Exception
;
/**
...
...
common/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
246811fc
...
...
@@ -786,6 +786,21 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
return
imConversationMapper
.
getImConversationById
(
id
);
}
@Override
public
MyConversationListVo
getImConversationAndMsgCountById
(
Long
clientId
,
Long
conversationId
)
{
return
imConversationMapper
.
getImConversationAndMsgCountById
(
clientId
,
conversationId
);
}
@Override
public
MyConversationListVo
getImConversationInfoById
(
Long
id
)
throws
Exception
{
ImClient
client
=
imClientService
.
getCurentClient
();
return
this
.
getImConversationAndMsgCountById
(
client
.
getId
(),
id
);
}
@Override
public
Paging
<
ImConversationQueryVo
>
getImConversationPageList
(
ImConversationPageParam
imConversationPageParam
)
throws
Exception
{
Page
<
ImConversationQueryVo
>
page
=
new
PageInfo
<>(
imConversationPageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
ImConversation:
:
getCreateTime
)));
...
...
common/src/main/resources/mapper/ImConversationMapper.xml
View file @
246811fc
...
...
@@ -109,5 +109,32 @@
WHERE im_conversation_members.fk_client_id = #{clientId1}
HAVING members_count = 2 LIMIT 1
</select>
<select
id=
"getImConversationAndMsgCountById"
resultType=
"com.wecloud.im.vo.MyConversationListVo"
>
SELECT imConversation.id,
imConversation.create_time,
imConversation.`name`,
imConversation.attributes AS attribute,
imConversation.system,
im_client.client_id AS creator,
(SELECT COUNT(im_inbox.id)
FROM im_inbox
WHERE im_inbox.fk_conversation_id = imConversation.id
AND im_inbox.receiver = #{clientId}
AND im_inbox.read_msg_status = 0) AS msg_not_read_count,
(
SELECT GROUP_CONCAT(im_client.client_id)
FROM im_conversation_members AS im_conversation_members
INNER JOIN im_client AS im_client ON im_client.id = im_conversation_members.fk_client_id
WHERE im_conversation_members.fk_conversation_id = imConversation.id
) AS members,
(SELECT COUNT(*)
FROM im_conversation_members
WHERE fk_conversation_id = imConversation.id) AS memberCount
FROM im_conversation AS imConversation
INNER JOIN im_client AS im_client ON im_client.id = imConversation.creator
WHERE imConversation.id = #{conversationId}
GROUP BY imConversation.id
</select>
</mapper>
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