[BO] 임가현황 작업 중 (12) - 임가리스트, 상세, 임가수정, 임가등록, 조사원매핑 작업

This commit is contained in:
kangsunlee
2025-06-20 15:14:47 +09:00
parent 79a4f64bd2
commit 23dfffaa43
31 changed files with 892 additions and 159 deletions

View File

@@ -111,7 +111,7 @@
(
nextval('researcher_has_household_seq'),
#{householdSeq},
#{adminSeq},
#{researcherSeq},
<include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>

View File

@@ -28,7 +28,7 @@
<foreach collection="householdSeqs" item="householdSeq" separator=",">
(
nextval('researcher_has_household_seq'),
#{adminSeq},
#{researcherSeq},
#{householdSeq},
<include refid="common.fields.CreateUpdateBaseValues"/>
)

View File

@@ -28,11 +28,19 @@
GROUP BY dr.id
),
month_check AS (
SELECT #{recordMonth} = TO_CHAR(CURRENT_DATE, 'YYYYMM') AS is_current_month
SELECT
#{recordMonth} = TO_CHAR(CURRENT_DATE, 'YYYYMM') AS is_current_month,
EXTRACT(DAY FROM (TO_DATE(#{recordMonth}, 'YYYYMM') + INTERVAL '1 MONTH - 1 day')) AS month_last_day /* recordMonth 의 말일 */
)
SELECT
dr.id AS id,
ddg.start_day || CASE WHEN ddg.start_day = ddg.end_day THEN '' ELSE '-' || ddg.end_day END AS day_group,
/* 해당 월의 말일을 기준으로 종료일을 제한하여 일자 그룹 표시 */
ddg.start_day ||
CASE
WHEN ddg.start_day = LEAST(ddg.end_day, mc.month_last_day)
THEN ''
ELSE '-' || LEAST(ddg.end_day, mc.month_last_day)
END AS day_group,
CASE
WHEN mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE) THEN 'WAITING' /* 대기 */
WHEN dr.all_status IN ('DONE', 'TODAY_NONE') THEN 'DONE' /* 작성완료 */
@@ -58,6 +66,7 @@
AND dr.record_month = #{recordMonth}
AND dr.is_deleted = false
LEFT JOIN data_counts dc ON dc.id = dr.id
WHERE ddg.start_day &lt;= mc.month_last_day
ORDER BY ddg.start_day
</select>
</mapper>

View File

@@ -5,6 +5,7 @@
namespace="app.module.admin.usecase.household.getHouseholdStatus.adapters.persistence.GetHouseholdStatusMapper">
<select id="getHouseholdStatusById"
resultType="app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatus">
/* getHouseholdStatusById : 임가 정보 상세 */
SELECT
h.seq AS householdSeq,
h.household_num AS householdNum,
@@ -12,16 +13,22 @@
h.owner_age AS householdAge,
h.tel AS householdTel,
h.phone AS householdPhone,
h.region_main_code AS regionMainCode,
h.region_main_name AS regionMainName,
h.region_sub_code AS regionSubCode,
h.region_sub_name AS regionSubName,
h.region_detail_code AS regionDetailCode,
h.region_detail_name AS regionDetailName,
h.address AS address,
h.industry_large_code AS industryLargeCode,
h.industry_large_name AS industryLargeName,
h.industry_middle_code AS industryMiddleCode,
h.industry_middle_name AS industryMiddleName,
h.industry_sub_middle AS industrySubMiddleName,
h.industry_detail AS industryDetailName,
h.is_panel AS isPanel,
h.memo AS memo,
r.admin_seq AS researcherSeq,
r.researcher_name AS researcherName,
r.researcher_phone AS researcherPhone
FROM v_household_with_code h

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.updateHousehold.adapters.persistence.UpdateHouseholdMapper">
<update id="updateHousehold">
/* updateHousehold : 임가 정보 수정 */
UPDATE household
SET
owner_name = #{ownerName},
owner_age = #{ownerAge},
<if test="tel != null and tel != ''">
tel = #{tel},
</if>
phone = #{phone},
region_main_code = #{regionMainCode},
region_sub_code = #{regionSubCode},
region_detail_code = #{regionDetailCode},
address = #{address},
<if test="industryLargeCode != null and industryLargeCode != ''">
industry_large_code = #{industryLargeCode},
</if>
<if test="industryMiddleCode != null and industryMiddleCode != ''">
industry_middle_code = #{industryMiddleCode},
</if>
<if test="industrySubMiddle != null and industrySubMiddle != ''">
industry_sub_middle = #{industrySubMiddle},
</if>
<if test="industryDetail != null and industryDetail != ''">
industry_detail = #{industryDetail},
</if>
is_panel = #{isPanel},
<if test="memo != null and memo != ''">
memo = #{memo},
</if>
<include refid="common.fields.UpdateBaseSet"/>
WHERE seq = #{householdSeq}
</update>
<update id="deleteResearcherHasHousehold">
/* deleteResearcherHasHousehold : 임가에 매핑된 담당 조사원 삭제 */
UPDATE researcher_has_household
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE is_deleted = false
AND household_seq = #{householdSeq}
</update>
<insert id="createResearcherHasHousehold">
/* createResearcherHasHousehold : 임가에 담당 조사원 매핑 */
INSERT INTO researcher_has_household
(
id,
admin_seq,
household_seq,
<include refid="common.fields.CreateUpdateBaseColumns"/>
)
VALUES
(
nextval('researcher_has_household_seq'),
#{researcherSeq},
#{householdSeq},
<include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
</mapper>