Browse Source

修改变更

Signed-off-by: anderx <312518615@qq.com>
anderx 6 years ago
parent
commit
4abff229d5
1 changed files with 13 additions and 9 deletions
  1. 13 9
      src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

+ 13 - 9
src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

@@ -668,8 +668,7 @@ select
   a.process_state processState from new_order_change a 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 x.order_no,x.aid from (SELECT order_no,task_allocator aid FROM t_order_task where task_allocator is not null
-  UNION SELECT order_no,task_receiver aid FROM t_order_task  where task_receiver is not null)x group by order_no,aid) f on a.order_no=f.order_no
+	left join t_order_task x on a.order_no=x.order_no
 	</if> 
 	where 1=1
 	<if test="processState==0">
@@ -681,8 +680,11 @@ select
 	 #{deps.id}
   	</foreach>
 	</if>
-	<if test="processState==2 or processState==3 ">
-	and f.aid=#{aid}  and process_state &gt;= 2
+	<if test="processState==2 ">
+	and  x.consultant_id=#{aid}  and process_state &gt;= 2
+	</if>
+	<if test="processState==3 ">
+	and x.manager_id=#{aid}  and process_state &gt;= 3
 	</if>
 	<if test="processState==5">
 	and e.finance_id =#{aid}
@@ -754,9 +756,8 @@ select
   select count(*) from new_order_change a 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 x.order_no,x.aid from (SELECT order_no,task_allocator aid FROM t_order_task where task_allocator is not null
-  UNION SELECT order_no,task_receiver aid FROM t_order_task  where task_receiver is not null)x group by order_no,aid) f on a.order_no=f.order_no
-	</if> 
+	left join t_order_task x on a.order_no=x.order_no
+	</if>
 	where 1=1
 	<if test="processState==0">
 	and b.salesman_id= #{aid}
@@ -767,8 +768,11 @@ select
 	 #{deps.id}
   	</foreach>
 	</if>
-	<if test="processState==2 or processState==3 ">
-	and f.aid=#{aid}
+	<if test="processState==2 ">
+	and  x.consultant_id=#{aid}  and process_state &gt;= 2
+	</if>
+	<if test="processState==3 ">
+	and x.manager_id=#{aid}  and process_state &gt;= 3
 	</if>
 	<if test="processState==5">
 	and e.finance_id =#{aid}