Commit 40dfd647 by danmo

会话存档新增单聊列表接口

1 parent 2514dac0
...@@ -29,7 +29,7 @@ import java.util.List; ...@@ -29,7 +29,7 @@ import java.util.List;
@Api(tags = "会话存档管理") @Api(tags = "会话存档管理")
@RequiredArgsConstructor(onConstructor_ = @Autowired) @RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController @RestController
@RequestMapping("/linkwechat/msg" ) @RequestMapping("/chat/msg" )
public class WeChatContactMsgController extends BaseController { public class WeChatContactMsgController extends BaseController {
private final IWeChatContactMsgService iWeChatContactMsgService; private final IWeChatContactMsgService iWeChatContactMsgService;
...@@ -105,19 +105,29 @@ public class WeChatContactMsgController extends BaseController { ...@@ -105,19 +105,29 @@ public class WeChatContactMsgController extends BaseController {
/** /**
* 外部联系人/单聊 会话列表 * 外部联系人/单聊 会话列表
*/ */
@ApiOperation("外部联系人/单聊 会话列表") @ApiOperation("外部联系人 会话列表")
@Log(title = "外部联系人/单聊 会话列表" , businessType = BusinessType.OTHER) @Log(title = "外部联系人 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectExternalChatList/{fromId}" ) @GetMapping("/selectExternalChatList/{fromId}" )
public AjaxResult<List<WeChatContactMsgVo>> selectExternalChatList(@PathVariable("fromId") String fromId) { public AjaxResult<List<WeChatContactMsgVo>> selectExternalChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectExternalChatList(fromId)); return AjaxResult.success(iWeChatContactMsgService.selectExternalChatList(fromId));
} }
/** /**
* 外部联系人/单聊 会话列表
*/
@ApiOperation("单聊 会话列表")
@Log(title = "单聊 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("/selectAloneChatList" )
public AjaxResult<List<WeChatContactMsgVo>> selectAloneChatList(WeChatContactMsg weChatContactMsg) {
return AjaxResult.success(iWeChatContactMsgService.selectAloneChatList(weChatContactMsg));
}
/**
* 内部联系人 会话列表 * 内部联系人 会话列表
*/ */
@ApiOperation("内部联系人 会话列表") @ApiOperation("内部联系人 会话列表")
@Log(title = "内部联系人 会话列表" , businessType = BusinessType.OTHER) @Log(title = "内部联系人 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectInternalChatList/{fromId}" ) @GetMapping("/selectInternalChatList" )
public AjaxResult<List<WeChatContactMsgVo>> selectInternalChatList(@PathVariable("fromId") String fromId) { public AjaxResult<List<WeChatContactMsgVo>> selectInternalChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectInternalChatList(fromId)); return AjaxResult.success(iWeChatContactMsgService.selectInternalChatList(fromId));
} }
...@@ -127,7 +137,7 @@ public class WeChatContactMsgController extends BaseController { ...@@ -127,7 +137,7 @@ public class WeChatContactMsgController extends BaseController {
*/ */
@ApiOperation("群聊 会话列表") @ApiOperation("群聊 会话列表")
@Log(title = "群聊 会话列表" , businessType = BusinessType.OTHER) @Log(title = "群聊 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectGroupChatList/{fromId}" ) @GetMapping("/selectGroupChatList/{fromId}" )
public AjaxResult<List<WeChatContactMsgVo>> selectGroupChatList(@PathVariable("fromId") String fromId) { public AjaxResult<List<WeChatContactMsgVo>> selectGroupChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectGroupChatList(fromId)); return AjaxResult.success(iWeChatContactMsgService.selectGroupChatList(fromId));
} }
...@@ -137,7 +147,7 @@ public class WeChatContactMsgController extends BaseController { ...@@ -137,7 +147,7 @@ public class WeChatContactMsgController extends BaseController {
*/ */
@ApiOperation("全文检索 会话列表") @ApiOperation("全文检索 会话列表")
@Log(title = "全文检索 会话列表" , businessType = BusinessType.OTHER) @Log(title = "全文检索 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectFullSearchChatList" ) @GetMapping("/selectFullSearchChatList" )
public TableDataInfo<List<WeChatContactMsgVo>> selectFullSearchChatList(WeChatContactMsg weChatContactMsg) { public TableDataInfo<List<WeChatContactMsgVo>> selectFullSearchChatList(WeChatContactMsg weChatContactMsg) {
startPage(); startPage();
List<WeChatContactMsgVo> list = iWeChatContactMsgService.selectFullSearchChatList(weChatContactMsg); List<WeChatContactMsgVo> list = iWeChatContactMsgService.selectFullSearchChatList(weChatContactMsg);
......
...@@ -16,13 +16,20 @@ import java.util.List; ...@@ -16,13 +16,20 @@ import java.util.List;
public interface WeChatContactMsgMapper extends BaseMapper<WeChatContactMsg> { public interface WeChatContactMsgMapper extends BaseMapper<WeChatContactMsg> {
/** /**
* 外部联系人/单聊 会话列表 * 外部联系人 会话列表
* @param fromId 消息发送人id * @param fromId 消息发送人id
* @return 会话列表 * @return 会话列表
*/ */
List<WeChatContactMsgVo> selectExternalChatList(@Param("fromId") String fromId); List<WeChatContactMsgVo> selectExternalChatList(@Param("fromId") String fromId);
/** /**
* 单聊 会话列表
* @param weChatContactMsg 入参
* @return 会话列表
*/
List<WeChatContactMsgVo> selectAloneChatList(WeChatContactMsg weChatContactMsg);
/**
* 内部联系人 会话列表 * 内部联系人 会话列表
* @param fromId 消息发送人id * @param fromId 消息发送人id
* @return 会话列表 * @return 会话列表
......
...@@ -22,13 +22,20 @@ public interface IWeChatContactMsgService extends IService<WeChatContactMsg> { ...@@ -22,13 +22,20 @@ public interface IWeChatContactMsgService extends IService<WeChatContactMsg> {
/** /**
* 外部联系人/单聊 会话列表 * 外部联系人 会话列表
* @param fromId 消息发送人id * @param fromId 消息发送人id
* @return 会话列表 * @return 会话列表
*/ */
List<WeChatContactMsgVo> selectExternalChatList(String fromId); List<WeChatContactMsgVo> selectExternalChatList(String fromId);
/** /**
* 单聊 会话列表
* @param weChatContactMsg 入参
* @return 会话列表
*/
List<WeChatContactMsgVo> selectAloneChatList(WeChatContactMsg weChatContactMsg);
/**
* 内部联系人 会话列表 * 内部联系人 会话列表
* @param fromId 消息发送人id * @param fromId 消息发送人id
* @return 会话列表 * @return 会话列表
......
...@@ -66,6 +66,11 @@ public class WeChatContactMsgServiceImpl extends ServiceImpl<WeChatContactMsgMap ...@@ -66,6 +66,11 @@ public class WeChatContactMsgServiceImpl extends ServiceImpl<WeChatContactMsgMap
} }
@Override @Override
public List<WeChatContactMsgVo> selectAloneChatList(WeChatContactMsg weChatContactMsg) {
return this.baseMapper.selectAloneChatList(weChatContactMsg);
}
@Override
public List<WeChatContactMsgVo> selectInternalChatList(String fromId) { public List<WeChatContactMsgVo> selectInternalChatList(String fromId) {
return this.baseMapper.selectInternalChatList(fromId); return this.baseMapper.selectInternalChatList(fromId);
} }
......
...@@ -39,6 +39,28 @@ ...@@ -39,6 +39,28 @@
inner join we_customer wc on t.receiver = wc.external_userid; inner join we_customer wc on t.receiver = wc.external_userid;
</select> </select>
<select id="selectAloneChatList" resultType="com.linkwechat.wecom.domain.vo.WeChatContactMsgVo">
select t.*, ifnull(wu.user_name, wc.name) as name, ifnull(wu.head_image_url, wc.avatar) as avatar
from (select receiver, msg_time, `action`, msg_type, contact
from (select to_list as receiver, `action`, msg_time, msg_type, contact from we_chat_contact_msg
where from_id = #{fromId}
and room_id = ''
<if test="contact != null and contact != ''">
and contact like concat('%', #{contact}, '%')
</if>
union
select from_id as receiver, `action`, msg_time, msg_type, contact from we_chat_contact_msg
where FIND_IN_SET(#{fromId}, to_list)
and room_id = ''
<if test="contact != null and contact != ''">
and contact like concat('%', #{contact}, '%')
</if>
order by msg_time desc) as msg
group by receiver order by msg.msg_time desc) as t
left join we_user wu on t.receiver = wu.user_id and (case when LOCATE('wm', t.receiver) or LOCATE('wo', t.receiver) then 0 else 1 end) = 1
left join we_customer wc on t.receiver = wc.external_userid and (case when LOCATE('wm', t.receiver) or LOCATE('wo', t.receiver) then 0 else 1 end) = 0;
</select>
<select id="selectInternalChatList" resultType="com.linkwechat.wecom.domain.vo.WeChatContactMsgVo"> <select id="selectInternalChatList" resultType="com.linkwechat.wecom.domain.vo.WeChatContactMsgVo">
select t.*, wu.user_name as name , wu.head_image_url as avatar from select t.*, wu.user_name as name , wu.head_image_url as avatar from
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!