Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0a57281e
authored
Jul 29, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
会话存档添加全局检索接口及sql修改
1 parent
ff19dae8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
91 additions
and
11 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatContactMsgController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeChatContactMsg.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeChatContactMsgVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatContactMsgMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatContactMsgService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatContactMsgServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeChatContactMsgMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatContactMsgController.java
View file @
0a57281
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
...
...
@@ -35,7 +36,7 @@ public class WeChatContactMsgController extends BaseController {
*/
@PreAuthorize
(
"@ss.hasPermi('linkwechat:msg:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
WeChatContactMsg
weChatContactMsg
)
{
public
TableDataInfo
<
List
<
WeChatContactMsg
>>
list
(
WeChatContactMsg
weChatContactMsg
)
{
startPage
();
List
<
WeChatContactMsg
>
list
=
iWeChatContactMsgService
.
queryList
(
weChatContactMsg
);
return
getDataTable
(
list
);
...
...
@@ -58,7 +59,7 @@ public class WeChatContactMsgController extends BaseController {
*/
@PreAuthorize
(
"@ss.hasPermi('linkwechat:msg:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
public
AjaxResult
<
WeChatContactMsg
>
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
iWeChatContactMsgService
.
getById
(
id
));
}
...
...
@@ -118,4 +119,15 @@ public class WeChatContactMsgController extends BaseController {
public
AjaxResult
<
List
<
WeChatContactMsgVo
>>
selectGroupChatList
(
@PathVariable
(
"fromId"
)
String
fromId
)
{
return
AjaxResult
.
success
(
iWeChatContactMsgService
.
selectGroupChatList
(
fromId
));
}
/**
* 全文检索 会话列表
*/
@Log
(
title
=
"全文检索 会话列表"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"selectFullSearchChatList}"
)
public
TableDataInfo
<
List
<
WeChatContactMsgVo
>>
selectFullSearchChatList
(
WeChatContactMsg
weChatContactMsg
)
{
startPage
();
List
<
WeChatContactMsgVo
>
list
=
iWeChatContactMsgService
.
selectFullSearchChatList
(
weChatContactMsg
);
return
getDataTable
(
list
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeChatContactMsg.java
View file @
0a57281
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
...
@@ -42,7 +43,7 @@ private static final long serialVersionUID=1L;
private
String
msgId
;
/** 消息记录seq值 */
@ApiModelProperty
(
"消息记录seq值"
)
@ApiModelProperty
(
value
=
"消息记录seq值"
,
hidden
=
true
)
private
Long
seq
;
/** 发送人id */
...
...
@@ -82,7 +83,14 @@ private static final long serialVersionUID=1L;
private
String
contact
;
/** 是否为外部聊天 0 外部 1 内部 */
@ApiModelProperty
(
"是否为外部聊天 0 外部 1 内部"
)
@ApiModelProperty
(
value
=
"是否为外部聊天 0 外部 1 内部"
,
hidden
=
true
)
private
Integer
isExternal
;
/**
* 名称
*/
@ApiModelProperty
(
"名称"
)
@TableField
(
exist
=
false
)
private
String
name
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeChatContactMsgVo.java
View file @
0a57281
...
...
@@ -19,6 +19,9 @@ public class WeChatContactMsgVo {
@ApiModelProperty
(
"接收人id"
)
private
String
receiver
;
@ApiModelProperty
(
"发送人人id"
)
private
String
fromId
;
@ApiModelProperty
(
"名称"
)
private
String
name
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatContactMsgMapper.java
View file @
0a57281
...
...
@@ -35,4 +35,11 @@ public interface WeChatContactMsgMapper extends BaseMapper<WeChatContactMsg> {
* @return 会话列表
*/
List
<
WeChatContactMsgVo
>
selectGroupChatList
(
@Param
(
"fromId"
)
String
fromId
);
/**
* 全文检索 会话列表
* @param weChatContactMsg 检索条件
* @return 会话列表
*/
List
<
WeChatContactMsgVo
>
selectFullSearchChatList
(
WeChatContactMsg
weChatContactMsg
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatContactMsgService.java
View file @
0a57281
...
...
@@ -41,4 +41,11 @@ public interface IWeChatContactMsgService extends IService<WeChatContactMsg> {
* @return 会话列表
*/
List
<
WeChatContactMsgVo
>
selectGroupChatList
(
String
fromId
);
/**
* 全文检索 会话列表
* @param weChatContactMsg 检索条件
* @return 会话列表
*/
List
<
WeChatContactMsgVo
>
selectFullSearchChatList
(
WeChatContactMsg
weChatContactMsg
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatContactMsgServiceImpl.java
View file @
0a57281
...
...
@@ -54,8 +54,9 @@ public class WeChatContactMsgServiceImpl extends ServiceImpl<WeChatContactMsgMap
lqw
.
eq
(
WeChatContactMsg:
:
getMsgTime
,
weChatContactMsg
.
getMsgTime
());
}
if
(
StringUtils
.
isNotBlank
(
weChatContactMsg
.
getContact
())){
lqw
.
eq
(
WeChatContactMsg:
:
getContact
,
weChatContactMsg
.
getContact
());
lqw
.
like
(
WeChatContactMsg:
:
getContact
,
weChatContactMsg
.
getContact
());
}
lqw
.
orderByDesc
(
WeChatContactMsg:
:
getMsgTime
);
return
this
.
list
(
lqw
);
}
...
...
@@ -89,4 +90,9 @@ public class WeChatContactMsgServiceImpl extends ServiceImpl<WeChatContactMsgMap
}
return
this
.
baseMapper
.
selectGroupChatList
(
fromId
);
}
@Override
public
List
<
WeChatContactMsgVo
>
selectFullSearchChatList
(
WeChatContactMsg
weChatContactMsg
)
{
return
this
.
baseMapper
.
selectFullSearchChatList
(
weChatContactMsg
);
}
}
linkwe-wecom/src/main/resources/mapper/wecom/WeChatContactMsgMapper.xml
View file @
0a57281
...
...
@@ -29,11 +29,11 @@
(
select to_list as receiver, `action` , msg_time, msg_type, contact
from we_chat_contact_msg
where from_id =
$
{fromId} and is_external = 0 and room_id = ''
where from_id =
#
{fromId} and is_external = 0 and room_id = ''
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 is_external = 0 and room_id = ''
where FIND_IN_SET(
#
{fromId}, to_list) and is_external = 0 and room_id = ''
order by msg_time desc
) as msg group by receiver order by msg.msg_time desc) t
inner join we_customer wc on t.receiver = wc.external_userid;
...
...
@@ -48,11 +48,11 @@
(
select to_list as receiver, `action` , msg_time, msg_type, contact
from we_chat_contact_msg
where from_id =
$
{fromId} and is_external = 1 and room_id = ''
where from_id =
#
{fromId} and is_external = 1 and room_id = ''
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 is_external = 1 and room_id = ''
where FIND_IN_SET(
#
{fromId}, to_list) and is_external = 1 and room_id = ''
order by msg_time desc
) as msg group by receiver order by msg.msg_time desc) t
inner join we_user wu on t.receiver = wu.user_id;
...
...
@@ -66,13 +66,50 @@
(
select to_list as receiver, `action` , msg_time, msg_type, contact
from we_chat_contact_msg
where from_id =
$
{fromId} and room_id
<>
''
where from_id =
#
{fromId} and room_id
<>
''
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
<>
''
where FIND_IN_SET(
#
{fromId}, to_list) and room_id
<>
''
order by msg_time desc
) as msg group by receiver order by msg.msg_time desc) t
inner join we_group wg on t.receiver = wg.chat_id;
</select>
<select
id=
"selectFullSearchChatList"
resultType=
"com.linkwechat.wecom.domain.vo.WeChatContactMsgVo"
>
select * from
(
select from_id,
msg_time,
`action`,
msg_type,
contact,
if((case when LOCATE('wm', from_id) or LOCATE('wo', from_id) then 0 else 1 end),
(select wu.user_name from we_user wu where wccm.from_id = wu.user_id),
(select wc.name from we_customer wc where wccm.from_id = wc.external_userid)) as name
from we_chat_contact_msg wccm
) t
<where>
<if
test=
"name != null and name != ''"
>
and t.name like concat('%', #{name}, '%')
</if>
<if
test=
"fromId != null and fromId != ''"
>
and t.fromId = #{fromId}
</if>
<if
test=
"action != null and action != ''"
>
and t.action = #{action}
</if>
<if
test=
"contact != null and contact != ''"
>
and t.contact like concat('%', #{contact}, '%')
</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
AND date_format(t.msg_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
</if>
<if
test=
"endTime != null and endTime != ''"
>
<!-- 结束时间检索 -->
AND date_format(t.msg_time,'%y%m%d')
<
= date_format(#{endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment