|
|
@@ -725,13 +725,17 @@ select
|
|
|
select a.id,a.order_no orderNo,b.contract_no contractNo, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes,c.nickname,b.order_type orderType,
|
|
|
date_format(b.create_time,'%Y-%m-%d %H:%i:%S')establishTimes, b.order_status orderStatus,b.total_amount totalAmount,a.status ,
|
|
|
b.settlement_amount settlementAmount,(b.total_amount-b.settlement_amount) arrears,d.name salesmanName,e.name depName,a.`type`,
|
|
|
- a.process_state processState from (select max(id)id from new_order_change group by order_no) noc left join new_order_change a on noc.id=a.id
|
|
|
+ a.process_state processState from new_order_change noc left join new_order_change a on noc.id=a.id
|
|
|
left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join admin d on b.salesman_id=d.id
|
|
|
left join department e on b.order_dep=e.id
|
|
|
- <if test="processState==2 or processState==3 ">
|
|
|
- left join (select order_no, consultant_id, manager_id from t_order_task a where consultant_id is not null and manager_id is not null
|
|
|
- group by order_no, consultant_id, manager_id) x on a.order_no = x.order_no
|
|
|
- </if>
|
|
|
+ <if test="processState==2">
|
|
|
+ left join (select order_no, consultant_id from t_order_task where consultant_id is not null
|
|
|
+ group by order_no, consultant_id)x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
+ <if test="processState==3">
|
|
|
+ left join (select order_no, manager_id from t_order_task a where manager_id is not null
|
|
|
+ group by order_no, manager_id) x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
where 1=1
|
|
|
<if test="processState==0">
|
|
|
and b.salesman_id= #{aid}
|
|
|
@@ -743,10 +747,10 @@ select
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="processState==2 ">
|
|
|
- and x.consultant_id=#{aid} and process_state >= 2
|
|
|
+ and x.consultant_id=#{aid} and a.process_state >= 2
|
|
|
</if>
|
|
|
<if test="processState==3 ">
|
|
|
- and x.manager_id=#{aid} and process_state >= 3
|
|
|
+ and x.manager_id=#{aid} and a.process_state >= 3
|
|
|
</if>
|
|
|
<if test="processState==5 and aid !=null">
|
|
|
and e.finance_id =#{aid}
|
|
|
@@ -824,13 +828,17 @@ select
|
|
|
</select>
|
|
|
|
|
|
<select id="selectOrderChangeCount" resultType="java.lang.Integer">
|
|
|
- select count(*) from (select max(id)id from new_order_change group by order_no) noc left join new_order_change a on noc.id=a.id
|
|
|
+ select count(*) from new_order_change noc left join new_order_change a on noc.id=a.id
|
|
|
left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id
|
|
|
left join admin d on b.salesman_id=d.id left join department e on b.order_dep=e.id
|
|
|
- <if test="processState==2 or processState==3 ">
|
|
|
- left join (select order_no, consultant_id, manager_id from t_order_task a where consultant_id is not null and manager_id is not null
|
|
|
- group by order_no, consultant_id, manager_id) x on a.order_no = x.order_no
|
|
|
- </if>
|
|
|
+ <if test="processState==2">
|
|
|
+ left join (select order_no, consultant_id from t_order_task where consultant_id is not null
|
|
|
+ group by order_no, consultant_id)x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
+ <if test="processState==3">
|
|
|
+ left join (select order_no, manager_id from t_order_task a where manager_id is not null
|
|
|
+ group by order_no, manager_id) x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
where 1=1
|
|
|
<if test="processState==0">
|
|
|
and b.salesman_id= #{aid}
|
|
|
@@ -842,10 +850,10 @@ select
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="processState==2 ">
|
|
|
- and x.consultant_id=#{aid} and process_state >= 2
|
|
|
+ and x.consultant_id=#{aid} and a.process_state >= 2
|
|
|
</if>
|
|
|
<if test="processState==3 ">
|
|
|
- and x.manager_id=#{aid} and process_state >= 3
|
|
|
+ and x.manager_id=#{aid} and a.process_state >= 3
|
|
|
</if>
|
|
|
<if test="processState==5 and aid !=null">
|
|
|
and e.finance_id =#{aid}
|