2024-04-13 23:30:11 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsFunnelMapper">
|
|
|
|
|
2024-04-15 15:26:05 +08:00
|
|
|
<select id="selectCustomerCountByDate" resultType="java.lang.Long">
|
|
|
|
SELECT COUNT(*)
|
|
|
|
FROM crm_customer
|
|
|
|
WHERE deleted = 0
|
|
|
|
AND owner_user_id IN
|
|
|
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
|
|
|
#{userId}
|
|
|
|
</foreach>
|
|
|
|
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND
|
|
|
|
#{times[1],javaType=java.time.LocalDateTime}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectBusinessCountByDateAndEndStatus" resultType="java.lang.Long">
|
|
|
|
SELECT COUNT(*)
|
|
|
|
FROM crm_business
|
|
|
|
WHERE deleted = 0
|
|
|
|
<if test="status != null">
|
|
|
|
AND end_status = #{status}
|
|
|
|
</if>
|
|
|
|
AND owner_user_id IN
|
|
|
|
<foreach collection="reqVO.userIds" item="userId" open="(" close=")" separator=",">
|
|
|
|
#{userId}
|
|
|
|
</foreach>
|
|
|
|
AND create_time BETWEEN #{reqVO.times[0],javaType=java.time.LocalDateTime} AND
|
|
|
|
#{reqVO.times[1],javaType=java.time.LocalDateTime}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<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
|
|
|
|
FROM crm_business
|
|
|
|
WHERE deleted = 0 AND end_status IS NOT NULL
|
|
|
|
AND owner_user_id IN
|
|
|
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
|
|
|
#{userId}
|
|
|
|
</foreach>
|
|
|
|
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND
|
|
|
|
#{times[1],javaType=java.time.LocalDateTime}
|
|
|
|
GROUP BY end_status
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectBusinessSummaryGroupByDate"
|
2024-04-14 16:31:53 +08:00
|
|
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByDateRespVO">
|
2024-04-14 21:22:02 +08:00
|
|
|
SELECT
|
2024-04-15 15:26:05 +08:00
|
|
|
DATE_FORMAT(create_time, '%Y-%m-%d') AS time,
|
|
|
|
COUNT(*) AS businessCreateCount,
|
|
|
|
SUM(total_price) AS totalPrice
|
2024-04-14 16:31:53 +08:00
|
|
|
FROM crm_business
|
|
|
|
WHERE deleted = 0
|
|
|
|
AND owner_user_id IN
|
2024-04-15 15:26:05 +08:00
|
|
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
|
|
|
#{userId}
|
|
|
|
</foreach>
|
|
|
|
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND
|
|
|
|
#{times[1],javaType=java.time.LocalDateTime}
|
2024-04-14 16:31:53 +08:00
|
|
|
GROUP BY time
|
|
|
|
</select>
|
|
|
|
|
2024-04-13 23:30:11 +08:00
|
|
|
</mapper>
|