|
|
@@ -27,13 +27,24 @@
|
|
|
<result column="project_type" jdbcType="INTEGER" property="projectType" />
|
|
|
<result column="service_type" jdbcType="VARCHAR" property="serviceType" />
|
|
|
<result column="service_project" jdbcType="VARCHAR" property="serviceProject" />
|
|
|
+ <result column="patent_cost" jdbcType="DECIMAL" property="patentCost" />
|
|
|
+ <result column="patent_cost_actual" jdbcType="DECIMAL" property="patentCostActual" />
|
|
|
+ <result column="soft_cost" jdbcType="DECIMAL" property="softCost" />
|
|
|
+ <result column="soft_cost_actual" jdbcType="DECIMAL" property="softCostActual" />
|
|
|
+ <result column="audit_cost" jdbcType="DECIMAL" property="auditCost" />
|
|
|
+ <result column="audit_cost_actual" jdbcType="DECIMAL" property="auditCostActual" />
|
|
|
+ <result column="other_cost" jdbcType="DECIMAL" property="otherCost" />
|
|
|
+ <result column="other_cost_actual" jdbcType="DECIMAL" property="otherCostActual" />
|
|
|
+ <result column="expect_profit" jdbcType="DECIMAL" property="expectProfit" />
|
|
|
+ <result column="actual_profit" jdbcType="DECIMAL" property="actualProfit" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
id, order_no, salesman_id, finance_id, salesman_name, finance_name, final_receivables,
|
|
|
final_Receivables_time, invoice_amount, create_time, buyer_name, order_receivables,
|
|
|
order_arrears, payment_amount, cost_amount, dep_name, province_name, legal_affairs,
|
|
|
dun_start_time, legal_affairs_type, operation_time, legal_affairs_status, project_type,
|
|
|
- service_type, service_project
|
|
|
+ service_type, service_project, patent_cost, patent_cost_actual, soft_cost, soft_cost_actual,
|
|
|
+ audit_cost, audit_cost_actual, other_cost, other_cost_actual, expect_profit, actual_profit
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
select
|
|
|
@@ -54,7 +65,10 @@
|
|
|
dep_name, province_name, legal_affairs,
|
|
|
dun_start_time, legal_affairs_type, operation_time,
|
|
|
legal_affairs_status, project_type, service_type,
|
|
|
- service_project)
|
|
|
+ service_project, patent_cost, patent_cost_actual,
|
|
|
+ soft_cost, soft_cost_actual, audit_cost,
|
|
|
+ audit_cost_actual, other_cost, other_cost_actual,
|
|
|
+ expect_profit, actual_profit)
|
|
|
values (#{orderNo,jdbcType=VARCHAR}, #{salesmanId,jdbcType=VARCHAR}, #{financeId,jdbcType=VARCHAR},
|
|
|
#{salesmanName,jdbcType=VARCHAR}, #{financeName,jdbcType=VARCHAR}, #{finalReceivables,jdbcType=DECIMAL},
|
|
|
#{finalReceivablesTime,jdbcType=TIMESTAMP}, #{invoiceAmount,jdbcType=DECIMAL},
|
|
|
@@ -63,7 +77,10 @@
|
|
|
#{depName,jdbcType=VARCHAR}, #{provinceName,jdbcType=VARCHAR}, #{legalAffairs,jdbcType=INTEGER},
|
|
|
#{dunStartTime,jdbcType=TIMESTAMP}, #{legalAffairsType,jdbcType=INTEGER}, #{operationTime,jdbcType=DATE},
|
|
|
#{legalAffairsStatus,jdbcType=INTEGER}, #{projectType,jdbcType=INTEGER}, #{serviceType,jdbcType=VARCHAR},
|
|
|
- #{serviceProject,jdbcType=VARCHAR})
|
|
|
+ #{serviceProject,jdbcType=VARCHAR}, #{patentCost,jdbcType=DECIMAL}, #{patentCostActual,jdbcType=DECIMAL},
|
|
|
+ #{softCost,jdbcType=DECIMAL}, #{softCostActual,jdbcType=DECIMAL}, #{auditCost,jdbcType=DECIMAL},
|
|
|
+ #{auditCostActual,jdbcType=DECIMAL}, #{otherCost,jdbcType=DECIMAL}, #{otherCostActual,jdbcType=DECIMAL},
|
|
|
+ #{expectProfit,jdbcType=DECIMAL}, #{actualProfit,jdbcType=DECIMAL})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderMid" useGeneratedKeys="true">
|
|
|
insert into t_order_mid
|
|
|
@@ -140,6 +157,36 @@
|
|
|
<if test="serviceProject != null">
|
|
|
service_project,
|
|
|
</if>
|
|
|
+ <if test="patentCost != null">
|
|
|
+ patent_cost,
|
|
|
+ </if>
|
|
|
+ <if test="patentCostActual != null">
|
|
|
+ patent_cost_actual,
|
|
|
+ </if>
|
|
|
+ <if test="softCost != null">
|
|
|
+ soft_cost,
|
|
|
+ </if>
|
|
|
+ <if test="softCostActual != null">
|
|
|
+ soft_cost_actual,
|
|
|
+ </if>
|
|
|
+ <if test="auditCost != null">
|
|
|
+ audit_cost,
|
|
|
+ </if>
|
|
|
+ <if test="auditCostActual != null">
|
|
|
+ audit_cost_actual,
|
|
|
+ </if>
|
|
|
+ <if test="otherCost != null">
|
|
|
+ other_cost,
|
|
|
+ </if>
|
|
|
+ <if test="otherCostActual != null">
|
|
|
+ other_cost_actual,
|
|
|
+ </if>
|
|
|
+ <if test="expectProfit != null">
|
|
|
+ expect_profit,
|
|
|
+ </if>
|
|
|
+ <if test="actualProfit != null">
|
|
|
+ actual_profit,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="orderNo != null">
|
|
|
@@ -214,6 +261,36 @@
|
|
|
<if test="serviceProject != null">
|
|
|
#{serviceProject,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="patentCost != null">
|
|
|
+ #{patentCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="patentCostActual != null">
|
|
|
+ #{patentCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="softCost != null">
|
|
|
+ #{softCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="softCostActual != null">
|
|
|
+ #{softCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="auditCost != null">
|
|
|
+ #{auditCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="auditCostActual != null">
|
|
|
+ #{auditCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="otherCost != null">
|
|
|
+ #{otherCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="otherCostActual != null">
|
|
|
+ #{otherCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="expectProfit != null">
|
|
|
+ #{expectProfit,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="actualProfit != null">
|
|
|
+ #{actualProfit,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderMid">
|
|
|
@@ -291,6 +368,36 @@
|
|
|
<if test="serviceProject != null">
|
|
|
service_project = #{serviceProject,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="patentCost != null">
|
|
|
+ patent_cost = #{patentCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="patentCostActual != null">
|
|
|
+ patent_cost_actual = #{patentCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="softCost != null">
|
|
|
+ soft_cost = #{softCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="softCostActual != null">
|
|
|
+ soft_cost_actual = #{softCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="auditCost != null">
|
|
|
+ audit_cost = #{auditCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="auditCostActual != null">
|
|
|
+ audit_cost_actual = #{auditCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="otherCost != null">
|
|
|
+ other_cost = #{otherCost,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="otherCostActual != null">
|
|
|
+ other_cost_actual = #{otherCostActual,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="expectProfit != null">
|
|
|
+ expect_profit = #{expectProfit,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="actualProfit != null">
|
|
|
+ actual_profit = #{actualProfit,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
@@ -319,7 +426,17 @@
|
|
|
legal_affairs_status = #{legalAffairsStatus,jdbcType=INTEGER},
|
|
|
project_type = #{projectType,jdbcType=INTEGER},
|
|
|
service_type = #{serviceType,jdbcType=VARCHAR},
|
|
|
- service_project = #{serviceProject,jdbcType=VARCHAR}
|
|
|
+ service_project = #{serviceProject,jdbcType=VARCHAR},
|
|
|
+ patent_cost = #{patentCost,jdbcType=DECIMAL},
|
|
|
+ patent_cost_actual = #{patentCostActual,jdbcType=DECIMAL},
|
|
|
+ soft_cost = #{softCost,jdbcType=DECIMAL},
|
|
|
+ soft_cost_actual = #{softCostActual,jdbcType=DECIMAL},
|
|
|
+ audit_cost = #{auditCost,jdbcType=DECIMAL},
|
|
|
+ audit_cost_actual = #{auditCostActual,jdbcType=DECIMAL},
|
|
|
+ other_cost = #{otherCost,jdbcType=DECIMAL},
|
|
|
+ other_cost_actual = #{otherCostActual,jdbcType=DECIMAL},
|
|
|
+ expect_profit = #{expectProfit,jdbcType=DECIMAL},
|
|
|
+ actual_profit = #{actualProfit,jdbcType=DECIMAL}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
@@ -339,7 +456,8 @@
|
|
|
</update>
|
|
|
<update id="updatefinalReceivables">
|
|
|
update t_order_mid set final_receivables= #{amount},`final_Receivables_time`= #{receivablesTime},
|
|
|
- order_arrears=if(order_arrears- #{amount} < 0,0,order_arrears- #{amount})
|
|
|
+ order_arrears=if(order_arrears- #{amount} < 0,0,order_arrears- #{amount}),
|
|
|
+ actual_profit=#{count}-payment_amount
|
|
|
where order_no= #{orderNo}
|
|
|
</update>
|
|
|
<update id="updateInvoice">
|
|
|
@@ -352,27 +470,22 @@
|
|
|
|
|
|
|
|
|
<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.settlement_amount-y.party
|
|
|
+ where x.order_no =y.order_no and x.order_no=z.order_no
|
|
|
</update>
|
|
|
|
|
|
- <update id="updateAddCostAmount">
|
|
|
- update t_order_task a ,t_order_mid b
|
|
|
- <set>
|
|
|
- <if test="cost !=null">
|
|
|
- b.cost_amount= b.cost_amount+#{cost},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where a.order_no=b.order_no and a.id= #{tid}
|
|
|
- </update>
|
|
|
+
|
|
|
<update id="updateByOrderNo">
|
|
|
update t_order_mid
|
|
|
<set>
|
|
|
@@ -588,12 +701,12 @@
|
|
|
where d.sort =6 and a.order_no = #{orderNo}
|
|
|
</select>
|
|
|
|
|
|
- <update id="updateCountProjectAndType">
|
|
|
- update t_order_mid a ,(select a.order_no ,GROUP_CONCAT(DISTINCT a.commodity_name )pname, GROUP_CONCAT(DISTINCT c.cname )cname
|
|
|
- from t_order_task a left join business_project b on a.commodity_id =b.id
|
|
|
- left join business_category c on b.cid =c.id
|
|
|
- group by a.order_no )b
|
|
|
- set a.service_project =b.pname,a.service_type =b.cname
|
|
|
- where a.order_no=b.order_no and a.order_no = #{orderNo};
|
|
|
- </update>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectAll" resultType="com.goafanti.common.model.TOrderMid">
|
|
|
+ select order_no orderNo
|
|
|
+ from t_order_mid
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|