포트 패캐지로 수정

This commit is contained in:
주수현
2025-06-17 14:52:51 +09:00
parent d60bb1e7c7
commit aaaef3b9d9
19 changed files with 236 additions and 75 deletions

View File

@@ -1,9 +1,9 @@
<?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.persistence.ResearcherMapper">
<mapper namespace="app.module.admin.usecase.researcher.adpaters.persistence.ResearcherMapper">
<select id="list" parameterType="app.module.admin.usecase.researcher.web.model.ResearchersListReqVO">
<select id="list" parameterType="app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO">
select
a.seq,
a.id,
@@ -35,7 +35,7 @@
LIMIT #{size} OFFSET #{page}*#{size}
</select>
<select id="countAll" parameterType="app.module.admin.usecase.researcher.web.model.ResearchersListReqVO" resultType="long">
<select id="countAll" parameterType="app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO" resultType="long">
select COUNT(a.seq)
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq
@@ -186,4 +186,83 @@
#{createdBy}
)
</update>
<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>