[BO] 수현매니저님 조사원 현황 팝업 임가 리스트 service 작업

This commit is contained in:
kangsunlee
2025-06-16 19:59:11 +09:00
parent 31e03c523e
commit 1ecc052b01
10 changed files with 240 additions and 7 deletions

View File

@@ -0,0 +1,90 @@
<?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.researcher.getPopupHouseholds.adapters.persistence.GetPopupHouseholdsMapper">
<select id="getPopupHouseholds"
resultType="app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds">
SELECT
hvr.*,
COUNT(*) OVER () AS total
FROM (
SELECT
h.seq AS householdSeq,
h.household_num AS householdNum,
h.owner_name AS householdName,
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.industry_large_code as industryLargeCode,
h.industry_large_name AS industryLargeName,
h.industry_middle_code as industryMiddleCode,
h.industry_middle_name AS industryMiddleName,
h.is_panel AS isPanel,
r.researcher_name AS researcherName
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
) AS hvr
<where>
1=1
<if test="cmd.ownerField != null and cmd.ownerField != ''">
/* 경영주 검색 */
<choose>
<when test="cmd.ownerField eq 'name'">
AND hvr.householdName ILIKE '%' || #{cmd.ownerValue} || '%'
</when>
<when test="cmd.ownerField eq 'phone'">
AND hvr.householdPhone ILIKE '%' || #{cmd.ownerValue} || '%'
</when>
</choose>
</if>
<if test="cmd.regionMainCode != null and cmd.regionMainCode != ''">
/* 실사 검색 */
AND hvr.regionMainCode = #{cmd.regionMainCode}
</if>
<if test="cmd.regionSubCode != null and cmd.regionSubCode != ''">
/* 지역 검색 */
AND hvr.regionSubCode = #{cmd.regionSubCode}
</if>
<if test="cmd.regionDetailCode != null and cmd.regionDetailCode != ''">
/* 세부지역 검색 */
AND hvr.regionDetailCode = #{cmd.regionDetailCode}
</if>
<if test="cmd.isPanel != null">
/* 패널 유지 여부 */
<choose>
<when test="cmd.isPanel">
AND hvr.isPanel = true
</when>
<when test="!cmd.isPanel">
AND hvr.isPanel = false
</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
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
</select>
</mapper>