Commit c40ea1eaa6ac4eb6d4ca0d4c86492fe205535160

Authored by YunaiV
1 parent bba32c6b

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

yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/bi/CrmBiRankingMapper.java
@@ -77,4 +77,5 @@ public interface CrmBiRankingMapper { @@ -77,4 +77,5 @@ public interface CrmBiRankingMapper {
77 * @return 跟进客户数排行榜 77 * @return 跟进客户数排行榜
78 */ 78 */
79 List<CrmBiRanKRespVO> selectFollowCustomerCountRank(CrmBiRankReqVO rankReqVO); 79 List<CrmBiRanKRespVO> selectFollowCustomerCountRank(CrmBiRankReqVO rankReqVO);
  80 +
80 } 81 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/CrmBiRankingService.java
@@ -76,4 +76,5 @@ public interface CrmBiRankingService { @@ -76,4 +76,5 @@ public interface CrmBiRankingService {
76 * @return 跟进客户数排行榜 76 * @return 跟进客户数排行榜
77 */ 77 */
78 List<CrmBiRanKRespVO> getFollowCustomerCountRank(CrmBiRankReqVO rankReqVO); 78 List<CrmBiRanKRespVO> getFollowCustomerCountRank(CrmBiRankReqVO rankReqVO);
  79 +
79 } 80 }
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/bi/CrmBiRankingMapper.xml
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 #{userId} 13 #{userId}
14 </foreach> 14 </foreach>
15 AND order_date between #{times[0],javaType=java.time.LocalDateTime} and 15 AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
16 - #{times[1],javaType=java.time.LocalDateTime} 16 + #{times[1],javaType=java.time.LocalDateTime}
17 GROUP BY owner_user_id 17 GROUP BY owner_user_id
18 </select> 18 </select>
19 19
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #{userId} 28 #{userId}
29 </foreach> 29 </foreach>
30 AND return_time between #{times[0],javaType=java.time.LocalDateTime} and 30 AND return_time between #{times[0],javaType=java.time.LocalDateTime} and
31 - #{times[1],javaType=java.time.LocalDateTime} 31 + #{times[1],javaType=java.time.LocalDateTime}
32 GROUP BY owner_user_id 32 GROUP BY owner_user_id
33 </select> 33 </select>
34 34
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 #{userId} 43 #{userId}
44 </foreach> 44 </foreach>
45 AND order_date between #{times[0],javaType=java.time.LocalDateTime} and 45 AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
46 - #{times[1],javaType=java.time.LocalDateTime} 46 + #{times[1],javaType=java.time.LocalDateTime}
47 GROUP BY owner_user_id 47 GROUP BY owner_user_id
48 </select> 48 </select>
49 49
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 #{userId} 59 #{userId}
60 </foreach> 60 </foreach>
61 AND order_date between #{times[0],javaType=java.time.LocalDateTime} and 61 AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
62 - #{times[1],javaType=java.time.LocalDateTime} 62 + #{times[1],javaType=java.time.LocalDateTime}
63 GROUP BY owner_user_id 63 GROUP BY owner_user_id
64 </select> 64 </select>
65 65
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 #{userId} 73 #{userId}
74 </foreach> 74 </foreach>
75 AND create_time between #{times[0],javaType=java.time.LocalDateTime} and 75 AND create_time between #{times[0],javaType=java.time.LocalDateTime} and
76 - #{times[1],javaType=java.time.LocalDateTime} 76 + #{times[1],javaType=java.time.LocalDateTime}
77 GROUP BY owner_user_id 77 GROUP BY owner_user_id
78 </select> 78 </select>
79 79
@@ -87,14 +87,15 @@ @@ -87,14 +87,15 @@
87 #{userId} 87 #{userId}
88 </foreach> 88 </foreach>
89 AND create_time between #{times[0],javaType=java.time.LocalDateTime} and 89 AND create_time between #{times[0],javaType=java.time.LocalDateTime} and
90 - #{times[1],javaType=java.time.LocalDateTime} 90 + #{times[1],javaType=java.time.LocalDateTime}
91 GROUP BY owner_user_id 91 GROUP BY owner_user_id
92 </select> 92 </select>
93 93
94 <select id="selectFollowCountRank" 94 <select id="selectFollowCountRank"
95 resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO"> 95 resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
96 SELECT COUNT(1) AS count, cc.owner_user_id 96 SELECT COUNT(1) AS count, cc.owner_user_id
97 - FROM crm_follow_up_record AS cfur LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) 97 + FROM crm_follow_up_record AS cfur
  98 + LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
98 WHERE cfur.deleted = 0 99 WHERE cfur.deleted = 0
99 AND cc.deleted = 0 100 AND cc.deleted = 0
100 AND cc.owner_user_id in 101 AND cc.owner_user_id in
@@ -102,14 +103,15 @@ @@ -102,14 +103,15 @@
102 #{userId} 103 #{userId}
103 </foreach> 104 </foreach>
104 AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and 105 AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and
105 - #{times[1],javaType=java.time.LocalDateTime} 106 + #{times[1],javaType=java.time.LocalDateTime}
106 GROUP BY cc.owner_user_id 107 GROUP BY cc.owner_user_id
107 </select> 108 </select>
108 109
109 <select id="selectFollowCustomerCountRank" 110 <select id="selectFollowCustomerCountRank"
110 resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO"> 111 resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
111 SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id 112 SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id
112 - FROM crm_follow_up_record AS cfur LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) 113 + FROM crm_follow_up_record AS cfur
  114 + LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
113 WHERE cfur.deleted = 0 115 WHERE cfur.deleted = 0
114 AND cc.deleted = 0 116 AND cc.deleted = 0
115 AND cc.owner_user_id in 117 AND cc.owner_user_id in
@@ -117,7 +119,7 @@ @@ -117,7 +119,7 @@
117 #{userId} 119 #{userId}
118 </foreach> 120 </foreach>
119 AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and 121 AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and
120 - #{times[1],javaType=java.time.LocalDateTime} 122 + #{times[1],javaType=java.time.LocalDateTime}
121 GROUP BY cc.owner_user_id 123 GROUP BY cc.owner_user_id
122 </select> 124 </select>
123 125