Commit b20ff55511c2206a0b78d8081aeeb8e3895ecb3b
1 parent
cc82e471
code review:销售统计
Showing
1 changed file
with
16 additions
and
9 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/statistics/CrmStatisticsFunnelMapper.xml
| ... | ... | @@ -3,19 +3,23 @@ |
| 3 | 3 | <mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsFunnelMapper"> |
| 4 | 4 | |
| 5 | 5 | <select id="selectCustomerCountByDate" resultType="java.lang.Long"> |
| 6 | - SELECT COUNT(*) | |
| 6 | + SELECT | |
| 7 | + COUNT(*) | |
| 7 | 8 | FROM crm_customer |
| 8 | 9 | WHERE deleted = 0 |
| 9 | 10 | AND owner_user_id IN |
| 11 | + <!-- TODO @puhui999:这个 foreach 搞个缩进哈 - --> | |
| 10 | 12 | <foreach collection="userIds" item="userId" open="(" close=")" separator=","> |
| 11 | 13 | #{userId} |
| 12 | 14 | </foreach> |
| 13 | 15 | AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND |
| 16 | + <!-- TODO @puhui999:下面这个,就不缩进啦 - --> | |
| 14 | 17 | #{times[1],javaType=java.time.LocalDateTime} |
| 15 | 18 | </select> |
| 16 | 19 | |
| 17 | 20 | <select id="selectBusinessCountByDateAndEndStatus" resultType="java.lang.Long"> |
| 18 | - SELECT COUNT(*) | |
| 21 | + SELECT | |
| 22 | + COUNT(*) | |
| 19 | 23 | FROM crm_business |
| 20 | 24 | WHERE deleted = 0 |
| 21 | 25 | <if test="status != null"> |
| ... | ... | @@ -31,7 +35,10 @@ |
| 31 | 35 | |
| 32 | 36 | <select id="selectBusinessSummaryListGroupByEndStatus" |
| 33 | 37 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByEndStatusRespVO"> |
| 34 | - SELECT end_status AS endStatus,COUNT(*) AS businessCount, SUM(total_price) AS totalPrice | |
| 38 | + SELECT | |
| 39 | + end_status AS endStatus, | |
| 40 | + COUNT(*) AS businessCount, | |
| 41 | + SUM(total_price) AS totalPrice | |
| 35 | 42 | FROM crm_business |
| 36 | 43 | WHERE deleted = 0 AND end_status IS NOT NULL |
| 37 | 44 | AND owner_user_id IN |
| ... | ... | @@ -46,9 +53,9 @@ |
| 46 | 53 | <select id="selectBusinessSummaryGroupByDate" |
| 47 | 54 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByDateRespVO"> |
| 48 | 55 | SELECT |
| 49 | - DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 50 | - COUNT(*) AS businessCreateCount, | |
| 51 | - SUM(total_price) AS totalPrice | |
| 56 | + DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 57 | + COUNT(*) AS businessCreateCount, | |
| 58 | + SUM(total_price) AS totalPrice | |
| 52 | 59 | FROM crm_business |
| 53 | 60 | WHERE deleted = 0 |
| 54 | 61 | AND owner_user_id IN |
| ... | ... | @@ -63,9 +70,9 @@ |
| 63 | 70 | <select id="selectBusinessInversionRateSummaryByDate" |
| 64 | 71 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessInversionRateSummaryByDateRespVO"> |
| 65 | 72 | SELECT |
| 66 | - DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 67 | - COUNT(*) AS businessCount, | |
| 68 | - SUM(IF(end_status = 1, 1, 0)) AS businessWinCount | |
| 73 | + DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 74 | + COUNT(*) AS businessCount, | |
| 75 | + SUM(IF(end_status = 1, 1, 0)) AS businessWinCount | |
| 69 | 76 | FROM crm_business |
| 70 | 77 | WHERE deleted = 0 |
| 71 | 78 | AND owner_user_id IN | ... | ... |