|
|
@@ -994,60 +994,82 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
left join admin mg on a.salesman_id=mg.id
|
|
|
</if>
|
|
|
where a.delete_sign in(0,2)
|
|
|
+ <include refid="selectOrderNewSql"/>
|
|
|
+ order by
|
|
|
+ <if test="specially == 3">
|
|
|
+ a.approval,
|
|
|
+ </if>
|
|
|
+ <if test="specially == 4">
|
|
|
+ a.process_status,
|
|
|
+ </if>
|
|
|
+ <if test="specially != 4">
|
|
|
+ a.order_status,
|
|
|
+ </if>
|
|
|
+ a.create_time
|
|
|
+ <if test="specially != 4">
|
|
|
+ desc
|
|
|
+ </if>
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <sql id="selectOrderNewSql">
|
|
|
+
|
|
|
<if test="specially ==7">
|
|
|
- and a.process_status > 4
|
|
|
+ and a.process_status > 5
|
|
|
and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="specially ==8">
|
|
|
- and a.process_status > 4
|
|
|
- <if test="uid !=null">
|
|
|
+ and a.process_status > 5
|
|
|
+ <if test="uid !=null">
|
|
|
and a.buyer_id = #{uid}
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<if test="specially ==9">
|
|
|
- and a.process_status > 4 and bp.type=5
|
|
|
+ and a.process_status > 5 and bp.type=5
|
|
|
<if test="aid !=null">
|
|
|
and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="outsource != null">
|
|
|
- and a.outsource= #{outsource,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
- <if test="specially == 0">
|
|
|
- <if test="approval ==null">
|
|
|
- and a.approval in(0,1,2,4,5,7,8)
|
|
|
+ <if test="outsource != null">
|
|
|
+ and a.outsource= #{outsource,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="specially == 0">
|
|
|
+ <if test="approval ==null">
|
|
|
+ and a.approval in(0,1,2,4,5,7,8)
|
|
|
</if>
|
|
|
- and a.order_status in(0,1,2,4)
|
|
|
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
+ and a.order_status in(0,1,2,4)
|
|
|
+ and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
<if test="specially == 10">
|
|
|
and a.process_status = 1 and a.order_status in (0,1,2)
|
|
|
- and mg.manager_id= #{aid}
|
|
|
+ and mg.manager_id= #{aid}
|
|
|
</if>
|
|
|
<if test="specially == 1">
|
|
|
and a.process_status = 2 and a.order_status in (0,1,2)
|
|
|
</if>
|
|
|
- <if test="specially == 2">
|
|
|
- and a.order_status in(3,5)
|
|
|
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
+ <if test="specially == 2">
|
|
|
+ and a.order_status in(3,5)
|
|
|
+ and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
<if test="specially == 3">
|
|
|
and a.order_status=2
|
|
|
- <if test="manageType ==0">
|
|
|
- and dep.approval_aid= #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
+ <if test="manageType ==0">
|
|
|
+ and dep.approval_aid= #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
<if test="approval ==0">
|
|
|
- and a.process_status in(4)
|
|
|
+ and a.process_status in(5)
|
|
|
and a.approval = 0
|
|
|
</if>
|
|
|
<if test="approval ==1">
|
|
|
- and a.process_status in(4)
|
|
|
+ and a.process_status in(5)
|
|
|
and a.approval in
|
|
|
- <if test="manageType ==0">
|
|
|
- (1)
|
|
|
- </if>
|
|
|
+ <if test="manageType ==0">
|
|
|
+ (1)
|
|
|
+ </if>
|
|
|
<if test="manageType ==1">
|
|
|
- (4)
|
|
|
+ (5)
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="approval ==2">
|
|
|
@@ -1056,29 +1078,29 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
(2,3)
|
|
|
</if>
|
|
|
<if test="manageType ==1">
|
|
|
- (5,6)
|
|
|
+ (6,7)
|
|
|
</if>
|
|
|
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="specially !=3 ">
|
|
|
- <if test="approval ==0">
|
|
|
- and a.approval = 0
|
|
|
- </if>
|
|
|
- <if test="approval ==1">
|
|
|
- and a.approval in (1,4,7)
|
|
|
- </if>
|
|
|
- <if test="approval ==2">
|
|
|
- and a.approval in (2,5,8)
|
|
|
- </if>
|
|
|
- <if test="approval ==4">
|
|
|
- and a.approval in (1,2,4,5,7,8)
|
|
|
- </if>
|
|
|
+ <if test="specially !=3 ">
|
|
|
+ <if test="approval ==0">
|
|
|
+ and a.approval = 0
|
|
|
</if>
|
|
|
- <if test="specially == 4">
|
|
|
- and a.process_status in (3,5,6,7,99)
|
|
|
- and a.order_status in(1,2,3,4,6)
|
|
|
- </if>
|
|
|
+ <if test="approval ==1">
|
|
|
+ and a.approval in (1,4,7)
|
|
|
+ </if>
|
|
|
+ <if test="approval ==2">
|
|
|
+ and a.approval in (2,5,8)
|
|
|
+ </if>
|
|
|
+ <if test="approval ==4">
|
|
|
+ and a.approval in (1,2,4,5,7,8)
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="specially == 4">
|
|
|
+ and a.process_status in (3,6,7,8,99)
|
|
|
+ and a.order_status in(1,2,3,4,6)
|
|
|
+ </if>
|
|
|
<if test="deps!=null">
|
|
|
and a.order_dep in
|
|
|
<foreach close=")" collection="deps" item="dep" open="(" separator=",">
|
|
|
@@ -1088,76 +1110,58 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
<if test="distribution == 0">
|
|
|
and a.process_status = 3
|
|
|
</if>
|
|
|
- <if test="distribution == 1">
|
|
|
- and a.process_status = 5
|
|
|
- </if>
|
|
|
- <if test="distribution == 2">
|
|
|
- and a.process_status = 6
|
|
|
- </if>
|
|
|
- <if test="distribution == 3">
|
|
|
- and a.process_status = 7
|
|
|
- </if>
|
|
|
- <if test="name != null">
|
|
|
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
+ <if test="distribution == 1">
|
|
|
+ and a.process_status = 6
|
|
|
+ </if>
|
|
|
+ <if test="distribution == 2">
|
|
|
+ and a.process_status = 7
|
|
|
+ </if>
|
|
|
+ <if test="distribution == 3">
|
|
|
+ and a.process_status = 8
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
<if test="projectType != null">
|
|
|
and c.project_type = #{projectType}
|
|
|
</if>
|
|
|
<if test="processStatus != null">
|
|
|
and a.process_status = #{processStatus}
|
|
|
</if>
|
|
|
- <if test="orderNo != null">
|
|
|
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
- <if test="contractNo != null">
|
|
|
- and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
- <if test="liquidationStatus != null">
|
|
|
- and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
+ <if test="orderNo != null">
|
|
|
+ and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="contractNo != null">
|
|
|
+ and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="liquidationStatus != null">
|
|
|
+ and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
<if test="tag != null">
|
|
|
- and a.tag= #{tag}
|
|
|
+ and a.tag= #{tag}
|
|
|
</if>
|
|
|
- <if test="amountStatus == 0">
|
|
|
- and a.total_amount < 10
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 1">
|
|
|
- and a.total_amount between 10 and 20
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 2">
|
|
|
- and a.total_amount between 20 and 30
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 3">
|
|
|
- and a.total_amount between 30 and 40
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 4">
|
|
|
- and a.total_amount > 40
|
|
|
- </if>
|
|
|
- <if test="starTime !=null and endTime !=null">
|
|
|
+ <if test="amountStatus == 0">
|
|
|
+ and a.total_amount < 10
|
|
|
+ </if>
|
|
|
+ <if test="amountStatus == 1">
|
|
|
+ and a.total_amount between 10 and 20
|
|
|
+ </if>
|
|
|
+ <if test="amountStatus == 2">
|
|
|
+ and a.total_amount between 20 and 30
|
|
|
+ </if>
|
|
|
+ <if test="amountStatus == 3">
|
|
|
+ and a.total_amount between 30 and 40
|
|
|
+ </if>
|
|
|
+ <if test="amountStatus == 4">
|
|
|
+ and a.total_amount > 40
|
|
|
+ </if>
|
|
|
+ <if test="starTime !=null and endTime !=null">
|
|
|
and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="contractStart !=null and contractEnd !=null">
|
|
|
and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- order by
|
|
|
- <if test="specially == 3">
|
|
|
- a.approval,
|
|
|
- </if>
|
|
|
- <if test="specially == 4">
|
|
|
- a.process_status,
|
|
|
- </if>
|
|
|
- <if test="specially != 4">
|
|
|
- a.order_status,
|
|
|
- </if>
|
|
|
- a.create_time
|
|
|
- <if test="specially != 4">
|
|
|
- desc
|
|
|
- </if>
|
|
|
- <if test="page_sql!=null">
|
|
|
- ${page_sql}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
+ </sql>
|
|
|
<select id="selectOrderNewListCount" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
|
|
|
@@ -1170,151 +1174,7 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
left join admin mg on a.salesman_id=mg.id
|
|
|
</if>
|
|
|
where a.delete_sign in(0,2)
|
|
|
- <if test="specially ==7">
|
|
|
- and a.process_status > 4
|
|
|
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- <if test="specially ==8">
|
|
|
- and a.process_status > 4
|
|
|
- <if test="uid !=null">
|
|
|
- and a.buyer_id = #{uid}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="specially ==9">
|
|
|
- and a.process_status > 4 and bp.type=5
|
|
|
- <if test="aid !=null">
|
|
|
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="outsource != null">
|
|
|
- and a.outsource= #{outsource,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
- <if test="specially == 0">
|
|
|
- <if test="approval ==null">
|
|
|
- and a.approval in(0,1,2,4,5,7,8)
|
|
|
- </if>
|
|
|
- and a.order_status in(0,1,2,4)
|
|
|
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- <if test="specially == 10">
|
|
|
- and a.process_status = 1 and a.order_status in (0,1,2)
|
|
|
- and mg.manager_id= #{aid}
|
|
|
- </if>
|
|
|
- <if test="specially == 1">
|
|
|
- and a.process_status = 2 and a.order_status in (0,1,2)
|
|
|
- </if>
|
|
|
- <if test="specially == 2">
|
|
|
- and a.order_status in(3,5)
|
|
|
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- <if test="specially == 3">
|
|
|
- <if test="manageType ==0">
|
|
|
- and dep.approval_aid= #{aid,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- and a.order_status=2
|
|
|
- <if test="approval ==0">
|
|
|
- and a.process_status in(4)
|
|
|
- and a.approval = 0
|
|
|
- </if>
|
|
|
- <if test="approval ==1">
|
|
|
- and a.process_status in(4)
|
|
|
- and a.approval in
|
|
|
- <if test="manageType ==0">
|
|
|
- (1)
|
|
|
- </if>
|
|
|
- <if test="manageType ==1">
|
|
|
- (4)
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="approval ==2">
|
|
|
- and a.approval in
|
|
|
- <if test="manageType ==0">
|
|
|
- (2,3)
|
|
|
- </if>
|
|
|
- <if test="manageType ==1">
|
|
|
- (5,6)
|
|
|
- </if>
|
|
|
-
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="specially !=3 ">
|
|
|
- <if test="approval ==0">
|
|
|
- and a.approval = 0
|
|
|
- </if>
|
|
|
- <if test="approval ==1">
|
|
|
- and a.approval in (1,4,7)
|
|
|
- </if>
|
|
|
- <if test="approval ==2">
|
|
|
- and a.approval in (2,5,8)
|
|
|
- </if>
|
|
|
- <if test="approval ==4">
|
|
|
- and a.approval in (1,2,4,5,7,8)
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="specially == 4">
|
|
|
- and a.process_status in (3,5,6,7,99)
|
|
|
- and a.order_status in(1,2,3,4,6)
|
|
|
- </if>
|
|
|
- <if test="deps!=null">
|
|
|
- and a.order_dep in
|
|
|
- <foreach close=")" collection="deps" item="dep" open="(" separator=",">
|
|
|
- #{dep}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="distribution == 0">
|
|
|
- and a.process_status = 3
|
|
|
- </if>
|
|
|
- <if test="distribution == 1">
|
|
|
- and a.process_status = 5
|
|
|
- </if>
|
|
|
- <if test="distribution == 2">
|
|
|
- and a.process_status = 6
|
|
|
- </if>
|
|
|
- <if test="distribution == 3">
|
|
|
- and a.process_status = 7
|
|
|
- </if>
|
|
|
- <if test="name != null">
|
|
|
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
- <if test="projectType != null">
|
|
|
- and c.project_type = #{projectType}
|
|
|
- </if>
|
|
|
- <if test="processStatus != null">
|
|
|
- and a.process_status = #{processStatus}
|
|
|
- </if>
|
|
|
- <if test="orderNo != null">
|
|
|
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
- <if test="contractNo != null">
|
|
|
- and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
- <if test="liquidationStatus != null">
|
|
|
- and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
- <if test="tag != null">
|
|
|
- and a.tag= #{tag}
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 0">
|
|
|
- and a.total_amount < 10
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 1">
|
|
|
- and a.total_amount between 10 and 20
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 2">
|
|
|
- and a.total_amount between 20 and 30
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 3">
|
|
|
- and a.total_amount between 30 and 40
|
|
|
- </if>
|
|
|
- <if test="amountStatus == 4">
|
|
|
- and a.total_amount > 40
|
|
|
- </if>
|
|
|
- <if test="starTime !=null and endTime !=null">
|
|
|
- and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- <if test="contractStart !=null and contractEnd !=null">
|
|
|
- and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
+ <include refid="selectOrderNewSql"/>
|
|
|
|
|
|
</select>
|
|
|
|