code review:销售统计

This commit is contained in:
YunaiV 2024-04-18 09:19:07 +08:00
parent cc82e471ea
commit b20ff55511

View File

@ -3,19 +3,23 @@
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsFunnelMapper">
<select id="selectCustomerCountByDate" resultType="java.lang.Long">
SELECT COUNT(*)
SELECT
COUNT(*)
FROM crm_customer
WHERE deleted = 0
AND owner_user_id IN
<!-- TODO @puhui999这个 foreach 搞个缩进哈 - -->
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND
<!-- TODO @puhui999下面这个就不缩进啦 - -->
#{times[1],javaType=java.time.LocalDateTime}
</select>
<select id="selectBusinessCountByDateAndEndStatus" resultType="java.lang.Long">
SELECT COUNT(*)
SELECT
COUNT(*)
FROM crm_business
WHERE deleted = 0
<if test="status != null">
@ -31,7 +35,10 @@
<select id="selectBusinessSummaryListGroupByEndStatus"
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByEndStatusRespVO">
SELECT end_status AS endStatus,COUNT(*) AS businessCount, SUM(total_price) AS totalPrice
SELECT
end_status AS endStatus,
COUNT(*) AS businessCount,
SUM(total_price) AS totalPrice
FROM crm_business
WHERE deleted = 0 AND end_status IS NOT NULL
AND owner_user_id IN
@ -46,9 +53,9 @@
<select id="selectBusinessSummaryGroupByDate"
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByDateRespVO">
SELECT
DATE_FORMAT(create_time, '%Y-%m-%d') AS time,
COUNT(*) AS businessCreateCount,
SUM(total_price) AS totalPrice
DATE_FORMAT(create_time, '%Y-%m-%d') AS time,
COUNT(*) AS businessCreateCount,
SUM(total_price) AS totalPrice
FROM crm_business
WHERE deleted = 0
AND owner_user_id IN
@ -63,9 +70,9 @@
<select id="selectBusinessInversionRateSummaryByDate"
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessInversionRateSummaryByDateRespVO">
SELECT
DATE_FORMAT(create_time, '%Y-%m-%d') AS time,
COUNT(*) AS businessCount,
SUM(IF(end_status = 1, 1, 0)) AS businessWinCount
DATE_FORMAT(create_time, '%Y-%m-%d') AS time,
COUNT(*) AS businessCount,
SUM(IF(end_status = 1, 1, 0)) AS businessWinCount
FROM crm_business
WHERE deleted = 0
AND owner_user_id IN