SELECT nickname from system_user where id=c.customer_service
) as salesman,c.customer_service as salesmanid,
source,create_time as createtime,
(u_d.dept_id) as deptid,(u_d.deptName) as deptname,
<!--总V值-->
(SELECT round(sum(vz),2) FROM view_order_businesstime WHERE customer_id = c.id AND business_time BETWEEN '${sDate}' AND '${eDate}') AS allsumvolume,
(SELECT round(sum(vz),2) FROM view_order_businesstime WHERE customer_id = c.id AND business_time BETWEEN '${sDuiBiDate}' AND '${eDuiBiDate}') as allsumvolumeTb,
<!--海运-->
(SELECT round(sum(charge_volume),2) FROM view_order_businesstime WHERE customer_id = c.id AND transport_id = 1 AND business_time BETWEEN '${sDate}' AND '${eDate}') AS sumvolume1,
(SELECT round(sum(charge_volume),2) FROM view_order_businesstime WHERE customer_id = c.id AND transport_id = 1 AND business_time BETWEEN '${sDuiBiDate}' AND '${eDuiBiDate}') as sumvolumeTb1,
<!--空运-->
(SELECT round(sum(charge_weight),2)*100 FROM view_order_businesstime WHERE customer_id = c.id AND transport_id = 3 AND business_time BETWEEN '${sDate}' AND '${eDate}') AS sumweight3,
(SELECT round(sum(charge_weight),2)*100 FROM view_order_businesstime WHERE customer_id = c.id AND transport_id = 3 AND business_time BETWEEN '${sDuiBiDate}' AND '${eDuiBiDate}') as sumweightTb3
from ecw_customer c left join (SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id) AS u_d ON c.customer_service = u_d.userid
<includerefid="WherePage"/>
ORDER BY allsumvolume desc
limit 0,30
</select>
<sqlid="WherePage">
<where>
and c.deleted = 0
<iftest="salesmanid!=null and salesmanid!=''">
and c.customer_service= #{salesmanid}
</if>
</where>
</sql>
<selectid="GetCount"resultType="java.lang.Long">
SELECT count(1)
from ecw_customer c left join
(SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id