|
|
@@ -23,12 +23,13 @@
|
|
|
<result column="dun_start_time" jdbcType="TIMESTAMP" property="dunStartTime" />
|
|
|
<result column="legal_affairs_type" jdbcType="INTEGER" property="legalAffairsType" />
|
|
|
<result column="operation_time" jdbcType="DATE" property="operationTime" />
|
|
|
+ <result column="legal_affairs_status" jdbcType="INTEGER" property="legalAffairsStatus" />
|
|
|
</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
|
|
|
+ dun_start_time, legal_affairs_type, operation_time, legal_affairs_status
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
select
|
|
|
@@ -47,16 +48,16 @@
|
|
|
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
|
|
|
- )
|
|
|
+ dun_start_time, legal_affairs_type, operation_time,
|
|
|
+ legal_affairs_status)
|
|
|
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},
|
|
|
#{createTime,jdbcType=TIMESTAMP}, #{buyerName,jdbcType=VARCHAR}, #{orderReceivables,jdbcType=DECIMAL},
|
|
|
#{orderArrears,jdbcType=DECIMAL}, #{paymentAmount,jdbcType=DECIMAL}, #{costAmount,jdbcType=DECIMAL},
|
|
|
#{depName,jdbcType=VARCHAR}, #{provinceName,jdbcType=VARCHAR}, #{legalAffairs,jdbcType=INTEGER},
|
|
|
- #{dunStartTime,jdbcType=TIMESTAMP}, #{legalAffairsType,jdbcType=INTEGER}, #{operationTime,jdbcType=DATE}
|
|
|
- )
|
|
|
+ #{dunStartTime,jdbcType=TIMESTAMP}, #{legalAffairsType,jdbcType=INTEGER}, #{operationTime,jdbcType=DATE},
|
|
|
+ #{legalAffairsStatus,jdbcType=INTEGER})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderMid" useGeneratedKeys="true">
|
|
|
insert into t_order_mid
|
|
|
@@ -121,6 +122,9 @@
|
|
|
<if test="operationTime != null">
|
|
|
operation_time,
|
|
|
</if>
|
|
|
+ <if test="legalAffairsStatus != null">
|
|
|
+ legal_affairs_status,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="orderNo != null">
|
|
|
@@ -183,6 +187,9 @@
|
|
|
<if test="operationTime != null">
|
|
|
#{operationTime,jdbcType=DATE},
|
|
|
</if>
|
|
|
+ <if test="legalAffairsStatus != null">
|
|
|
+ #{legalAffairsStatus,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderMid">
|
|
|
@@ -248,6 +255,9 @@
|
|
|
<if test="operationTime != null">
|
|
|
operation_time = #{operationTime,jdbcType=DATE},
|
|
|
</if>
|
|
|
+ <if test="legalAffairsStatus != null">
|
|
|
+ legal_affairs_status = #{legalAffairsStatus,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
@@ -272,7 +282,8 @@
|
|
|
legal_affairs = #{legalAffairs,jdbcType=INTEGER},
|
|
|
dun_start_time = #{dunStartTime,jdbcType=TIMESTAMP},
|
|
|
legal_affairs_type = #{legalAffairsType,jdbcType=INTEGER},
|
|
|
- operation_time = #{operationTime,jdbcType=DATE}
|
|
|
+ operation_time = #{operationTime,jdbcType=DATE},
|
|
|
+ legal_affairs_status = #{legalAffairsStatus,jdbcType=INTEGER}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<select id="selectByOrderNo" resultMap="BaseResultMap">
|
|
|
@@ -282,51 +293,51 @@
|
|
|
where order_no = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<update id="updateSalesmanId">
|
|
|
- update t_order_mid a ,admin b set a.salesman_id=#{transferId},a.salesman_name=b.name
|
|
|
- where b.id=#{transferId} and a.salesman_id=#{aid}
|
|
|
+ update t_order_mid a ,admin b set a.salesman_id=#{transferId},a.salesman_name=b.name
|
|
|
+ where b.id=#{transferId} and a.salesman_id=#{aid}
|
|
|
</update>
|
|
|
- <update id="updateFinanceId">
|
|
|
- update t_order_new a ,t_order_mid b,admin c set b.finance_id=#{financeId},b.finance_name=c.name
|
|
|
- where a.order_dep=#{id} and a.order_no=b.order_no and c.id= #{financeId}
|
|
|
+ <update id="updateFinanceId">
|
|
|
+ update t_order_new a ,t_order_mid b,admin c set b.finance_id=#{financeId},b.finance_name=c.name
|
|
|
+ where a.order_dep=#{id} and a.order_no=b.order_no and c.id= #{financeId}
|
|
|
</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})
|
|
|
- where order_no= #{orderNo}
|
|
|
+ update t_order_mid set final_receivables= #{amount},`final_Receivables_time`= #{receivablesTime},
|
|
|
+ order_arrears=if(order_arrears- #{amount} < 0,0,order_arrears- #{amount})
|
|
|
+ where order_no= #{orderNo}
|
|
|
</update>
|
|
|
<update id="updateInvoice">
|
|
|
- update t_order_mid m,(select order_no,sum(amount)amount from t_order_invoice where status=2 group by order_no)b
|
|
|
- set m.invoice_amount=b.amount where m.order_no= #{orderNo} and m.order_no=b.order_no
|
|
|
+ update t_order_mid m,(select order_no,sum(amount)amount from t_order_invoice where status=2 group by order_no)b
|
|
|
+ set m.invoice_amount=b.amount where m.order_no= #{orderNo} and m.order_no=b.order_no
|
|
|
</update>
|
|
|
<update id="addOrderReceivables">
|
|
|
- update t_order_mid set order_receivables=order_receivables+#{money},
|
|
|
- order_arrears=order_arrears+#{money}
|
|
|
- where order_no=#{orderNo}
|
|
|
+ update t_order_mid set order_receivables=order_receivables+#{money},
|
|
|
+ order_arrears=order_arrears+#{money}
|
|
|
+ where order_no=#{orderNo}
|
|
|
</update>
|
|
|
<select id="selectDepNameByDepid" resultType="java.lang.String">
|
|
|
- select name from department where id= #{orderDep}
|
|
|
+ select name from department where id= #{orderDep}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<update id="updateCostAmount">
|
|
|
- update t_order_task a ,t_order_mid b
|
|
|
+ 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>
|
|
|
+ <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>
|
|
|
|
|
|
<update id="updateAddCostAmount">
|
|
|
- update t_order_task a ,t_order_mid b
|
|
|
+ update t_order_task a ,t_order_mid b
|
|
|
<set>
|
|
|
- <if test="cost !=null">
|
|
|
- b.cost_amount= b.cost_amount+#{cost},
|
|
|
- </if>
|
|
|
+ <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>
|
|
|
@@ -423,15 +434,15 @@
|
|
|
#{dep}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <if test="shiro ==2">
|
|
|
- and c.superior_id = #{sid}
|
|
|
- </if>
|
|
|
+ <if test="shiro ==2">
|
|
|
+ and c.superior_id = #{sid}
|
|
|
+ </if>
|
|
|
<if test="userName != null">
|
|
|
and b.buyer_name like concat('%',#{userName},'%')
|
|
|
- </if>
|
|
|
- <if test="legalAffairs != null">
|
|
|
+ </if>
|
|
|
+ <if test="legalAffairs != null">
|
|
|
and b.legal_affairs = #{legalAffairs}
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
<if test="contractNo != null">
|
|
|
and a.contract_no like concat('%',#{contractNo},'%')
|
|
|
</if>
|
|
|
@@ -453,7 +464,7 @@
|
|
|
</if>
|
|
|
order by b.dun_start_time
|
|
|
<if test="page_sql != null">
|
|
|
- ${page_sql}
|
|
|
+ ${page_sql}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="legalAffairsOrderCount" resultType="integer">
|
|
|
@@ -514,8 +525,8 @@
|
|
|
set legal_affairs=1,legal_affairs_type =0
|
|
|
where order_no in(
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
- #{item}
|
|
|
+ #{item}
|
|
|
</foreach>
|
|
|
- )
|
|
|
+ )
|
|
|
</update>
|
|
|
</mapper>
|