|
|
@@ -1101,7 +1101,7 @@ where delete_sign != 1 and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
and o.process_status >= #{o.processStatus,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
and (approval = 0 or approval = 2)
|
|
|
- and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
|
|
|
+ and d.finance_id = #{o.financeId,jdbcType=VARCHAR}
|
|
|
<if test="o.orderStatus != null and o.orderStatus != """>
|
|
|
and o.order_status = #{o.orderStatus,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
@@ -1138,13 +1138,9 @@ where delete_sign != 1 and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
</select>
|
|
|
<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 admin a on o.salesman_id = a.id
|
|
|
- left join (select sum(transaction_amount) as amount ,order_no from t_order_bill_new
|
|
|
- group by order_no ) b on b.order_no = o.order_no
|
|
|
- left join (select x1.order_no,max(create_time) create_time,max(transaction_amount)transaction_amount from
|
|
|
+ select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id left join admin a on o.salesman_id = a.id
|
|
|
+ left join (select sum(transaction_amount) as amount ,order_no from t_order_bill_new group by order_no ) b on b.order_no = o.order_no
|
|
|
+ left join department d on o.order_dep = d.id left join (select x1.order_no,max(create_time) create_time,max(transaction_amount)transaction_amount from
|
|
|
(select x.order_no,x.create_time,x.transaction_amount from t_order_bill_new x right join (select order_no, max(create_time) maxTime from t_order_bill_new group by order_no)y
|
|
|
on x.order_no=y.order_no and x.create_time=y.maxTime)x1 group by x1.order_no ) f on o.order_no = f.order_no
|
|
|
where delete_sign != 1 and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
@@ -1155,7 +1151,7 @@ where delete_sign != 1 and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
and o.process_status >= #{o.processStatus,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
and (approval = 0 or approval = 2)
|
|
|
- and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
|
|
|
+ and d.finance_id = #{o.financeId,jdbcType=VARCHAR}
|
|
|
<if test="o.orderStatus != null and o.orderStatus != """>
|
|
|
and o.order_status = #{o.orderStatus,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
@@ -1199,7 +1195,7 @@ where delete_sign != 1 and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
select
|
|
|
a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.contract_no as contractNo,
|
|
|
b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,a.order_status as orderStatus,
|
|
|
- a.liquidation_status as liquidationStatus,a.approval,c.name as salesmanName,dep.name as depName,d.name as financeName
|
|
|
+ a.liquidation_status as liquidationStatus,a.approval,c.name as salesmanName,dep.name as depName,f.name as financeName
|
|
|
<if test="specially == 2">
|
|
|
,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId
|
|
|
</if>
|
|
|
@@ -1209,6 +1205,7 @@ where delete_sign != 1 and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
from t_order_new a left join `user` b on a.buyer_id=b.id
|
|
|
left join admin c on a.salesman_id=c.id
|
|
|
left join department dep on a.order_dep=dep.id
|
|
|
+ left join admin f on dep.finance_id=f.id
|
|
|
left join admin d on a.finance_id=d.id
|
|
|
<if test="specially == 2">
|
|
|
left join (select * from t_order_back a where back_status=0) e on a.order_no=e.order_no
|
|
|
@@ -1426,7 +1423,7 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
</select>
|
|
|
|
|
|
<select id="getOrderNewDetail" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
|
|
|
- select
|
|
|
+ select
|
|
|
a.order_no as orderNo, a.order_type as orderType, a.creater, a.create_time as createTime,a.update_time as updateTime, a.buyer_id as buyerId,
|
|
|
a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,
|
|
|
a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,
|
|
|
@@ -1437,7 +1434,8 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
c.contact_mobile as salesmanMobile,d.contact_mobile as financeMobile,b.nickname as userName ,e.back_status as backStatus,f.name as initiateName,
|
|
|
e.reason,date_format(e.create_time,'%Y-%m-%d') as backDate,a.buyer_id as uid,a.order_dep as orderDep, g.location_province as locationProvince,
|
|
|
g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,
|
|
|
- h.name NowFinance,a.additional_order additionalOrder from t_order_new a left join `user` b on a.buyer_id=b.id
|
|
|
+ h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile
|
|
|
+ from t_order_new a left join `user` b on a.buyer_id=b.id left join admin i on a.old_salesman_id=i.id
|
|
|
left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id left join admin d on a.finance_id=d.id
|
|
|
left join admin h on dep.finance_id=h.id left join (select * from t_order_back a where back_status=0) e on a.order_no=e.order_no
|
|
|
left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
|
|
|
@@ -1533,7 +1531,7 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
and o.process_status >= #{processStatus,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
and (approval = 0 or approval = 2)
|
|
|
- and o.finance_id = #{financeId,jdbcType=VARCHAR}
|
|
|
+ and d.finance_id = #{financeId,jdbcType=VARCHAR}
|
|
|
<if test="orderStatus != null and orderStatus != """>
|
|
|
and o.order_status = #{orderStatus,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
@@ -1566,4 +1564,8 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
where order_no= #{orderNo}
|
|
|
order by create_time desc limit 1;
|
|
|
</select>
|
|
|
+ <update id="updateSalesmanId">
|
|
|
+ update t_order_new set salesman_id= #{transferId},old_salesman_id= #{aid}
|
|
|
+ where delete_sign !=1 and salesman_id= #{aid}
|
|
|
+ </update>
|
|
|
</mapper>
|