wangning 8 years ago
parent 2203c4e869
commit 584eeff188

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

Loading…
Cancel
Save