Commit 48abef2d by zhangxingmin

push

parent 5fab4ff7
......@@ -126,6 +126,22 @@
FROM announcement_commission_ratio acr
INNER JOIN species_attrs sa ON acr.announcement_species_biz_id = sa.announcement_species_biz_id
INNER JOIN valid_species as1 ON acr.announcement_species_biz_id = as1.announcement_species_biz_id
-- 派生表:将保单保费转换为港币(若币种非HKD则通过跨库汇率表转换)
CROSS JOIN (
SELECT
CASE
WHEN #{request.policyCurrency} = 'HKD' THEN #{request.eachIssuePremium}
ELSE #{request.eachIssuePremium} * (
SELECT exchange_rate
FROM yd_base.exchange_rate
WHERE base_currency = #{request.policyCurrency}
AND target_currency = 'HKD'
AND is_active = 1
AND is_deleted = 0
LIMIT 1
)
END AS converted_premium
) cp
WHERE acr.is_deleted = 0
AND acr.status = 1
<if test="request.effectiveDate != null">
......@@ -180,25 +196,27 @@
)
)
<!-- 期缴保费(区间值)匹配:左开右闭 -->
<!-- 期缴保费(区间值)匹配:左开右闭,使用转换后的港币保费 -->
AND (
sa.premium_val IS NULL
OR (
cp.converted_premium IS NOT NULL
AND (
LOCATE('-', sa.premium_val) = 0
AND sa.premium_val = #{request.eachIssuePremium}
)
OR (
AND CAST(sa.premium_val AS DECIMAL(20,2)) = cp.converted_premium
OR
LOCATE('-', sa.premium_val) > 0
AND (
(
SUBSTRING_INDEX(sa.premium_val, '-', -1) != ''
AND CAST(SUBSTRING_INDEX(sa.premium_val, '-', 1) AS DECIMAL(20,2)) &lt; #{request.eachIssuePremium}
AND CAST(SUBSTRING_INDEX(sa.premium_val, '-', -1) AS DECIMAL(20,2)) >= #{request.eachIssuePremium}
AND CAST(SUBSTRING_INDEX(sa.premium_val, '-', 1) AS DECIMAL(20,2)) &lt; cp.converted_premium
AND CAST(SUBSTRING_INDEX(sa.premium_val, '-', -1) AS DECIMAL(20,2)) >= cp.converted_premium
)
OR
(
SUBSTRING_INDEX(sa.premium_val, '-', -1) = ''
AND CAST(SUBSTRING_INDEX(sa.premium_val, '-', 1) AS DECIMAL(20,2)) &lt; #{request.eachIssuePremium}
AND CAST(SUBSTRING_INDEX(sa.premium_val, '-', 1) AS DECIMAL(20,2)) &lt; cp.converted_premium
)
)
)
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment