Commit 2a3f92a3 by 龙于生

我的客户、所有客户界面接口新增筛选条件:未跟进天数、跟进总次数、行业

parent a03ba7f1
......@@ -10,6 +10,9 @@ package cn.timer.api.dao.crm;
import java.util.List;
import cn.timer.api.dto.crm.CrmCartogramCountExportDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -38,4 +41,41 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
@RequestParam(name = "belongGroup", required = false) Integer belongGroup,
@RequestParam(name = "startCreateTime", required = false) String startCreateTime,
@RequestParam(name = "endCreateTime", required = false) String endCreateTime);
List<CrmClientData> getCrmClientData(@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("typei") Integer typei,
@Param("unfollowedDays") Integer unfollowedDays, @Param("followNumber") Integer followNumber,
@Param("industry") Integer industry);
IPage<CrmClientData> getCrmClientData1(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);
IPage<CrmClientData> getCrmClientData2(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);
List<CrmClientData> getCrmClientData3(@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);
}
\ No newline at end of file
......@@ -6,11 +6,12 @@
<select id="crmCartogram"
resultType="cn.timer.api.dto.crm.CrmCartogramDto">
SELECT
province_id,province as provinceName,count(province_id) num
province_id,city as provinceName,count(address) num
FROM
crm_client_data
WHERE
org_code = #{orgCode}
and client_cellphone != ''
<if test='null != belongUser and belongUser !=""'>AND
belong_user = #{belongUser}
</if>
......@@ -24,7 +25,7 @@
create_time <![CDATA[<=]]> #{endCreateTime}
</if>
GROUP BY
province_id
city
</select>
<select id="selectCrmCartogramCount" resultType="cn.timer.api.dto.crm.CrmCartogramCountExportDto">
SELECT belong_user_name,
......@@ -50,4 +51,192 @@
</where>
GROUP BY ccd.belong_user
</select>
<select id="getCrmClientData" resultType="CrmClientData">
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<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="status != null and status > 0">
AND ccd.client_status = #{status}
</if>
<if test="typei != null and typei > 0">
AND ccd.client_type = #{typei}
</if>
<if test="startCreateTime != null and endCreateTime != null">
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.belong_user_name LIKE CONCAT('%', #{like}, '%')
OR 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 ccf
WHERE ccf.cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC
</select>
<select id="getCrmClientData1" resultType="CrmClientData">
SELECT ccd.*
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<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="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="status != null and status >= 0">
AND ccd.client_status = #{status}
</if>
<if test="customerowner != null and customerowner != ''">
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</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="getCrmClientData2" resultType="CrmClientData">
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<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="getCrmClientData3" resultType="CrmClientData">
SELECT *
FROM crm_client_data ccd
WHERE ccd.belong_group = #{gid}
<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>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment