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 2354915d
authored
Dec 09, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/back_end_dev_2.0' into back_end_dev_2.0
2 parents
4bbf0657
90400195
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
223 additions
and
77 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerSeasController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerSeasService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerSeasServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
View file @
2354915
...
...
@@ -65,7 +65,7 @@ public class WeCustomerController extends BaseController
iWeSynchRecordService
.
findUpdateLatestTime
(
SynchRecordConstants
.
SYNCH_CUSTOMER
)
);
//最近同步时间
dataTable
.
setNoRepeatCustomerTotal
(
weCustomerService
.
noRepeatCountCustomer
()
weCustomerService
.
noRepeatCountCustomer
(
weCustomerList
)
);
//去重客户数
return
dataTable
;
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerSeasController.java
View file @
2354915
...
...
@@ -37,8 +37,7 @@ public class WeCustomerSeasController extends BaseController {
@Autowired
private
IWeMessagePushService
iWeMessagePushService
;
/**
* 客户公海模版下载
...
...
@@ -75,26 +74,62 @@ public class WeCustomerSeasController extends BaseController {
if
(
CollectionUtil
.
isEmpty
(
deduplicationSeas
)){
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
}
//
跟根据手机号去重
//
根据手机号去重(去除excel中重复的号码)
List
<
WeCustomerSeas
>
deduplicationSeasNoRepeat
=
deduplicationSeas
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
WeCustomerSeas
::
getPhone
))),
ArrayList:
:
new
));
Long
tabaleExcelId
=
SnowFlakeUtil
.
nextId
();
List
<
String
>
userIds
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserId
().
split
(
","
));
List
<
String
>
userNames
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserName
().
split
(
","
));
IntStream
.
range
(
0
,
deduplicationSeasNoRepeat
.
size
()).
forEach
(
i
->{
WeCustomerSeas
k
=
deduplicationSeasNoRepeat
.
get
(
i
);
if
(
Objects
.
nonNull
(
k
)){
k
.
setTagIds
(
weCustomerSea
.
getTagIds
());
k
.
setTagNames
(
weCustomerSea
.
getTagNames
());
k
.
setAddUserId
(
userIds
.
get
(
Math
.
floorMod
(
i
,
userIds
.
size
())));
k
.
setAddUserName
(
userNames
.
get
(
Math
.
floorMod
(
i
,
userNames
.
size
())));
k
.
setTableExcelName
(
file
.
getOriginalFilename
());
k
.
setTableExcelId
(
tabaleExcelId
);
}
});
iWeCustomerSeasService
.
saveBatch
(
deduplicationSeasNoRepeat
);
//根据手机号去除数据库与excel中重复号码
List
<
WeCustomerSeas
>
dbExist
=
iWeCustomerSeasService
.
list
(
new
LambdaQueryWrapper
<
WeCustomerSeas
>()
.
in
(
WeCustomerSeas:
:
getPhone
,
deduplicationSeasNoRepeat
.
stream
()
.
map
(
WeCustomerSeas:
:
getPhone
).
collect
(
Collectors
.
toList
())));
if
(
CollectionUtil
.
isNotEmpty
(
dbExist
)){
List
<
WeCustomerSeas
>
noRepetWeCustomerSeas
=
deduplicationSeasNoRepeat
.
stream
().
filter
(
item
->
!
dbExist
.
stream
().
map
(
e
->
e
.
getPhone
()).
collect
(
Collectors
.
toList
())
.
contains
(
item
.
getPhone
())).
collect
(
Collectors
.
toList
());
deduplicationSeasNoRepeat
.
clear
();
deduplicationSeasNoRepeat
.
addAll
(
noRepetWeCustomerSeas
);
}
if
(
CollectionUtil
.
isNotEmpty
(
deduplicationSeasNoRepeat
)){
Long
tabaleExcelId
=
SnowFlakeUtil
.
nextId
();
List
<
String
>
userIds
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserId
().
split
(
","
));
List
<
String
>
userNames
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserName
().
split
(
","
));
IntStream
.
range
(
0
,
deduplicationSeasNoRepeat
.
size
()).
forEach
(
i
->{
WeCustomerSeas
k
=
deduplicationSeasNoRepeat
.
get
(
i
);
if
(
Objects
.
nonNull
(
k
)){
k
.
setTagIds
(
weCustomerSea
.
getTagIds
());
k
.
setTagNames
(
weCustomerSea
.
getTagNames
());
k
.
setAddUserId
(
userIds
.
get
(
Math
.
floorMod
(
i
,
userIds
.
size
())));
k
.
setAddUserName
(
userNames
.
get
(
Math
.
floorMod
(
i
,
userNames
.
size
())));
k
.
setTableExcelName
(
file
.
getOriginalFilename
());
k
.
setTableExcelId
(
tabaleExcelId
);
}
});
if
(
iWeCustomerSeasService
.
saveBatch
(
deduplicationSeasNoRepeat
)){
//发送提醒
deduplicationSeasNoRepeat
.
stream
().
collect
(
Collectors
.
groupingBy
(
WeCustomerSeas:
:
getAddUserId
)).
forEach
((
k
,
v
)->{
iWeCustomerSeasService
.
remidUser
(
ListUtil
.
toList
(
k
),
v
.
size
());
});
}
}
}
else
{
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
}
...
...
@@ -114,10 +149,11 @@ public class WeCustomerSeasController extends BaseController {
startPage
();
List
<
WeCustomerSeas
>
weCustomerSeas
=
iWeCustomerSeasService
.
list
(
new
LambdaQueryWrapper
<
WeCustomerSeas
>()
.
eq
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getPhone
()),
WeCustomerSeas:
:
getPhone
,
weCustomerSea
.
getPhone
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getPhone
()),
WeCustomerSeas:
:
getPhone
,
weCustomerSea
.
getPhone
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getCustomerName
()),
WeCustomerSeas:
:
getCustomerName
,
weCustomerSea
.
getCustomerName
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getAddUserName
()),
WeCustomerSeas:
:
getAddUserName
,
weCustomerSea
.
getAddUserName
())
.
eq
(
weCustomerSea
.
getAddState
()
!=
null
,
WeCustomerSeas:
:
getAddState
,
weCustomerSea
.
getAddState
())
.
orderByDesc
(
WeCustomerSeas:
:
getCreateTime
)
);
return
getDataTable
(
weCustomerSeas
);
...
...
@@ -152,9 +188,8 @@ public class WeCustomerSeasController extends BaseController {
if
(
CollectionUtil
.
isNotEmpty
(
weCustomerSeas
)){
weCustomerSeas
.
stream
().
collect
(
Collectors
.
groupingBy
(
WeCustomerSeas:
:
getAddUserId
)).
forEach
((
k
,
v
)->{
iWeCustomerSeasService
.
remidUser
(
ListUtil
.
toList
(
k
),
v
.
size
());
iWeMessagePushService
.
pushMessageSelfH5
(
ListUtil
.
toList
(
k
),
"管理员给你分配了"
+
v
.
size
()+
"个客户还未添加,快去复制电话号码添加客户吧,"
,
CommunityTaskType
.
SEAS
.
getType
());
});
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
View file @
2354915
...
...
@@ -21,7 +21,7 @@ public class WeCustomerList {
//客户名称
private
String
customerName
;
//客户类型
//客户类型
1:微信用户,2:企业用户
private
Integer
customerType
;
//查询标签id(企业标签id)
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
View file @
2354915
...
...
@@ -74,7 +74,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* 去重复统计
* @return
*/
long
noRepeatCountCustomer
();
long
noRepeatCountCustomer
(
@Param
(
"weCustomerList"
)
WeCustomerList
weCustomerList
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerSeasService.java
View file @
2354915
...
...
@@ -14,4 +14,7 @@ public interface IWeCustomerSeasService extends IService<WeCustomerSeas> {
List
<
CustomerSeasRecordVo
>
findSeasRecord
(
Integer
groupByType
);
void
remidUser
(
List
<
String
>
addUserIds
,
Integer
customerNum
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
View file @
2354915
...
...
@@ -128,7 +128,7 @@ public interface IWeCustomerService extends IService<WeCustomer>
* 去重统计
* @return
*/
long
noRepeatCountCustomer
();
long
noRepeatCountCustomer
(
WeCustomerList
weCustomerList
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerSeasServiceImpl.java
View file @
2354915
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.enums.CommunityTaskType
;
import
com.linkwechat.wecom.domain.WeCustomerSeas
;
import
com.linkwechat.wecom.domain.vo.CustomerSeasCountVo
;
import
com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo
;
import
com.linkwechat.wecom.mapper.WeCustomerSeasMapper
;
import
com.linkwechat.wecom.service.IWeCustomerSeasService
;
import
com.linkwechat.wecom.service.IWeMessagePushService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
@Service
public
class
WeCustomerSeasServiceImpl
extends
ServiceImpl
<
WeCustomerSeasMapper
,
WeCustomerSeas
>
implements
IWeCustomerSeasService
{
@Autowired
private
IWeMessagePushService
iWeMessagePushService
;
@Override
public
CustomerSeasCountVo
countCustomerSeas
()
{
...
...
@@ -31,4 +33,12 @@ public class WeCustomerSeasServiceImpl extends ServiceImpl<WeCustomerSeasMapper,
return
this
.
baseMapper
.
findSeasRecord
(
groupByType
);
}
@Override
@Async
public
void
remidUser
(
List
<
String
>
addUserIds
,
Integer
customerNum
)
{
iWeMessagePushService
.
pushMessageSelfH5
(
addUserIds
,
"管理员给你分配了"
+
customerNum
+
"个客户还未添加,快去复制电话号码添加客户吧,"
,
CommunityTaskType
.
SEAS
.
getType
());
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
2354915
...
...
@@ -134,6 +134,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
WeCustomer
weCustomer
=
new
WeCustomer
();
BeanUtils
.
copyPropertiesignoreOther
(
userDetail
.
getExternal_contact
(),
weCustomer
);
weCustomer
.
setCustomerType
(
userDetail
.
getExternal_contact
().
getType
());
weCustomer
.
setCustomerName
(
userDetail
.
getExternal_contact
().
getName
());
Optional
.
ofNullable
(
userDetail
.
getFollow_info
()).
ifPresent
(
followInfo
->
{
weCustomer
.
setFirstUserId
(
followInfo
.
getUserid
());
...
...
@@ -792,9 +793,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
* @return
*/
@Override
public
long
noRepeatCountCustomer
()
{
public
long
noRepeatCountCustomer
(
WeCustomerList
weCustomerList
)
{
return
this
.
baseMapper
.
noRepeatCountCustomer
();
return
this
.
baseMapper
.
noRepeatCountCustomer
(
weCustomerList
);
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMessagePushServiceImpl.java
View file @
2354915
...
...
@@ -125,7 +125,7 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService {
if
(
StringUtils
.
isEmpty
(
validWeCorpAccount
.
getSeasRedirectUrl
())){
throw
new
WeComException
(
"客户公海H5跳转链接不可为空"
);
}
URLEncoder
.
encode
(
String
.
format
(
"%s?corpId=%s&agentId=%s"
,
REDIRECT_URI
=
URLEncoder
.
encode
(
String
.
format
(
"%s?corpId=%s&agentId=%s"
,
validWeCorpAccount
.
getSeasRedirectUrl
()
,
corpId
,
agentId
));
}
else
{
//群sop与老客标签建群
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
View file @
2354915
...
...
@@ -69,24 +69,37 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
List
<
WeTag
>
weTags
=
weTagGroup
.
getWeTags
();
if
(
CollectionUtil
.
isEmpty
(
weTags
))
{
this
.
save
(
weTagGroup
);
}
else
{
//个人标签同步,企业微信
if
(
weTagGroup
.
getGroupTagType
().
equals
(
new
Integer
(
1
))){
weTagGroup
.
setAddWeTags
(
weTags
);
WeCropGropTagDtlDto
weCropGropTagDtlDto
=
weCropTagClient
.
addCorpTag
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
));
if
(
weCropGropTagDtlDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
))
{
this
.
batchSaveOrUpdateTagGroupAndTag
(
ListUtil
.
toList
(
weCropGropTagDtlDto
.
getTag_group
()),
false
);
if
(
this
.
save
(
weTagGroup
)){
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)){
weTags
.
stream
().
forEach
(
k
->{
k
.
setGroupId
(
weTagGroup
.
getGroupId
());
});
//客户标签
if
(
weTagGroup
.
getGroupTagType
().
equals
(
new
Integer
(
1
))){
weTagGroup
.
setAddWeTags
(
weTags
);
WeCropGropTagDtlDto
weCropGropTagDtlDto
=
weCropTagClient
.
addCorpTag
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
));
if
(
weCropGropTagDtlDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
))
{
this
.
batchSaveOrUpdateTagGroupAndTag
(
ListUtil
.
toList
(
weCropGropTagDtlDto
.
getTag_group
()),
false
);
}
}
else
{
iWeTagService
.
saveBatch
(
weTags
);
}
}
else
{
iWeTagService
.
saveBatch
(
weTags
);
}
}
// if (CollectionUtil.isEmpty(weTags)) {
// this.save(weTagGroup);
// } else {
//
//
//
// }
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
2354915
...
...
@@ -32,6 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND wc.gender=#{weCustomerList.gender}
</if>
<if
test=
"weCustomerList.trackState !=null"
>
AND wc.track_state=#{weCustomerList.trackState}
</if>
<if
test=
"weCustomerList.addMethod !=null"
>
AND wc.add_method=#{weCustomerList.addMethod}
</if>
<if
test=
"weCustomerList.customerType !=null"
>
AND wc.customer_type=#{weCustomerList.customerType}
</if>
<if
test=
"weCustomerList.externalUserid !=null"
>
AND wc.external_userid=#{weCustomerList.externalUserid}
</if>
...
...
@@ -69,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
<if
test=
"weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null"
>
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.
beginTime.
endTime}
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.endTime}
</if>
</where>
GROUP BY wc.external_userid,wc.first_user_id
...
...
@@ -169,12 +181,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
external_userid,
NAME,
avatar,
type,
customer_
type,
gender,
unionid,
birthday,
corp_name,
corp_full_name,
position,
is_open_chat,
create_time,
...
...
@@ -188,20 +199,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
add_method
) values
<foreach
collection=
"weCustomers"
item=
"item"
index=
"index"
separator=
","
>
(#{item.externalUserid},#{item.
name},#{item.avatar},#{item.t
ype},#{item.gender}, #{item.unionid},#{item.birthday},
#{item.corpName},#{item.
corpFullName},#{item.
position},#{item.isOpenChat}, #{item.createTime},
(#{item.externalUserid},#{item.
customerName},#{item.avatar},#{item.customerT
ype},#{item.gender}, #{item.unionid},#{item.birthday},
#{item.corpName},#{item.position},#{item.isOpenChat}, #{item.createTime},
#{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod}
)
</foreach>
ON DUPLICATE KEY UPDATE
NAME=IF(we_customer.NAME != null,
VALUES(NAME), we_customer.NAME
),
NAME=IF(we_customer.NAME != null,
we_customer.NAME, VALUES(NAME)
),
avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar),
type=IF(we_customer.type != null, VALUES(type), we_customer.
type),
customer_type=IF(we_customer.customer_type != null, VALUES(customer_type), we_customer.customer_
type),
gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender),
unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid),
birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday),
corp_name=IF(we_customer.corp_name != null, VALUES(corp_name), we_customer.corp_name),
corp_full_name=IF(we_customer.corp_full_name != null, VALUES(corp_full_name), we_customer.corp_full_name),
position=IF(we_customer.position != null, VALUES(position), we_customer.position),
is_open_chat=IF(we_customer.is_open_chat != null, VALUES(is_open_chat), we_customer.is_open_chat),
first_user_id=IF(we_customer.first_user_id != null, VALUES(first_user_id), we_customer.first_user_id),
...
...
@@ -215,7 +225,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"noRepeatCountCustomer"
resultType=
"long"
>
SELECT COUNT(DISTINCT external_userid) FROM we_customer where del_flag=0
SELECT
COUNT(DISTINCT wc.external_userid)
FROM
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.del_flag=0 AND wfctr.external_userid=wc.external_userid AND wfctr.user_id=wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
<where>
<if
test=
"weCustomerList.gender !=null"
>
AND wc.gender=#{weCustomerList.gender}
</if>
<if
test=
"weCustomerList.trackState !=null"
>
AND wc.track_state=#{weCustomerList.trackState}
</if>
<if
test=
"weCustomerList.addMethod !=null"
>
AND wc.add_method=#{weCustomerList.addMethod}
</if>
<if
test=
"weCustomerList.customerType !=null"
>
AND wc.customer_type=#{weCustomerList.customerType}
</if>
<if
test=
"weCustomerList.externalUserid !=null"
>
AND wc.external_userid=#{weCustomerList.externalUserid}
</if>
<if
test=
"weCustomerList.firstUserId !=null"
>
AND wc.first_user_id=#{weCustomerList.firstUserId}
</if>
<if
test=
"weCustomerList.departmentIds != null and weCustomerList.departmentIds !=''"
>
<if
test=
"weCustomerList.departmentIds.indexOf(',') != -1"
>
OR wu.department in
<foreach
item=
"item"
index=
"index"
collection=
"weCustomerList.departmentIds.split(',')"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</if>
<if
test=
"weCustomerList.delFlag != null"
>
AND wc.del_flag = #{weCustomerList.delFlag}
</if>
<if
test=
"weCustomerList.name != null and weCustomerList.name !=''"
>
AND wc.`name` like concat('%',#{weCustomerList.name,jdbcType=VARCHAR},'%')
</if>
<if
test=
"weCustomerList.userIds !=null and weCustomerList.userIds !=''"
>
AND wc.first_user_id in
<foreach
collection=
"weCustomerList.userIds.split(',')"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
<if
test=
"weCustomerList.tagIds !=null and weCustomerList.tagIds !=''"
>
AND wt.tag_id in
<foreach
collection=
"weCustomerList.tagIds.split(',')"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
<if
test=
"weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null"
>
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.endTime}
</if>
</where>
</select>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMapper.xml
View file @
2354915
...
...
@@ -27,7 +27,7 @@
<where>
<if
test=
"delFlag !=null"
>
wg.del_flag=#{delFlag}
</if>
<if
test=
"groupName != null and groupName != ''"
>
and wg.group_name like concat('%', #{groupName}, '%')
</if>
<if
test=
"groupLeader != null and groupLeader != ''"
>
and wu.user_name like concat('%', #{groupLeader}, '%')
</if>
<if
test=
"groupLeader != null and groupLeader != ''"
>
and wu.user_name like concat('%', #{groupLeader
Name
}, '%')
</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
AND date_format(wg.create_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
</if>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
View file @
2354915
...
...
@@ -3,40 +3,53 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeTagGroupMapper"
>
<sql
id=
"selectWeTagGroupVo"
>
select gourp_name, create_time from we_tag_group
</sql>
<resultMap
type=
"WeTagGroup"
id=
"WeTagGroupResult"
>
<result
property=
"gourpName"
column=
"gourp_name"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"groupId"
column=
"group_id"
/>
<collection
property=
"weTags"
column=
"weTags.id"
ofType=
"com.linkwechat.wecom.domain.WeTag"
>
<id
property=
"tagId"
column=
"tag_id"
/>
<result
property=
"groupId"
column=
"tag_group_id"
/>
<result
property=
"name"
column=
"name"
/>
<collection
property=
"weTags"
select=
"findWeTag"
column=
"{groupId=group_id}"
>
</collection>
</resultMap>
<sql
id=
"selectWeTagGroupVo"
>
select gourp_name, create_time from we_tag_group
</sql>
<resultMap
id=
"WeTagBaseMapper"
type=
"com.linkwechat.wecom.domain.WeTag"
>
<id
property=
"tagId"
column=
"tag_id"
/>
<result
property=
"groupId"
column=
"group_id"
/>
<result
property=
"name"
column=
"name"
/>
</resultMap>
<select
id=
"selectWeTagGroupList"
parameterType=
"WeTagGroup"
resultMap=
"WeTagGroupResult"
>
SELECT
wtg.*,
wt.tag_id ,
wt.group_id,
wt.name,
wtg.create_by,
wtg.group_id as tag_group_id
wtg.*
FROM
we_tag_group wtg
LEFT JOIN we_tag wt ON wtg.group_id = wt.group_id
where
wtg.del_flag=0 and wt.del_flag=0
<if
test=
"gourpName != null and gourpName != ''"
>
and gourp_name like concat('%', #{gourpName}, '%')
</if>
wtg.del_flag=0
<if
test=
"groupTagType != null"
>
and wtg.group_tag_type=#{groupTagType}
</if>
ORDER BY wtg.create_time DESC
</select>
<select
id=
"findWeTag"
resultMap=
"WeTagBaseMapper"
>
SELECT
wt.tag_id ,
wt.group_id,
wt.name
FROM
we_tag wt
where
wt.group_id = #{groupId} and wt.del_flag=0
</select>
<select
id=
"getWeTagGroupByIds"
resultMap=
"WeTagGroupResult"
>
SELECT
...
...
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