|
|
@@ -877,8 +877,9 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
|
|
|
a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
|
|
|
a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
|
|
|
- dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount
|
|
|
- <if test="specially == 2">
|
|
|
+ dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
|
|
|
+ a.sales_type salesType, a.channel_id channelId ,a.other
|
|
|
+ <if test="specially == 2">
|
|
|
,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId
|
|
|
</if>
|
|
|
<if test="specially == 4">
|
|
|
@@ -1604,4 +1605,38 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
select order_no orderNo,contract_no contractNo
|
|
|
from t_order_new where delete_sign in (0,2) and buyer_id = #{uid}
|
|
|
</select>
|
|
|
+ <select id="orderSalesSource" resultType="com.goafanti.order.bo.OutOrderSalesSource">
|
|
|
+ select y.province,dg.name ,y.total_amount,y.counts,y.dh,y.dh/y.counts dhl,y.wl,y.wl/y.counts wll,
|
|
|
+ y.qd,y.qd/y.counts qdl,y.zjs,y.zjs/y.counts zjsl,y.qt,y.qt/y.counts qtl,
|
|
|
+ y.gxfg,y.gxfg/y.counts gxfgl,y.qtfg,y.qtfg/y.counts qtfgl
|
|
|
+ from (select x.province,sum(x.total_amount)total_amount,sum(x.counts)counts,
|
|
|
+ sum(x.dh)dh,sum(x.wl)wl,sum(x.qd)qd, sum(x.zjs)zjs, sum(x.qt)qt,
|
|
|
+ sum(x.gxfg)gxfg, sum(x.qtfg)qtfg
|
|
|
+ from ( select a.order_no ,a.order_dep ,b.province ,1 counts,a.total_amount,a.sales_type ,
|
|
|
+ case a.sales_type when 0 then 1 when 1 then 1 else 0 end dh,
|
|
|
+ case a.sales_type when 2 then 1 else 0 end wl,
|
|
|
+ case a.sales_type when 3 then 1 else 0 end qd,
|
|
|
+ case a.sales_type when 4 then 1 else 0 end zjs,
|
|
|
+ case a.sales_type when 5 then 1 else 0 end qt,
|
|
|
+ case a.sales_type when 6 then 1 else 0 end gxfg,
|
|
|
+ case a.sales_type when 7 then 1 else 0 end qtfg
|
|
|
+ from t_order_new a left join department b on a.order_dep =b.id
|
|
|
+ where a.delete_sign in (0,2) and a.process_status > 4
|
|
|
+ <if test=" startDate !=null and endDate != null">
|
|
|
+ and a.create_time between #{startDate} and #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test=" depId !=null">
|
|
|
+ and a.order_dep= #{depId}
|
|
|
+ </if>
|
|
|
+ <if test=" province !=null">
|
|
|
+ and b.province = #{province}
|
|
|
+ </if>
|
|
|
+ )x group by x.province)y left join district_glossory dg on y.province=dg.id
|
|
|
+ <if test=" sort ==0">
|
|
|
+ order by y.total_amount
|
|
|
+ </if>
|
|
|
+ <if test=" sort ==1">
|
|
|
+ order by y.counts
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|