Upd:客户订单交易数据修改为无交易也显示日期

master
dulingling 5 years ago
parent 86a754451c
commit 073df7b0ee

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.3.21</version>
<version>1.3.22</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.4.0</jib-maven-plugin.version>

@ -93,36 +93,52 @@
<select id="getSumCustomersAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT sum(s.customers) customers,sum(s.orders) orders,sum(s.new_customers) new_customers,
sum(s.old_customers) old_customers,sum(s.total) total, sum(s.total)/sum(s.customers) single_amount,
date_format(s.date,'%d/%m/%Y') trade_date
FROM statistics_customer_order s
LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
]]>
select date_format(calendar.datelist,'%d/%m/%Y') AS trade_date,
IFNULL(customerStatic.customers,0) AS customers,
IFNULL(customerStatic.orders,0) AS orders,
IFNULL(customerStatic.new_customers,0) AS new_customers,
IFNULL(customerStatic.old_customers,0) AS old_customers,
IFNULL(customerStatic.total,0) AS total,
IFNULL(customerStatic.single_amount,0) AS single_amount
FROM calendar
LEFT JOIN
(SELECT sum(s.customers) customers,sum(s.orders) orders,sum(s.new_customers) new_customers,
sum(s.old_customers) old_customers,sum(s.total) total, sum(s.total)/sum(s.customers) single_amount,
date_format(s.date,'%Y-%m-%d') trade_date
FROM statistics_customer_order s
LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
]]>
<where>
<if test="client_ids!=null">
AND s.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and s.client_id=#{client_id}
</if>
<if test="channel!=null">and s.channel = #{channel}</if>
<if test="begin!=null">and s.date &gt;= #{begin}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
<if test="org_id!=null">and c.org_id = #{org_id}</if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>
)
</if>
</where>
GROUP BY s.date
) AS customerStatic
ON calendar.datelist = customerStatic.trade_date
<where>
<if test="client_ids!=null">
AND s.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and s.client_id=#{client_id}
</if>
<if test="channel!=null">and s.channel = #{channel}</if>
<if test="begin!=null">and s.date &gt;= #{begin}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
<if test="org_id!=null">and c.org_id = #{org_id}</if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>
)
</if>
<if test="begin!=null">and calendar.datelist &gt;= #{begin}</if>
<if test="end!=null">and calendar.datelist &lt; #{end}</if>
</where>
GROUP BY s.date ORDER BY date DESC
ORDER BY calendar.datelist DESC
</select>
<select id="getSumChannelAnalysis" resultType="com.alibaba.fastjson.JSONObject">

Loading…
Cancel
Save