|
|
@@ -754,15 +754,13 @@ select
|
|
|
b.settlement_amount settlementAmount,(b.total_amount-b.settlement_amount) arrears,d.name salesmanName,e.name depName,a.`type`,
|
|
|
a.process_state processState,a.back_status backStatus 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">
|
|
|
- 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
|
|
|
+ left join department e on b.order_dep=e.id
|
|
|
+ <if test="processState==2">
|
|
|
+ left join (select order_no, aid from order_examine where`type`=0)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>
|
|
|
+ left join (select order_no, aid from order_examine where`type`=1)x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
where 1=1
|
|
|
<if test="processState==0">
|
|
|
and b.salesman_id= #{aid}
|
|
|
@@ -774,16 +772,16 @@ select
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="processState==2 and complete !=5">
|
|
|
- and x.consultant_id=#{aid} and a.process_state >= 2
|
|
|
+ and x.aid=#{aid} and a.process_state >= 2
|
|
|
</if>
|
|
|
<if test="processState==3 and complete !=5">
|
|
|
- and x.manager_id=#{aid} and a.process_state >= 3
|
|
|
+ and x.aid=#{aid} and a.process_state >= 3
|
|
|
</if>
|
|
|
<if test="processState==2 and complete ==5">
|
|
|
- and x.consultant_id=#{aid} and a.back_status >= #{processState}
|
|
|
+ and x.aid=#{aid} and a.back_status >= #{processState}
|
|
|
</if>
|
|
|
<if test="processState==3 and complete ==5">
|
|
|
- and x.manager_id=#{aid} and a.back_status >= #{processState}
|
|
|
+ and x.aid=#{aid} and a.back_status >= #{processState}
|
|
|
</if>
|
|
|
<if test="processState==5 and aid !=null">
|
|
|
and e.finance_id =#{aid}
|
|
|
@@ -867,14 +865,12 @@ select
|
|
|
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">
|
|
|
- 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 test="processState==2">
|
|
|
+ left join (select order_no, aid from order_examine where`type`=0)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>
|
|
|
+ left join (select order_no, aid from order_examine where`type`=1)x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
where 1=1
|
|
|
<if test="processState==0">
|
|
|
and b.salesman_id= #{aid}
|
|
|
@@ -886,16 +882,16 @@ select
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="processState==2 and complete !=5">
|
|
|
- and x.consultant_id=#{aid} and a.process_state >= 2
|
|
|
+ and x.aid=#{aid} and a.process_state >= 2
|
|
|
</if>
|
|
|
<if test="processState==3 and complete !=5">
|
|
|
- and x.manager_id=#{aid} and a.process_state >= 3
|
|
|
+ and x.aid=#{aid} and a.process_state >= 3
|
|
|
</if>
|
|
|
<if test="processState==2 and complete ==5">
|
|
|
- and x.consultant_id=#{aid} and a.back_status >= #{processState}
|
|
|
+ and x.aid=#{aid} and a.back_status >= #{processState}
|
|
|
</if>
|
|
|
<if test="processState==3 and complete ==5">
|
|
|
- and x.manager_id=#{aid} and a.back_status >= #{processState}
|
|
|
+ and x.aid=#{aid} and a.back_status >= #{processState}
|
|
|
</if>
|
|
|
<if test="processState==5 and aid !=null">
|
|
|
and e.finance_id =#{aid}
|
|
|
@@ -931,7 +927,7 @@ select
|
|
|
and d.name like concat('%',#{salesmanName},'%')
|
|
|
</if>
|
|
|
<if test="complete ==0 and processState != 8">
|
|
|
- and a.process_state >= #{processState} or a.back_status >= #{processState}
|
|
|
+ and (a.process_state >= #{processState} or a.back_status >= #{processState})
|
|
|
</if>
|
|
|
<if test="complete ==0 and processState == 8">
|
|
|
and (a.process_state >= #{processState} and a.process_state < 9)or a.back_status >= #{processState}
|