Commit 4316ec03 by wei

修改/server/conversation中字段;

添加mapper: getImConversationInfoByIdForServerApi;
parent 04327fca
...@@ -40,7 +40,7 @@ public class ApiImConversationController extends BaseController { ...@@ -40,7 +40,7 @@ public class ApiImConversationController extends BaseController {
*/ */
@GetMapping("/info") @GetMapping("/info")
@ApiOperation(value = "会话表详情") @ApiOperation(value = "会话表详情")
public ApiResult<MyConversationListVo> getImConversation(@RequestParam("id") Long id public ApiResult<MyConversationListVo> getImConversation(@RequestParam("conversationId") Long conversationId
, @RequestHeader String appkey, @RequestHeader String appSecret) throws Exception { , @RequestHeader String appkey, @RequestHeader String appSecret) throws Exception {
// 根据appKey从数据库查询密钥 // 根据appKey从数据库查询密钥
...@@ -55,7 +55,7 @@ public class ApiImConversationController extends BaseController { ...@@ -55,7 +55,7 @@ public class ApiImConversationController extends BaseController {
return ApiResult.result(ApiCode.FAIL, null); return ApiResult.result(ApiCode.FAIL, null);
} }
MyConversationListVo imConversationQueryVo = imConversationService.getImConversationInfoById(id); MyConversationListVo imConversationQueryVo = imConversationService.getImConversationInfoByIdForServerApi(conversationId);
return ApiResult.ok(imConversationQueryVo); return ApiResult.ok(imConversationQueryVo);
} }
......
...@@ -50,6 +50,8 @@ public interface ImConversationMapper extends BaseMapper<ImConversation> { ...@@ -50,6 +50,8 @@ public interface ImConversationMapper extends BaseMapper<ImConversation> {
MyConversationListVo getImConversationAndMsgCountById(@Param("clientId") Long clientId, @Param("conversationId") Long conversationId); MyConversationListVo getImConversationAndMsgCountById(@Param("clientId") Long clientId, @Param("conversationId") Long conversationId);
MyConversationListVo getImConversationInfoByIdForServerApi(@Param("conversationId") Long conversationId);
/** /**
* 查询用户加入的所有会话 * 查询用户加入的所有会话
* *
......
...@@ -107,6 +107,7 @@ public interface ImConversationService extends BaseService<ImConversation> { ...@@ -107,6 +107,7 @@ public interface ImConversationService extends BaseService<ImConversation> {
MyConversationListVo getImConversationInfoById(Long id) throws Exception; MyConversationListVo getImConversationInfoById(Long id) throws Exception;
MyConversationListVo getImConversationInfoByIdForServerApi(Long id) throws Exception;
/** /**
* 获取分页对象 * 获取分页对象
......
...@@ -816,6 +816,15 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -816,6 +816,15 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
} }
@Override @Override
public MyConversationListVo getImConversationInfoByIdForServerApi(Long id) throws Exception {
MyConversationListVo imConversationAndMsgCountById = imConversationMapper.getImConversationInfoByIdForServerApi(id);
JsonMapper jsonMapper = new JsonMapper();
HashMap attributess = jsonMapper.readValue(imConversationAndMsgCountById.getAttribute(), HashMap.class);
imConversationAndMsgCountById.setAttributes(attributess);
return imConversationAndMsgCountById;
}
@Override
public Paging<ImConversationQueryVo> getImConversationPageList(ImConversationPageParam imConversationPageParam) throws Exception { public Paging<ImConversationQueryVo> getImConversationPageList(ImConversationPageParam imConversationPageParam) throws Exception {
Page<ImConversationQueryVo> page = new PageInfo<>(imConversationPageParam, OrderItem.desc(getLambdaColumn(ImConversation::getCreateTime))); Page<ImConversationQueryVo> page = new PageInfo<>(imConversationPageParam, OrderItem.desc(getLambdaColumn(ImConversation::getCreateTime)));
IPage<ImConversationQueryVo> iPage = imConversationMapper.getImConversationPageList(page, imConversationPageParam); IPage<ImConversationQueryVo> iPage = imConversationMapper.getImConversationPageList(page, imConversationPageParam);
......
...@@ -136,5 +136,29 @@ ...@@ -136,5 +136,29 @@
GROUP BY imConversation.id GROUP BY imConversation.id
</select> </select>
<select id="getImConversationInfoByIdForServerApi" 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 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> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment