📖 CRM:code review 商业智能的排行版

This commit is contained in:
YunaiV 2024-02-17 18:14:28 +08:00
parent bba32c6ba3
commit c40ea1eaa6
3 changed files with 14 additions and 10 deletions

View File

@ -77,4 +77,5 @@ public interface CrmBiRankingMapper {
* @return 跟进客户数排行榜 * @return 跟进客户数排行榜
*/ */
List<CrmBiRanKRespVO> selectFollowCustomerCountRank(CrmBiRankReqVO rankReqVO); List<CrmBiRanKRespVO> selectFollowCustomerCountRank(CrmBiRankReqVO rankReqVO);
} }

View File

@ -76,4 +76,5 @@ public interface CrmBiRankingService {
* @return 跟进客户数排行榜 * @return 跟进客户数排行榜
*/ */
List<CrmBiRanKRespVO> getFollowCustomerCountRank(CrmBiRankReqVO rankReqVO); List<CrmBiRanKRespVO> getFollowCustomerCountRank(CrmBiRankReqVO rankReqVO);
} }

View File

@ -13,7 +13,7 @@
#{userId} #{userId}
</foreach> </foreach>
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY owner_user_id GROUP BY owner_user_id
</select> </select>
@ -28,7 +28,7 @@
#{userId} #{userId}
</foreach> </foreach>
AND return_time between #{times[0],javaType=java.time.LocalDateTime} and AND return_time between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY owner_user_id GROUP BY owner_user_id
</select> </select>
@ -43,7 +43,7 @@
#{userId} #{userId}
</foreach> </foreach>
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY owner_user_id GROUP BY owner_user_id
</select> </select>
@ -59,7 +59,7 @@
#{userId} #{userId}
</foreach> </foreach>
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY owner_user_id GROUP BY owner_user_id
</select> </select>
@ -73,7 +73,7 @@
#{userId} #{userId}
</foreach> </foreach>
AND create_time between #{times[0],javaType=java.time.LocalDateTime} and AND create_time between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY owner_user_id GROUP BY owner_user_id
</select> </select>
@ -87,14 +87,15 @@
#{userId} #{userId}
</foreach> </foreach>
AND create_time between #{times[0],javaType=java.time.LocalDateTime} and AND create_time between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY owner_user_id GROUP BY owner_user_id
</select> </select>
<select id="selectFollowCountRank" <select id="selectFollowCountRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO"> resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
SELECT COUNT(1) AS count, cc.owner_user_id SELECT COUNT(1) AS count, cc.owner_user_id
FROM crm_follow_up_record AS cfur LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) FROM crm_follow_up_record AS cfur
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
WHERE cfur.deleted = 0 WHERE cfur.deleted = 0
AND cc.deleted = 0 AND cc.deleted = 0
AND cc.owner_user_id in AND cc.owner_user_id in
@ -102,14 +103,15 @@
#{userId} #{userId}
</foreach> </foreach>
AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY cc.owner_user_id GROUP BY cc.owner_user_id
</select> </select>
<select id="selectFollowCustomerCountRank" <select id="selectFollowCustomerCountRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO"> resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id
FROM crm_follow_up_record AS cfur LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) FROM crm_follow_up_record AS cfur
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
WHERE cfur.deleted = 0 WHERE cfur.deleted = 0
AND cc.deleted = 0 AND cc.deleted = 0
AND cc.owner_user_id in AND cc.owner_user_id in
@ -117,7 +119,7 @@
#{userId} #{userId}
</foreach> </foreach>
AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and
#{times[1],javaType=java.time.LocalDateTime} #{times[1],javaType=java.time.LocalDateTime}
GROUP BY cc.owner_user_id GROUP BY cc.owner_user_id
</select> </select>