동기화
This commit is contained in:
@@ -111,17 +111,30 @@
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 1~7년 차 전체 비율 조회 (분급 계획 일괄 생성 시 사용) -->
|
<!--
|
||||||
|
1~7년 차 전체 비율 조회 (분급 계획 일괄 생성 시 사용).
|
||||||
|
상품카테고리 일치 룰 우선, 없으면 product_category IS NULL(전 카테고리 기본)로 폴백한다.
|
||||||
|
(chargeback/channel NULL-우선 패턴 동일.) 각 (plan_year, plan_month) 슬롯마다 가장 구체적인
|
||||||
|
1건만 선택해 카테고리 부분 오버라이드 시에도 중복 합산을 방지한다.
|
||||||
|
— 기존 동작(NULL 매개변수 → IS NULL 행)도 그대로 보존된다.
|
||||||
|
-->
|
||||||
<select id="selectAllActiveRatios" resultMap="VOMap">
|
<select id="selectAllActiveRatios" resultMap="VOMap">
|
||||||
SELECT ratio_id, product_category, plan_year, plan_month, ratio_percent,
|
SELECT ratio_id, product_category, plan_year, plan_month, ratio_percent,
|
||||||
effective_from, effective_to, is_active,
|
effective_from, effective_to, is_active,
|
||||||
created_at, created_by, updated_at, updated_by
|
created_at, created_by, updated_at, updated_by
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT ON (plan_year, plan_month)
|
||||||
|
ratio_id, product_category, plan_year, plan_month, ratio_percent,
|
||||||
|
effective_from, effective_to, is_active,
|
||||||
|
created_at, created_by, updated_at, updated_by
|
||||||
FROM installment_ratio
|
FROM installment_ratio
|
||||||
WHERE (product_category = #{productCategory,jdbcType=VARCHAR}
|
WHERE (product_category = #{productCategory,jdbcType=VARCHAR} OR product_category IS NULL)
|
||||||
OR (#{productCategory,jdbcType=VARCHAR} IS NULL AND product_category IS NULL))
|
|
||||||
AND is_active = TRUE
|
AND is_active = TRUE
|
||||||
AND effective_from <= #{baseDate}::DATE
|
AND effective_from <= #{baseDate}::DATE
|
||||||
AND (effective_to IS NULL OR effective_to >= #{baseDate}::DATE)
|
AND (effective_to IS NULL OR effective_to >= #{baseDate}::DATE)
|
||||||
|
ORDER BY plan_year, plan_month NULLS FIRST,
|
||||||
|
(product_category IS NULL) ASC, effective_from DESC, ratio_id DESC
|
||||||
|
) r
|
||||||
ORDER BY plan_year, plan_month NULLS FIRST
|
ORDER BY plan_year, plan_month NULLS FIRST
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user