(cast(contract_amount as decimal(18,2))-(select cast(case when total_reback_view.sum is null then 0 else total_reback_view.sum end as decimal(18,2)) from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid)-cast(CASE WHEN deduct_amount IS NULL THEN 0 ELSE deduct_amount end as decimal(18,2))-cast(CASE WHEN stop_amount IS NULL THEN 0 ELSE stop_amount END as decimal(18,2))
(cast(contract_amount as decimal(18,2))-(select cast(case when total_reback_view.sum is null then 0 else total_reback_view.sum end as decimal(18,2)) from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid)-cast(CASE WHEN deduct_amount IS NULL THEN 0 ELSE deduct_amount end as decimal(18,2))-cast(CASE WHEN stop_amount IS NULL THEN 0 ELSE stop_amount END as decimal(18,2))
-cast(CASE WHEN exemptions_amount IS NULL THEN 0 ELSE exemptions_amount END as decimal(18,2))-cast(CASE WHEN bad_amount IS NULL THEN 0 ELSE bad_amount END as decimal(18,2))) as contract_remain,
-cast(CASE WHEN exemptions_amount IS NULL THEN 0 ELSE exemptions_amount END as decimal(18,2))-cast(CASE WHEN bad_amount IS NULL THEN 0 ELSE bad_amount END as decimal(18,2))) as contract_remain,
...
@@ -328,15 +358,30 @@
...
@@ -328,15 +358,30 @@
<iftest="customer_unid != null and customer_unid != ''">
<iftest="customer_unid != null and customer_unid != ''">
customer_unid=#{customer_unid},
customer_unid=#{customer_unid},
</if>
</if>
<iftest="final_user != null and final_user !=''">
<iftest="final_user != null ">
final_user=#{final_user},
final_user=#{final_user},
</if>
</if>
<iftest="relation_customer != null and relation_customer !=''">
<iftest="relation_customer != null and relation_customer !=''">
relation_customer=#{relation_customer},
relation_customer=#{relation_customer},
</if>
</if>
<iftest="industry != null and industry !=''">
<iftest="first_industry != null and first_industry !=''">
industry=#{industry}
first_industry=#{first_industry},
</if>
</if>
<iftest="second_industry != null and second_industry !=''">
second_industry=#{second_industry},
</if>
<iftest="final_user_name != null and final_user_name !=''">
final_user_name=#{final_user_name},
</if>
<iftest="relation_customer_name != null and relation_customer_name !=''">
relation_customer_name=#{relation_customer_name},
</if>
<iftest="first_industry_name != null and first_industry_name !=''">
first_industry_name=#{first_industry_name},
</if>
<iftest="second_industry_name != null and second_industry_name !=''">
second_industry_name=#{second_industry_name}
</if>
</set>
</set>
where contract_unid=#{contract_unid}
where contract_unid=#{contract_unid}
</update>
</update>
...
@@ -425,7 +470,7 @@
...
@@ -425,7 +470,7 @@
and
and
contract_type=#{contract_type}
contract_type=#{contract_type}
</if>
</if>
<iftest="final_user !=null and final_user !=''">
<iftest="final_user !=null ">
and
and
final_user=#{final_user}
final_user=#{final_user}
</if>
</if>
...
@@ -433,10 +478,30 @@
...
@@ -433,10 +478,30 @@
and
and
relation_customer=#{relation_customer}
relation_customer=#{relation_customer}
</if>
</if>
<iftest="industry !=null and industry !=''">
<iftest="first_industry !=null and first_industry !=''">
and
and
industry=#{industry}
first_industry=#{first_industry}
</if>
</if>
<iftest="second_industry !=null and second_industry !=''">
and
second_industry=#{second_industry}
</if>
<iftest="final_user_name !=null and final_user_name !=''">
and
final_user_name=#{final_user_name}
</if>
<iftest="relation_customer_name !=null and relation_customer_name !=''">
and
relation_customer_name=#{relation_customer_name}
</if>
<iftest="first_industry_name !=null and first_industry_name !=''">
and
first_industry_name=#{first_industry_name}
</if>
<iftest="second_industry_name !=null and second_industry_name !=''">
and
second_industry_name=#{second_industry_name}
</if>
<iftest="is_archive !=null">
<iftest="is_archive !=null">
and
and
is_archive=#{is_archive}
is_archive=#{is_archive}
...
@@ -596,7 +661,7 @@
...
@@ -596,7 +661,7 @@
and
and
contract_type=#{contract_type}
contract_type=#{contract_type}
</if>
</if>
<iftest="final_user !=null and final_user !=''">
<iftest="final_user !=null ">
and
and
final_user=#{final_user}
final_user=#{final_user}
</if>
</if>
...
@@ -604,10 +669,30 @@
...
@@ -604,10 +669,30 @@
and
and
relation_customer=#{relation_customer}
relation_customer=#{relation_customer}
</if>
</if>
<iftest="industry !=null and industry !=''">
<iftest="first_industry !=null and first_industry !=''">
and
and
industry=#{industry}
first_industry=#{first_industry}
</if>
</if>
<iftest="second_industry !=null and second_industry !=''">
and
second_industry=#{second_industry}
</if>
<iftest="final_user_name !=null and final_user_name !=''">
and
final_user_name=#{final_user_name}
</if>
<iftest="relation_customer_name !=null and relation_customer_name !=''">
and
relation_customer_name=#{relation_customer_name}
</if>
<iftest="first_industry_name !=null and first_industry_name !=''">
and
first_industry_name=#{first_industry_name}
</if>
<iftest="second_industry_name !=null and second_industry_name !=''">
and
second_industry_name=#{second_industry_name}
</if>
<iftest="is_archive !=null">
<iftest="is_archive !=null">
and
and
is_archive=#{is_archive}
is_archive=#{is_archive}
...
@@ -679,7 +764,7 @@
...
@@ -679,7 +764,7 @@
</foreach>
</foreach>
</if>
</if>
from (select
from (select
contract_unid, salesperson_unid, province, city, county, province_name,city_name,county_name,final_user,relation_customer,industry,
contract_unid, salesperson_unid, province, city, county, province_name,city_name,county_name,final_user_name,relation_customer_name,first_industry_name,second_industry_name,
guarantee_period,to_char(sign_date, 'yyyy-MM-dd') as sign_date, product_line_type, contract_state,
guarantee_period,to_char(sign_date, 'yyyy-MM-dd') as sign_date, product_line_type, contract_state,
contract_type, cast(contract_amount as decimal(18,2)), cast(deduct_amount as decimal(18,2)), contract_amount_note,
contract_type, cast(contract_amount as decimal(18,2)), cast(deduct_amount as decimal(18,2)), contract_amount_note,
cast(stop_amount as decimal(18,2)), reback_note, cast(exemptions_amount as decimal(18,2)), contract_remain_note,
cast(stop_amount as decimal(18,2)), reback_note, cast(exemptions_amount as decimal(18,2)), contract_remain_note,
...
@@ -799,7 +884,7 @@
...
@@ -799,7 +884,7 @@
and
and
contract_type=#{contract_type}
contract_type=#{contract_type}
</if>
</if>
<iftest="final_user !=null and final_user !=''">
<iftest="final_user !=null ">
and
and
final_user=#{final_user}
final_user=#{final_user}
</if>
</if>
...
@@ -807,10 +892,30 @@
...
@@ -807,10 +892,30 @@
and
and
relation_customer=#{relation_customer}
relation_customer=#{relation_customer}
</if>
</if>
<iftest="industry !=null and industry !=''">
<iftest="first_industry !=null and first_industry !=''">
and
and
industry=#{industry}
first_industry=#{first_industry}
</if>
</if>
<iftest="second_industry !=null and second_industry !=''">
and
second_industry=#{second_industry}
</if>
<iftest="final_user_name !=null and final_user_name !=''">
and
final_user_name=#{final_user_name}
</if>
<iftest="relation_customer_name !=null and relation_customer_name !=''">
and
relation_customer_name=#{relation_customer_name}
</if>
<iftest="first_industry_name !=null and first_industry_name !=''">
and
first_industry_name=#{first_industry_name}
</if>
<iftest="second_industry_name !=null and second_industry_name !=''">