|
|
@@ -603,142 +603,13 @@ from new_order_change a where 1 = 1 and status in (0,1,2,3)
|
|
|
group by order_no,aid)x on a.order_no = x.order_no
|
|
|
</if>
|
|
|
where 1=1
|
|
|
- <if test="processState==0">
|
|
|
- and b.salesman_id= #{aid}
|
|
|
- </if>
|
|
|
- <if test="processState==1">
|
|
|
- and d.manager_id= #{aid}
|
|
|
- </if>
|
|
|
- <if test="processState==3 and complete !=5">
|
|
|
- and x.aid=#{aid} and a.process_state >= #{processState}
|
|
|
- </if>
|
|
|
- <if test="processState==4 and complete !=5">
|
|
|
- and x.aid=#{aid} and a.process_state >= #{processState}
|
|
|
- </if>
|
|
|
- <if test="processState==3 and complete ==5">
|
|
|
- and x.aid=#{aid} and a.back_status >= #{processState}
|
|
|
- </if>
|
|
|
- <if test="processState==4 and complete ==5">
|
|
|
- and x.aid=#{aid} and a.back_status >= #{processState}
|
|
|
- </if>
|
|
|
- <if test="processState==6 and aid !=null">
|
|
|
- and e.finance_id =#{aid}
|
|
|
- </if>
|
|
|
- <if test="processState==6 and aids !=null">
|
|
|
- and e.finance_id in
|
|
|
- <foreach close=")" collection="aids" item="id" open="(" separator=",">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="processState==8 and aid !=null">
|
|
|
- and e.approval_aid =#{aid}
|
|
|
- </if>
|
|
|
- <if test="userName !=null">
|
|
|
- and c.nickname like concat('%',#{userName},'%')
|
|
|
- </if>
|
|
|
- <if test="orderNo !=null">
|
|
|
- and a.order_no like concat('%',#{orderNo},'%')
|
|
|
- </if>
|
|
|
- <if test="contractNo !=null">
|
|
|
- and b.contract_no like concat('%',#{contractNo},'%')
|
|
|
- </if>
|
|
|
- <if test="type !=null">
|
|
|
- and a.type = #{type}
|
|
|
- </if>
|
|
|
- <if test="timeType == 0 and startTime !=null and endTime !=null">
|
|
|
- and a.create_time between #{startTime} and #{endTime}
|
|
|
- </if>
|
|
|
- <if test="timeType == 1 and startTime !=null and endTime !=null">
|
|
|
- and b.create_time between #{startTime} and #{endTime}
|
|
|
- </if>
|
|
|
- <if test="deps !=null">
|
|
|
- and b.order_dep in
|
|
|
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
|
|
|
- #{depId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="salesmanName !=null">
|
|
|
- and d.name like concat('%',#{salesmanName},'%')
|
|
|
- </if>
|
|
|
- <if test="complete ==0 and processState != 5 and processState < 7">
|
|
|
- and ((a.process_state >= #{processState} or a.back_status >= #{processState}))
|
|
|
- </if>
|
|
|
- <if test="complete ==0 and (processState == 5 or processState == 7)">
|
|
|
- and ((a.process_state >= #{processState} and a.process_state < 10)or a.back_status >= #{processState})
|
|
|
- </if>
|
|
|
- <if test="complete ==0 and processState == 8">
|
|
|
- and ((a.process_state >= 8 and a.process_state < 10)or a.back_status >= #{processState})
|
|
|
- </if>
|
|
|
- <if test="complete ==0 and processState == 9">
|
|
|
- and ((a.process_state = 9 )or a.back_status >= #{processState})
|
|
|
- </if>
|
|
|
- <if test="complete ==1 and processState < 6">
|
|
|
- and a.process_state = #{processState} and a.status in (0,1,2,3)
|
|
|
- </if>
|
|
|
- <if test="complete ==1 and processState == 6">
|
|
|
- and (a.process_state in(6) and a.status in (0,1,2,3,5,6))
|
|
|
- </if>
|
|
|
- <if test="complete ==1 and processState > 6">
|
|
|
- and (a.process_state = #{processState} and a.status =1)
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="complete ==2 and processState != 6 and processState != 8 and processState != 9 and processState !=3 and processState !=4">
|
|
|
- and a.process_state > #{processState}
|
|
|
- </if>
|
|
|
- <if test="complete ==2 and processState == 6">
|
|
|
- and((a.process_state > 6 and a.process_state < 10) or (a.process_state =6 and a.status=4))
|
|
|
- </if>
|
|
|
- <if test="complete ==2 and processState == 8">
|
|
|
- and ((a.process_state = 8 and a.status in(2,4))or a.process_state > 8)
|
|
|
- </if>
|
|
|
- <if test="complete ==2 and processState == 9">
|
|
|
- and a.process_state = 9 and a.status in (2,4)
|
|
|
-
|
|
|
- </if>
|
|
|
- <if test="complete ==3">
|
|
|
- and a.status = 2
|
|
|
- </if>
|
|
|
- <if test="complete ==4">
|
|
|
- and a.status = 4
|
|
|
- </if>
|
|
|
- <if test="complete ==5 and processState != 3 and processState != 4">
|
|
|
- and a.back_status = #{processState}
|
|
|
- </if>
|
|
|
- <if test="complete ==6">
|
|
|
- and a.status = 6
|
|
|
- </if>
|
|
|
+ <include refid="selectOrderChangeSql"/>
|
|
|
order by a.status,a.create_time desc
|
|
|
<if test="page_sql != null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
</select>
|
|
|
-
|
|
|
- <!--suppress MybatisPlusMapperXmlInspection -->
|
|
|
- <select id="selectOrderChangeCount" resultType="java.lang.Integer">
|
|
|
- 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==3">
|
|
|
- left join (select order_no, aid from order_examine where`type`=0
|
|
|
- <if test="complete ==1">
|
|
|
- and status=0
|
|
|
- </if>
|
|
|
- <if test="complete ==2">
|
|
|
- and status=1
|
|
|
- </if>
|
|
|
- group by order_no,aid)x on a.order_no = x.order_no
|
|
|
- </if>
|
|
|
- <if test="processState==4">
|
|
|
- left join (select order_no, aid from order_examine where`type`=1
|
|
|
- <if test="complete ==1">
|
|
|
- and status=0
|
|
|
- </if>
|
|
|
- <if test="complete ==2">
|
|
|
- and status=1
|
|
|
- </if>
|
|
|
- group by order_no,aid)x on a.order_no = x.order_no
|
|
|
- </if>
|
|
|
- where 1=1
|
|
|
+ <sql id="selectOrderChangeSql">
|
|
|
<if test="processState==0">
|
|
|
and b.salesman_id= #{aid}
|
|
|
</if>
|
|
|
@@ -766,7 +637,7 @@ from new_order_change a where 1 = 1 and status in (0,1,2,3)
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <if test="processState==8 and aid !=null">
|
|
|
+ <if test="processState==9 and aid !=null">
|
|
|
and e.approval_aid =#{aid}
|
|
|
</if>
|
|
|
<if test="userName !=null">
|
|
|
@@ -802,11 +673,11 @@ from new_order_change a where 1 = 1 and status in (0,1,2,3)
|
|
|
<if test="complete ==0 and (processState == 5 or processState == 7)">
|
|
|
and ((a.process_state >= #{processState} and a.process_state < 10)or a.back_status >= #{processState})
|
|
|
</if>
|
|
|
- <if test="complete ==0 and processState == 8">
|
|
|
- and ((a.process_state >= 8 and a.process_state < 10)or a.back_status >= #{processState})
|
|
|
- </if>
|
|
|
<if test="complete ==0 and processState == 9">
|
|
|
- and ((a.process_state = 9 )or a.back_status >= #{processState})
|
|
|
+ and ((a.process_state >= 9 and a.process_state < 11)or a.back_status >= #{processState})
|
|
|
+ </if>
|
|
|
+ <if test="complete ==0 and processState == 10">
|
|
|
+ and ((a.process_state = 10 )or a.back_status >= #{processState})
|
|
|
</if>
|
|
|
<if test="complete ==1 and processState < 6">
|
|
|
and a.process_state = #{processState} and a.status in (0,1,2,3)
|
|
|
@@ -824,11 +695,11 @@ from new_order_change a where 1 = 1 and status in (0,1,2,3)
|
|
|
<if test="complete ==2 and processState == 6">
|
|
|
and((a.process_state > 6 and a.process_state < 10) or (a.process_state =6 and a.status=4))
|
|
|
</if>
|
|
|
- <if test="complete ==2 and processState == 8">
|
|
|
- and ((a.process_state = 8 and a.status in(2,4))or a.process_state > 8)
|
|
|
- </if>
|
|
|
<if test="complete ==2 and processState == 9">
|
|
|
- and a.process_state = 9 and a.status in (2,4)
|
|
|
+ and ((a.process_state = 9 and a.status in(2,4))or a.process_state > 9)
|
|
|
+ </if>
|
|
|
+ <if test="complete ==2 and processState == 10">
|
|
|
+ and a.process_state = 10 and a.status in (2,4)
|
|
|
|
|
|
</if>
|
|
|
<if test="complete ==3">
|
|
|
@@ -843,6 +714,35 @@ from new_order_change a where 1 = 1 and status in (0,1,2,3)
|
|
|
<if test="complete ==6">
|
|
|
and a.status = 6
|
|
|
</if>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--suppress MybatisPlusMapperXmlInspection -->
|
|
|
+ <select id="selectOrderChangeCount" resultType="java.lang.Integer">
|
|
|
+ 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==3">
|
|
|
+ left join (select order_no, aid from order_examine where`type`=0
|
|
|
+ <if test="complete ==1">
|
|
|
+ and status=0
|
|
|
+ </if>
|
|
|
+ <if test="complete ==2">
|
|
|
+ and status=1
|
|
|
+ </if>
|
|
|
+ group by order_no,aid)x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
+ <if test="processState==4">
|
|
|
+ left join (select order_no, aid from order_examine where`type`=1
|
|
|
+ <if test="complete ==1">
|
|
|
+ and status=0
|
|
|
+ </if>
|
|
|
+ <if test="complete ==2">
|
|
|
+ and status=1
|
|
|
+ </if>
|
|
|
+ group by order_no,aid)x on a.order_no = x.order_no
|
|
|
+ </if>
|
|
|
+ where 1=1
|
|
|
+ <include refid="selectOrderChangeSql"/>
|
|
|
</select>
|
|
|
<update id="addRefundInvoice">
|
|
|
update new_order_change
|