|
|
@@ -1156,6 +1156,14 @@
|
|
|
left join (select * from t_order_outsource where type=0) too on o.order_no=too.order_no
|
|
|
left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
from t_order_approval group by order_no) toa on o.order_no=toa.order_no
|
|
|
+ <include refid="financeListSql"/>
|
|
|
+ order by o.liquidation_status, o.sign_time desc
|
|
|
+ <if test="page_sql != null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <sql id="financeListSql">
|
|
|
+
|
|
|
<if test="type !=null">
|
|
|
inner join
|
|
|
(select distinct order_no
|
|
|
@@ -1246,103 +1254,16 @@
|
|
|
<bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
|
|
|
and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- order by o.liquidation_status, o.sign_time desc
|
|
|
- <if test="page_sql != null">
|
|
|
- ${page_sql}
|
|
|
+ <if test="o.startSignTime != null and o.startSignTime != "" and o.endSignTime != null and o.endSignTime != """>
|
|
|
+ <bind name="e" value="o.startSignTime + ' 00:00:00'" />
|
|
|
+ <bind name="f" value="o.endSignTime + ' 23:59:59'" />
|
|
|
+ and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- </select>
|
|
|
+ </sql>
|
|
|
<select id="financeCount" parameterType="Map" resultType="java.lang.Integer">
|
|
|
select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id
|
|
|
left join department d on o.order_dep = d.id left join t_order_mid a on o.order_no=a.order_no
|
|
|
- <if test="type !=null">
|
|
|
- inner join
|
|
|
- (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
- from t_order_approval
|
|
|
- where `type` in
|
|
|
- <foreach collection="type" item="item" separator="," open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by order_no) toa on o.order_no=toa.order_no
|
|
|
- </if>
|
|
|
- where delete_sign in(0,2) and o.approval in(0,1,2,4,5,7,8) and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
- <if test="o.processStatus == 3">
|
|
|
- and o.process_status = #{o.processStatus,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
- <if test="o.processStatus == 4" >
|
|
|
- and o.process_status >= #{o.processStatus,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
- <if test="o.processStatus == 9">
|
|
|
- and o.back_status = 3
|
|
|
- </if>
|
|
|
- <if test="fids != null and fids.size() > 0">
|
|
|
- and (d.finance_id in
|
|
|
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- or d.retrial_finance_id in
|
|
|
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>)
|
|
|
- </if>
|
|
|
- <if test="o.orderStatus != null and o.orderStatus != """>
|
|
|
- and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
|
|
|
- </if>
|
|
|
- <if test="deps !=null">
|
|
|
- and o.order_dep in
|
|
|
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
|
|
|
- #{depId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="o.contractNo != null and o.contractNo != """>
|
|
|
- and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
- <if test="o.liquidationStatus != null">
|
|
|
- and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
- <if test="o.amountStatus == 0">
|
|
|
- and o.total_amount < 10
|
|
|
- </if>
|
|
|
- <if test="o.amountStatus == 1">
|
|
|
- and o.total_amount between 10 and 20
|
|
|
- </if>
|
|
|
- <if test="o.amountStatus == 2">
|
|
|
- and o.total_amount between 20 and 30
|
|
|
- </if>
|
|
|
- <if test="o.amountStatus == 3">
|
|
|
- and o.total_amount between 30 and 40
|
|
|
- </if>
|
|
|
- <if test="o.amountStatus == 4">
|
|
|
- and o.total_amount > 40
|
|
|
- </if>
|
|
|
- <if test="o.orderNo != null and o.orderNo != """>
|
|
|
- and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- <if test="o.projectType != null and o.projectType != """>
|
|
|
- and a.project_type = #{o.projectType}
|
|
|
- </if>
|
|
|
- <if test="o.approval != null and o.approval ==1">
|
|
|
- and o.approval in (1,4,7)
|
|
|
- </if>
|
|
|
- <if test="o.approval != null and o.approval ==2">
|
|
|
- and o.approval in (2,5,8)
|
|
|
- </if>
|
|
|
- <if test="o.approval != null and o.approval ==4">
|
|
|
- and o.approval in (1,2,4,5,7,8)
|
|
|
- </if>
|
|
|
- <if test="o.buyerName != null and o.buyerName != """>
|
|
|
- <bind name="n" value="'%' + o.buyerName + '%'" />
|
|
|
- and u.nickname like #{n,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- <if test="o.startTime != null and o.startTime != "" and o.endTime != null and o.endTime != """>
|
|
|
- <bind name="a" value="o.startTime + ' 00:00:00'" />
|
|
|
- <bind name="b" value="o.endTime + ' 23:59:59'" />
|
|
|
- and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != "" and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != """>
|
|
|
- <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
|
|
|
- <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
|
|
|
- and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
+ <include refid="financeListSql"/>
|
|
|
</select>
|
|
|
<!-- 通过订单编号获得订单的负责人(营销员) -->
|
|
|
<select id="getSaleIdByOno" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
|