Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
18dfcaac
Commit
18dfcaac
authored
Aug 05, 2023
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crm新需求--
客户新增手机微信二选一 客户新增跟进状态(潜在,意向) 客户跟进列表中如果是签约或者合作中的,增加签约时间和合同时间 加一条本月待跟进列表
parent
fa4ded37
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
276 additions
and
26 deletions
+276
-26
sql/V2.3.sql
+10
-0
src/main/java/cn/timer/api/bean/crm/CrmClientData.java
+1
-4
src/main/java/cn/timer/api/controller/crm/CrmController.java
+76
-22
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
+29
-0
src/main/resources/mapping/crm/CrmClientDataMapper.xml
+160
-0
No files found.
sql/V2.3.sql
View file @
18dfcaac
...
@@ -74,3 +74,13 @@ CREATE TABLE `crm_list_color` (
...
@@ -74,3 +74,13 @@ CREATE TABLE `crm_list_color` (
`
color3
` varchar(50) DEFAULT NULL COMMENT '颜色',
`
color3
` varchar(50) DEFAULT NULL COMMENT '颜色',
PRIMARY KEY (`
id
`)
PRIMARY KEY (`
id
`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='跟进记录的颜色标识配置';
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='跟进记录的颜色标识配置';
ALTER TABLE `
timer_test_0620
`.`
crm_client_data
`
ADD COLUMN `
contract_signing_date
` datetime NULL COMMENT '签约时间' AFTER `
hidingcustomers
`,
ADD COLUMN `
contract_end_date
` varchar(50) NULL COMMENT '合同到期时间' AFTER `
contract_signing_date
`;
ALTER TABLE `
timer_test_0620
`.`
crm_client_follow
`
ADD COLUMN `
contract_end_date
` datetime NULL COMMENT '合同到期时间' AFTER `
client_status
`,
ADD COLUMN `
contract_signing_date
` varchar(50) NULL COMMENT '签约时间' AFTER `
contract_end_date
`;
src/main/java/cn/timer/api/bean/crm/CrmClientData.java
View file @
18dfcaac
...
@@ -182,13 +182,10 @@ public class CrmClientData extends Model<CrmClientData> {
...
@@ -182,13 +182,10 @@ public class CrmClientData extends Model<CrmClientData> {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"客户联系人数据列表"
)
@ApiModelProperty
(
value
=
"客户联系人数据列表"
)
private
List
<
CrmClientContacts
>
CrmClientContacts
;
private
List
<
CrmClientContacts
>
CrmClientContacts
;
@Transient
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"签约时间"
)
@ApiModelProperty
(
value
=
"签约时间"
)
private
Date
contractSigningDate
;
private
Date
contractSigningDate
;
@Transient
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"合同有效期"
)
@ApiModelProperty
(
value
=
"合同有效期"
)
private
String
contractEndDate
;
private
String
contractEndDate
;
...
...
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
18dfcaac
...
@@ -399,7 +399,9 @@ public class CrmController {
...
@@ -399,7 +399,9 @@ public class CrmController {
log
.
info
(
"crmClientData合同有效期"
,
crmClientData
.
getContractEndDate
());
log
.
info
(
"crmClientData合同有效期"
,
crmClientData
.
getContractEndDate
());
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
if
(
crmClientData
.
getClientStatus
()==
null
){
crmClientData
.
setClientStatus
(
1
);
crmClientData
.
setClientStatus
(
1
);
}
crmClientData
.
setCreateUser
(
empNum
);
crmClientData
.
setCreateUser
(
empNum
);
SysRegion
district
=
zpglService
.
getSysRegion
(
crmClientData
.
getDistrictId
());
SysRegion
district
=
zpglService
.
getSysRegion
(
crmClientData
.
getDistrictId
());
// crmClientData.setZipCode(district.getZipCode());
// crmClientData.setZipCode(district.getZipCode());
...
@@ -1027,8 +1029,16 @@ public class CrmController {
...
@@ -1027,8 +1029,16 @@ public class CrmController {
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
CrmClientData
.
builder
().
id
(
crmClientFollow
.
getCid
()).
clientStatus
(
crmClientFollow
.
getClientStatus
())
.
lastFollowTime
(
new
Date
()).
build
().
updateById
();
// 更新客户最近跟进时间
oldData
.
setClientStatus
(
crmClientFollow
.
getClientStatus
());
oldData
.
setLastFollowTime
(
new
Date
());
if
(
crmClientFollow
.
getContractSigningDate
()!=
null
){
oldData
.
setContractSigningDate
(
crmClientFollow
.
getContractSigningDate
());
}
if
(
crmClientFollow
.
getContractEndDate
()!=
null
){
oldData
.
setContractEndDate
(
crmClientFollow
.
getContractEndDate
());
}
oldData
.
updateById
();
// 更新客户最近跟进时间
crmClientFollow
.
setOrgCode
(
orgCode
);
crmClientFollow
.
setOrgCode
(
orgCode
);
crmClientFollow
.
setCreateUser
(
empNum
);
crmClientFollow
.
setCreateUser
(
empNum
);
...
@@ -1998,7 +2008,7 @@ public class CrmController {
...
@@ -1998,7 +2008,7 @@ public class CrmController {
return
ResultUtil
.
data
(
crmListColorList
,
"成功"
);
return
ResultUtil
.
data
(
crmListColorList
,
"成功"
);
}
}
@
Pos
tMapping
(
value
=
"/getFollowUpMonth"
)
@
Ge
tMapping
(
value
=
"/getFollowUpMonth"
)
@ApiOperation
(
value
=
"获取当月待跟进客户列表"
,
httpMethod
=
"GET"
,
notes
=
"获取当月待跟进客户列表"
)
@ApiOperation
(
value
=
"获取当月待跟进客户列表"
,
httpMethod
=
"GET"
,
notes
=
"获取当月待跟进客户列表"
)
public
Result
<
Object
>
getFollowUpMonthList
(
@CurrentUser
UserBean
userBean
,
public
Result
<
Object
>
getFollowUpMonthList
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
...
@@ -2013,24 +2023,68 @@ public class CrmController {
...
@@ -2013,24 +2023,68 @@ public class CrmController {
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
required
=
false
)
Integer
unfollowedDays
,
@RequestParam
(
required
=
false
)
Integer
unfollowedDays
,
@RequestParam
(
required
=
false
)
Integer
followNumber
,
@RequestParam
(
required
=
false
)
Integer
followNumber
,
@RequestParam
(
required
=
false
)
Integer
industry
)
{
@RequestParam
(
required
=
false
)
Integer
industry
,
log
.
info
(
"crmClientDatahe状态"
,
type
);
@RequestParam
(
required
=
false
)
String
remindDay
)
{
log
.
info
(
"crmClientDatahe签约时间"
,
groupId
);
log
.
info
(
"crmClientData合同有效期"
,
status
);
Integer
empNum
=
getEmpNum
(
userBean
);
log
.
info
(
"crmClientData合同有效期"
,
like
);
Integer
orgCode
=
getOrgCode
(
userBean
);
log
.
info
(
"crmClientData合同有效期"
,
customerowner
);
log
.
info
(
"crmClientData合同有效期"
,
startCreateTime
);
if
(
endCreateTime
!=
null
&&
!(
""
).
equals
(
endCreateTime
))
{
log
.
info
(
"crmClientData合同有效期"
,
endCreateTime
);
endCreateTime
=
endCreateTime
.
substring
(
0
,
10
)
+
" 23:59:59"
;
log
.
info
(
"crmClientData合同有效期"
,
startFollowTime
);
}
log
.
info
(
"crmClientData合同有效期"
,
startFollowTime
);
if
(
endFollowTime
!=
null
&&
!(
""
).
equals
(
endFollowTime
))
{
log
.
info
(
"crmClientData合同有效期"
,
endFollowTime
);
endFollowTime
=
endFollowTime
.
substring
(
0
,
10
)
+
" 23:59:59"
;
log
.
info
(
"crmClientData合同有效期"
,
ifPhone
);
}
log
.
info
(
"crmClientData合同有效期"
,
pageNumber
);
QyzxEmpEntAsso
qyzxEmpEntAsso
=
QyzxEmpEntAsso
.
builder
().
build
()
log
.
info
(
"crmClientData合同有效期"
,
pageSize
);
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpEntAsso
>().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
orgCode
)
log
.
info
(
"crmClientData合同有效期"
,
unfollowedDays
);
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
empNum
));
log
.
info
(
"crmClientData合同有效期"
,
followNumber
);
if
(
qyzxEmpEntAsso
!=
null
&&
qyzxEmpEntAsso
.
getUserType
()
!=
null
log
.
info
(
"crmClientData合同有效期"
,
industry
);
&&
(
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_ADMIN
.
getType
()
List
<
CrmListColor
>
crmListColorList
=
CrmListColor
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmListColor
>().
lambda
().
eq
(
CrmListColor:
:
getDeleteFlag
,
0
));
||
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
{
return
ResultUtil
.
data
(
crmListColorList
,
"成功"
);
IPage
<
CrmClientData
>
page
=
new
Page
<
CrmClientData
>(
pageNumber
,
pageSize
);
List
<
CrmBusinessGroupMember
>
grouplis
=
CrmBusinessGroupMember
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmBusinessGroupMember
>().
lambda
().
eq
(
CrmBusinessGroupMember:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
CrmBusinessGroupMember:
:
getOrgCode
,
userBean
.
getOrgCode
()));
String
keywordStr
=
""
;
IPage
<
CrmClientData
>
datas
;
Integer
count
=
new
LambdaQueryChainWrapper
<
QyzxEmpEntAsso
>(
qyzxEmpEntAssoMapper
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
in
(
QyzxEmpEntAsso:
:
getUserType
,
"0,1"
)
.
count
();
if
(
count
>
0
)
{
datas
=
crmClientDataMapper
.
getCrmClientData4
(
page
,
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
,
remindDay
);
}
else
{
if
(
grouplis
.
size
()>
0
&&
grouplis
!=
null
)
{
StringBuffer
sb
=
new
StringBuffer
();
for
(
CrmBusinessGroupMember
grp
:
grouplis
)
{
sb
.
append
(
grp
.
getGid
()).
append
(
","
);
}
keywordStr
=
sb
.
deleteCharAt
(
sb
.
length
()
-
1
).
toString
();
}
datas
=
crmClientDataMapper
.
getCrmClientData5
(
page
,
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
,
remindDay
);
}
return
ResultUtil
.
pageData
(
datas
.
getRecords
(),
datas
.
getTotal
(),
"查询成功"
);
}
else
{
// 当前用户管理的组
List
<
Integer
>
gids
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
CrmClientData
>
crmClientDatas
=
new
ArrayList
<
CrmClientData
>();
if
(
gids
.
size
()>
0
)
{
for
(
Integer
gid
:
gids
)
{
List
<
CrmClientData
>
datas
=
crmClientDataMapper
.
getCrmClientData6
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
,
gid
,
remindDay
);
for
(
CrmClientData
data
:
datas
)
crmClientDatas
.
add
(
data
);
}
}
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
return
ResultUtil
.
pageData
(
result
,
(
long
)
crmClientDatas
.
size
(),
"查询成功"
);
}
}
}
}
}
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
View file @
18dfcaac
...
@@ -78,4 +78,33 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
...
@@ -78,4 +78,33 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
,
@Param
(
"gid"
)
Integer
gid
);
@Param
(
"industry"
)
Integer
industry
,
@Param
(
"gid"
)
Integer
gid
);
IPage
<
CrmClientData
>
getCrmClientData4
(
IPage
<
CrmClientData
>
page
,
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
,
@Param
(
"remindDay"
)
String
remindDay
);
IPage
<
CrmClientData
>
getCrmClientData5
(
IPage
<
CrmClientData
>
page
,
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
,
@Param
(
"remindDay"
)
String
remindDay
);
List
<
CrmClientData
>
getCrmClientData6
(
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
,
@Param
(
"gid"
)
Integer
gid
,
@Param
(
"remindDay"
)
String
remindDay
);
}
}
src/main/resources/mapping/crm/CrmClientDataMapper.xml
View file @
18dfcaac
...
@@ -239,4 +239,164 @@
...
@@ -239,4 +239,164 @@
</if>
</if>
ORDER BY ccd.create_time DESC;
ORDER BY ccd.create_time DESC;
</select>
</select>
<select
id=
"getCrmClientData4"
resultType=
"CrmClientData"
>
SELECT ccd.*
FROM crm_remind_rule crr
left join crm_client_data ccd on ccd.id=crr.crm_client_id
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
and crr.remind_day>=#{remindDay}
and crr.delete_flag = 0
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"keywordStr != null and keywordStr != ''"
>
AND ccd.belong_group IN (${keywordStr})
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
<select
id=
"getCrmClientData5"
resultType=
"CrmClientData"
>
SELECT ccd.*
FROM crm_remind_rule crr
left join crm_client_data ccd on ccd.id=crr.crm_client_id
where crr.delete_flag = 0
and ccd.belong_group = #{gid}
and crr.remind_day>=#{remindDay}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
<select
id=
"getCrmClientData6"
resultType=
"CrmClientData"
>
SELECT ccd.*
FROM crm_remind_rule crr
left join crm_client_data ccd on ccd.id=crr.crm_client_id
where crr.delete_flag = 0
AND ccr.crm_group_member = #{empNum}
AND ccr.org_code = #{orgCode}
and crr.remind_day>=#{remindDay}
<if
test=
"gid != null and gid > 0"
>
and ccd.belong_group = #{gid}
</if>
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment