wangning 7 years ago
parent 2203c4e869
commit 584eeff188

@ -136,23 +136,36 @@
</select>
<select id="countApproved" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
b.bd_id,
b.bd_name,
sum(b.proportion) num
FROM sys_client_bd b
INNER JOIN sys_clients c
ON c.client_id = b.client_id AND b.start_date <= c.approve_time AND (b.end_date > c.approve_time OR b.end_date IS NULL)
WHERE c.approve_time >= #{begin} AND c.approve_time < #{end} AND c.is_valid = 1 AND c.approve_result = 1
and b.is_valid=1
]]>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="source==1">and c.source=1</if>
<if test="source==2">and c.source!=1</if>
group by bd_id
order by num desc
select
a.bd_id,
a.bd_name,
sum(a.proportion) num
from sys_client_bd a inner join
(select bd_id,
max(create_time) create_time
from sys_client_bd
where client_id in(select client_id from sys_clients c where c.approve_time >= #{begin} AND c.approve_time < #{end} AND c.is_valid = 1 AND c.approve_result = 1
]]>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="source==1">and c.source=1</if>
<if test="source==2">and c.source!=1</if>
<![CDATA[
)
and start_date <=#{end}
and is_valid=1
AND (end_date > #{begin} OR end_date IS NULL)
GROUP BY bd_id,client_id
) b
on a.bd_id = b.bd_id and a.create_time = b.create_time
where a.is_valid = 1
]]>
group by bd_id
order by num desc
</select>
<select id="getBDSalePartnerReport" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.industry,c.royalpayindustry,

Loading…
Cancel
Save