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,19 +3,23 @@ | ||
| 3 | <mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsFunnelMapper"> | 3 | <mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsFunnelMapper"> |
| 4 | 4 | ||
| 5 | <select id="selectCustomerCountByDate" resultType="java.lang.Long"> | 5 | <select id="selectCustomerCountByDate" resultType="java.lang.Long"> |
| 6 | - SELECT COUNT(*) | 6 | + SELECT |
| 7 | + COUNT(*) | ||
| 7 | FROM crm_customer | 8 | FROM crm_customer |
| 8 | WHERE deleted = 0 | 9 | WHERE deleted = 0 |
| 9 | AND owner_user_id IN | 10 | AND owner_user_id IN |
| 11 | + <!-- TODO @puhui999:这个 foreach 搞个缩进哈 - --> | ||
| 10 | <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | 12 | <foreach collection="userIds" item="userId" open="(" close=")" separator=","> |
| 11 | #{userId} | 13 | #{userId} |
| 12 | </foreach> | 14 | </foreach> |
| 13 | AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | 15 | AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND |
| 16 | + <!-- TODO @puhui999:下面这个,就不缩进啦 - --> | ||
| 14 | #{times[1],javaType=java.time.LocalDateTime} | 17 | #{times[1],javaType=java.time.LocalDateTime} |
| 15 | </select> | 18 | </select> |
| 16 | 19 | ||
| 17 | <select id="selectBusinessCountByDateAndEndStatus" resultType="java.lang.Long"> | 20 | <select id="selectBusinessCountByDateAndEndStatus" resultType="java.lang.Long"> |
| 18 | - SELECT COUNT(*) | 21 | + SELECT |
| 22 | + COUNT(*) | ||
| 19 | FROM crm_business | 23 | FROM crm_business |
| 20 | WHERE deleted = 0 | 24 | WHERE deleted = 0 |
| 21 | <if test="status != null"> | 25 | <if test="status != null"> |
| @@ -31,7 +35,10 @@ | @@ -31,7 +35,10 @@ | ||
| 31 | 35 | ||
| 32 | <select id="selectBusinessSummaryListGroupByEndStatus" | 36 | <select id="selectBusinessSummaryListGroupByEndStatus" |
| 33 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByEndStatusRespVO"> | 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 | FROM crm_business | 42 | FROM crm_business |
| 36 | WHERE deleted = 0 AND end_status IS NOT NULL | 43 | WHERE deleted = 0 AND end_status IS NOT NULL |
| 37 | AND owner_user_id IN | 44 | AND owner_user_id IN |
| @@ -46,9 +53,9 @@ | @@ -46,9 +53,9 @@ | ||
| 46 | <select id="selectBusinessSummaryGroupByDate" | 53 | <select id="selectBusinessSummaryGroupByDate" |
| 47 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByDateRespVO"> | 54 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByDateRespVO"> |
| 48 | SELECT | 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 | FROM crm_business | 59 | FROM crm_business |
| 53 | WHERE deleted = 0 | 60 | WHERE deleted = 0 |
| 54 | AND owner_user_id IN | 61 | AND owner_user_id IN |
| @@ -63,9 +70,9 @@ | @@ -63,9 +70,9 @@ | ||
| 63 | <select id="selectBusinessInversionRateSummaryByDate" | 70 | <select id="selectBusinessInversionRateSummaryByDate" |
| 64 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessInversionRateSummaryByDateRespVO"> | 71 | resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessInversionRateSummaryByDateRespVO"> |
| 65 | SELECT | 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 | FROM crm_business | 76 | FROM crm_business |
| 70 | WHERE deleted = 0 | 77 | WHERE deleted = 0 |
| 71 | AND owner_user_id IN | 78 | AND owner_user_id IN |