조사원 현황 - 임가매핑 수정
This commit is contained in:
@@ -7,21 +7,22 @@
|
||||
<select id="getHouseholdsStatus"
|
||||
resultType="app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus">
|
||||
/* getHouseholdsStatus : 임가현황 리스트 조회 */
|
||||
WITH record_progress AS (
|
||||
SELECT ROUND(
|
||||
100.0 *
|
||||
(SELECT COUNT(*)
|
||||
FROM daily_record
|
||||
WHERE record_month = #{cmd.recordMonth} AND all_status = 'DONE')
|
||||
/ NULLIF(
|
||||
<if test="!(cmd.viewType eq 'popup')">
|
||||
WITH record_progress AS (
|
||||
SELECT ROUND(
|
||||
100.0 *
|
||||
(SELECT COUNT(*)
|
||||
FROM daily_day_group
|
||||
WHERE end_day <= EXTRACT(DAY FROM CURRENT_DATE)), 0
|
||||
),
|
||||
2
|
||||
) AS progress_percent
|
||||
) /* 일계부 입력 진행 완료 퍼센테이지 (이번달 작성 완료일 수 / 현재날짜 기준 전체 입력 가능 날짜 수) */
|
||||
|
||||
FROM daily_record
|
||||
WHERE record_month = #{cmd.recordMonth} AND all_status = 'DONE')
|
||||
/ NULLIF(
|
||||
(SELECT COUNT(*)
|
||||
FROM daily_day_group
|
||||
WHERE end_day <= EXTRACT(DAY FROM CURRENT_DATE)), 0
|
||||
),
|
||||
2
|
||||
) AS progress_percent
|
||||
) /* 일계부 입력 진행 완료 퍼센테이지 (이번달 작성 완료일 수 / 현재날짜 기준 전체 입력 가능 날짜 수) */
|
||||
</if>
|
||||
SELECT
|
||||
hvr.*,
|
||||
COUNT(*) OVER () AS total
|
||||
@@ -42,7 +43,12 @@
|
||||
h.industry_middle_code as industryMiddleCode,
|
||||
h.industry_middle_name AS industryMiddleName,
|
||||
h.is_panel AS isPanel,
|
||||
<if test="!(cmd.viewType eq 'popup')">
|
||||
ps.progress_percent AS progressPercent,
|
||||
</if>
|
||||
<if test="cmd.viewType eq 'popup'">
|
||||
0 AS progressPercent,
|
||||
</if>
|
||||
v.first_visit_date AS firstVisitDate,
|
||||
v.second_visit_date AS secondVisitDate,
|
||||
COALESCE(v.is_gift_sent, false) AS isGiftSent,
|
||||
@@ -51,7 +57,9 @@
|
||||
FROM v_household_with_code h
|
||||
LEFT JOIN v_household_visit v ON h.seq = v.household_seq
|
||||
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
|
||||
<if test="!(cmd.viewType eq 'popup')">
|
||||
CROSS JOIN record_progress ps
|
||||
</if>
|
||||
) AS hvr
|
||||
|
||||
<where>
|
||||
@@ -178,6 +186,18 @@
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="cmd.isMapping != null">
|
||||
/* 패널 유지 여부 */
|
||||
<choose>
|
||||
<when test="cmd.isMapping">
|
||||
AND r.researcher_name is not null
|
||||
</when>
|
||||
<when test="!cmd.isMapping">
|
||||
AND r.researcher_name is null
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
|
||||
ORDER BY hvr.householdNum ASC
|
||||
|
||||
Reference in New Issue
Block a user