Commit a3a8f5da by 孙喜旺

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

1 parent 9d3b8f04
......@@ -29,7 +29,7 @@ import java.util.List;
@Api(tags = "会话存档管理")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/linkwechat/msg" )
@RequestMapping("/chat/msg" )
public class WeChatContactMsgController extends BaseController {
private final IWeChatContactMsgService iWeChatContactMsgService;
......@@ -105,19 +105,29 @@ public class WeChatContactMsgController extends BaseController {
/**
* 外部联系人/单聊 会话列表
*/
@ApiOperation("外部联系人/单聊 会话列表")
@Log(title = "外部联系人/单聊 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectExternalChatList/{fromId}" )
@ApiOperation("外部联系人 会话列表")
@Log(title = "外部联系人 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("/selectExternalChatList/{fromId}" )
public AjaxResult<List<WeChatContactMsgVo>> selectExternalChatList(@PathVariable("fromId") String 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("内部联系人 会话列表")
@Log(title = "内部联系人 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectInternalChatList/{fromId}" )
@GetMapping("/selectInternalChatList" )
public AjaxResult<List<WeChatContactMsgVo>> selectInternalChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectInternalChatList(fromId));
}
......@@ -127,7 +137,7 @@ public class WeChatContactMsgController extends BaseController {
*/
@ApiOperation("群聊 会话列表")
@Log(title = "群聊 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectGroupChatList/{fromId}" )
@GetMapping("/selectGroupChatList/{fromId}" )
public AjaxResult<List<WeChatContactMsgVo>> selectGroupChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectGroupChatList(fromId));
}
......@@ -137,7 +147,7 @@ public class WeChatContactMsgController extends BaseController {
*/
@ApiOperation("全文检索 会话列表")
@Log(title = "全文检索 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectFullSearchChatList" )
@GetMapping("/selectFullSearchChatList" )
public TableDataInfo<List<WeChatContactMsgVo>> selectFullSearchChatList(WeChatContactMsg weChatContactMsg) {
startPage();
List<WeChatContactMsgVo> list = iWeChatContactMsgService.selectFullSearchChatList(weChatContactMsg);
......
......@@ -16,13 +16,20 @@ import java.util.List;
public interface WeChatContactMsgMapper extends BaseMapper<WeChatContactMsg> {
/**
* 外部联系人/单聊 会话列表
* 外部联系人 会话列表
* @param fromId 消息发送人id
* @return 会话列表
*/
List<WeChatContactMsgVo> selectExternalChatList(@Param("fromId") String fromId);
/**
* 单聊 会话列表
* @param weChatContactMsg 入参
* @return 会话列表
*/
List<WeChatContactMsgVo> selectAloneChatList(WeChatContactMsg weChatContactMsg);
/**
* 内部联系人 会话列表
* @param fromId 消息发送人id
* @return 会话列表
......
......@@ -22,13 +22,20 @@ public interface IWeChatContactMsgService extends IService<WeChatContactMsg> {
/**
* 外部联系人/单聊 会话列表
* 外部联系人 会话列表
* @param fromId 消息发送人id
* @return 会话列表
*/
List<WeChatContactMsgVo> selectExternalChatList(String fromId);
/**
* 单聊 会话列表
* @param weChatContactMsg 入参
* @return 会话列表
*/
List<WeChatContactMsgVo> selectAloneChatList(WeChatContactMsg weChatContactMsg);
/**
* 内部联系人 会话列表
* @param fromId 消息发送人id
* @return 会话列表
......
......@@ -66,6 +66,11 @@ public class WeChatContactMsgServiceImpl extends ServiceImpl<WeChatContactMsgMap
}
@Override
public List<WeChatContactMsgVo> selectAloneChatList(WeChatContactMsg weChatContactMsg) {
return this.baseMapper.selectAloneChatList(weChatContactMsg);
}
@Override
public List<WeChatContactMsgVo> selectInternalChatList(String fromId) {
return this.baseMapper.selectInternalChatList(fromId);
}
......
......@@ -39,6 +39,28 @@
inner join we_customer wc on t.receiver = wc.external_userid;
</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 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!