Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -12,15 +12,15 @@
|
||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
||||
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1) , 0 ) as gift_sent_percent
|
||||
FROM household h
|
||||
JOIN uicode u on u.parent_id ='code.region.main' and u.in_use = true and u.is_deleted = false
|
||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth}
|
||||
LEFT join household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth} and hv.is_deleted = false
|
||||
JOIN uicode u on u.parent_id ='code.region.main' and u.is_deleted = false <if test="'prod'.equals(activeProfiles)"> and u.in_use = true </if>
|
||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{reqVO.recordMonth}
|
||||
LEFT join household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth} and hv.is_deleted = false
|
||||
WHERE h.is_deleted = false
|
||||
<if test="usageType != null and usageType != ''">
|
||||
and h.usage_type = #{usageType}
|
||||
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||
and h.usage_type = #{reqVO.usageType}
|
||||
</if>
|
||||
<if test="regionMainCode != null and regionMainCode != ''">
|
||||
and h.region_main_code = #{regionMainCode}
|
||||
<if test="reqVO.regionMainCode != null and reqVO.regionMainCode != ''">
|
||||
and h.region_main_code = #{reqVO.regionMainCode}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -33,16 +33,16 @@
|
||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
||||
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT rhh.household_seq), 0), 1),0) as gift_sent_percent
|
||||
FROM household h
|
||||
JOIN uicode u on u.parent_id ='code.region.main' and u.in_use = true and u.is_deleted = false
|
||||
JOIN researcher_has_household rhh on rhh.household_seq = h.seq and rhh.admin_seq = #{adminSeq} and rhh.is_deleted = false
|
||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth}
|
||||
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth} and hv.is_deleted = false
|
||||
JOIN uicode u on u.parent_id ='code.region.main' and u.is_deleted = false <if test="'prod'.equals(activeProfiles)"> and u.in_use = true </if>
|
||||
JOIN researcher_has_household rhh on rhh.household_seq = h.seq and rhh.admin_seq = #{reqVO.adminSeq} and rhh.is_deleted = false
|
||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{reqVO.recordMonth}
|
||||
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth} and hv.is_deleted = false
|
||||
WHERE h.is_deleted = false
|
||||
<if test="usageType != null and usageType != ''">
|
||||
and h.usage_type = #{usageType}
|
||||
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||
and h.usage_type = #{reqVO.usageType}
|
||||
</if>
|
||||
<if test="regionMainCode != null and regionMainCode != ''">
|
||||
and h.region_main_code = #{regionMainCode}
|
||||
<if test="reqVO.regionMainCode != null and reqVO.regionMainCode != ''">
|
||||
and h.region_main_code = #{reqVO.regionMainCode}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -65,14 +65,17 @@
|
||||
ON rhh.admin_seq = a.seq AND rhh.is_deleted = false
|
||||
LEFT JOIN household h
|
||||
ON h.seq = rhh.household_seq AND h.is_deleted = false AND h.is_panel = true
|
||||
<if test="usageType != null and usageType != ''">
|
||||
and h.usage_type = #{usageType}
|
||||
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||
and h.usage_type = #{reqVO.usageType}
|
||||
</if>
|
||||
LEFT JOIN household_visit hv
|
||||
ON hv.household_seq = h.seq AND hv.is_deleted = false AND to_char(hv.visit_date,'YYYYMM') = #{recordMonth}
|
||||
ON hv.household_seq = h.seq AND hv.is_deleted = false AND to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth}
|
||||
LEFT JOIN v_monthly_completion_rate v
|
||||
ON v.household_seq = h.seq AND v.record_month = #{recordMonth}
|
||||
WHERE u.parent_id = 'code.region.main' and u.in_use = true
|
||||
ON v.household_seq = h.seq AND v.record_month = #{reqVO.recordMonth}
|
||||
WHERE u.parent_id = 'code.region.main'
|
||||
<if test="'prod'.equals(activeProfiles)">
|
||||
and u.in_use = true
|
||||
</if>
|
||||
GROUP BY ROLLUP(u.code_text)
|
||||
ORDER BY CASE WHEN COALESCE(u.code_text, '전체') = '전체' THEN 1 ELSE 0 END,
|
||||
MIN(u.order_no) NULLS LAST,
|
||||
@@ -91,18 +94,18 @@
|
||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
||||
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1), 0) AS gift_sent_percent
|
||||
FROM admin a
|
||||
JOIN uicode u ON a.region_main_code = u.id and u.parent_id = 'code.region.main' and u.in_use = true
|
||||
JOIN uicode u ON a.region_main_code = u.id and u.parent_id = 'code.region.main' <if test="'prod'.equals(activeProfiles)"> and u.in_use = true </if>
|
||||
JOIN admin_has_role ahr ON a.seq = ahr.admin_seq AND ahr.is_deleted = false AND ahr.role_id = 'ROLE_RESEARCHER'
|
||||
LEFT JOIN researcher_has_household rhh on rhh.admin_seq = ahr.admin_seq
|
||||
LEFT JOIN household h on h.seq = rhh.household_seq
|
||||
<if test="usageType != null and usageType != ''">
|
||||
and h.usage_type = #{usageType}
|
||||
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||
and h.usage_type = #{reqVO.usageType}
|
||||
</if>
|
||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth}
|
||||
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth}
|
||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{reqVO.recordMonth}
|
||||
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth}
|
||||
WHERE a.is_deleted = false and a.account_disabled = false
|
||||
<if test="regionMainCode != null and regionMainCode != ''">
|
||||
and a.region_main_code = #{regionMainCode}
|
||||
<if test="reqVO.regionMainCode != null and reqVO.regionMainCode != ''">
|
||||
and a.region_main_code = #{reqVO.regionMainCode}
|
||||
</if>
|
||||
GROUP BY a.seq,u.id
|
||||
</select>
|
||||
@@ -143,7 +146,10 @@
|
||||
LEFT JOIN v_monthly_completion_rate v
|
||||
ON v.household_seq = h.seq
|
||||
AND v.record_month = #{recordMonth}
|
||||
WHERE u.parent_id = 'code.region.main' and u.in_use = true and u.is_deleted = false
|
||||
WHERE u.parent_id = 'code.region.main' and u.is_deleted = false
|
||||
<if test="'prod'.equals(activeProfiles)">
|
||||
and u.in_use = true
|
||||
</if>
|
||||
GROUP BY u.code_text, u.order_no
|
||||
UNION ALL
|
||||
-- 전체 합계 행
|
||||
@@ -177,7 +183,10 @@
|
||||
LEFT JOIN v_monthly_completion_rate v
|
||||
ON v.household_seq = h.seq
|
||||
AND v.record_month = #{recordMonth}
|
||||
WHERE u.parent_id = 'code.region.main' and u.in_use = true and u.is_deleted = false
|
||||
WHERE u.parent_id = 'code.region.main' and u.is_deleted = false
|
||||
<if test="'prod'.equals(activeProfiles)">
|
||||
and u.in_use = true
|
||||
</if>
|
||||
ORDER BY order_no
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user