|
|
@@ -469,16 +469,19 @@
|
|
|
|
|
|
|
|
|
<update id="updateCostAmount">
|
|
|
- update t_order_task a ,t_order_mid b
|
|
|
- <set>
|
|
|
- <if test="cost !=null">
|
|
|
- b.cost_amount= #{cost},
|
|
|
- </if>
|
|
|
- <if test="payment !=null">
|
|
|
- b.payment_amount= #{payment},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where a.order_no=b.order_no and a.id= #{tid}
|
|
|
+ update t_order_mid x,(select x.order_no,sum(cost)cost,sum(party)party, sum(if(type = 1, cost, 0))zlc, sum(if(type = 1, party, 0))zlf,
|
|
|
+ sum(if(type = 2, cost, 0))rzc, sum(if(type = 2, party, 0))rzf, sum(if(type = 3, cost, 0))sjc, sum(if(type = 3, party, 0))sjf,
|
|
|
+ sum(if(type = 0 or type>3, cost, 0))qtc, sum(if(type = 0 or type>3, party, 0))qtf
|
|
|
+ from(select b.order_no, c.`type`, sum(cost_amount)cost, sum(party_amount)party
|
|
|
+ from t_task_mid a left join t_order_task b on a.tid = b.id left join business_project c on b.commodity_id = c.id
|
|
|
+ left join t_order_new d on b.order_no = d.order_no left join t_order_outsource too on a.tid =too.tid
|
|
|
+ where too.`type` =1 and too.refund_status =1 and d.delete_sign in (0,2) and b.order_no = #{orderNo}
|
|
|
+ group by b.order_no , c.`type`)x group by x.order_no)y,t_order_new z
|
|
|
+ set x.cost_amount =y.cost,x.payment_amount =y.party,x.patent_cost =y.zlc,x.patent_cost_actual =y.zlf,
|
|
|
+ x.soft_cost =y.rzc,x.soft_cost_actual =y.rzf,x.audit_cost =y.sjc,x.audit_cost_actual =y.sjf,
|
|
|
+ x.other_cost =qtc,x.other_cost_actual =y.qtf,x.expect_profit =z.total_amount-y.cost,
|
|
|
+ x.actual_profit =z.total_amount-y.party
|
|
|
+ where x.order_no =y.order_no and x.order_no=z.order_no
|
|
|
</update>
|
|
|
|
|
|
|
|
|
@@ -706,46 +709,6 @@
|
|
|
where a.order_no=b.order_no and a.order_no = #{orderNo};
|
|
|
</update>
|
|
|
|
|
|
- <update id="updateAddCostAmount" parameterType="com.goafanti.common.model.TOrderMid">
|
|
|
- update t_order_mid
|
|
|
- <set>
|
|
|
- <if test="costActual != null">
|
|
|
- payment_amount =payment_amount+ #{paymentAmount,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="patentCost != null">
|
|
|
- patent_cost =patent_cost+ #{patentCost,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="patentCostActual != null">
|
|
|
- patent_cost_actual =patent_cost_actual+ #{patentCostActual,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="softCost != null">
|
|
|
- soft_cost =soft_cost+ #{softCost,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="softCostActual != null">
|
|
|
- soft_cost_actual =soft_cost_actual+ #{softCostActual,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="auditCost != null">
|
|
|
- audit_cost =audit_cost+ #{auditCost,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="auditCostActual != null">
|
|
|
- audit_cost_actual =audit_cost_actual+ #{auditCostActual,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="otherCost != null">
|
|
|
- other_cost =other_cost+ #{otherCost,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="otherCostActual != null">
|
|
|
- other_cost_actual =other_cost_actual+ #{otherCostActual,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="expectProfit != null">
|
|
|
- expect_profit =expect_profit+ #{expectProfit,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="actualProfit != null">
|
|
|
- actual_profit =actual_profit+ #{actualProfit,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="costAmount != null">
|
|
|
- cost_amount =cost_amount+ #{costAmount,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where order_no =#{orderNo}
|
|
|
- </update>
|
|
|
+
|
|
|
+
|
|
|
</mapper>
|