일단 커밋

This commit is contained in:
주수현
2025-06-13 17:30:33 +09:00
parent 4c1f6de57d
commit 693638e1a3
5 changed files with 457 additions and 121 deletions

View File

@@ -0,0 +1,92 @@
<?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">
<select id="list" parameterType="app.module.admin.usecase.researcher.web.model.ResearchersListReqVO">
select
a.id,
COUNT(rhh.id) AS household_count,
a.name,
a.phone,
max(u.code_text) AS region_main_code_name,
case a.account_disabled when false then '활성화' when true then '비활성화' end account_disabled_flag
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq
left join uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
left join researcher_has_household rhh ON rhh.admin_seq = a.seq
left join household h ON h.seq = rhh.household_seq AND h.is_panel IS true
where
ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="searchField == 'name' and searchValue != null and searchValue != ''">
and a.name LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchField == 'phone' and searchValue != null and searchValue != ''">
and a.phone LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchAccountDisabled != null and searchAccountDisabled != ''">
and a.account_disabled = #{searchAccountDisabled}
</if>
group by a.seq
LIMIT #{size} OFFSET #{page}*#{size}
</select>
<select id="countAll" parameterType="app.module.admin.usecase.researcher.web.model.ResearchersListReqVO" resultType="long">
select COUNT(a.seq)
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq
where
ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="searchField == 'name' and searchValue != null and searchValue != ''">
and a.name LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchField == 'phone' and searchValue != null and searchValue != ''">
and a.phone LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchAccountDisabled != null and searchAccountDisabled != ''">
and a.account_disabled = #{searchAccountDisabled}
</if>
</select>
<select id="detail">
select
a.id,
a.name,
a.phone,
u.code_text AS region_main_code_name,
case a.account_disabled when false then '활성화' when true then '비활성화' end account_disabled_flag
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq
left join uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="adminSeq > 0">
and a.seq = #{adminSeq}
</if>
</select>
<select id="mappingHouseholdList">
select
h.seq,
h.household_num,
h.name,
h.phone,
rm.code_text AS region_main_code_name,
rs.code_text AS region_sub_code_name,
rd.code_text AS region_detail_code_name,
il.code_text AS industry_large_code_name,
im.code_text AS industry_middle_code_name,
case h.is_panel when false then '유지' when true then '탈락' end panel_flag
from household h
join admin_has_role ahr ON h.seq = ahr.admin_seq
left join uicode rm ON u.parent_id = 'code.region.main' AND u.id = h.region_main_code
left join uicode rs ON u.parent_id = 'code.region.sub' AND u.id = h.region_sub_code
left join uicode rd ON u.parent_id = 'code.region.detail' AND u.id = h.region_detail_code
left join uicode il ON u.parent_id = 'code.industry.large' AND u.id = h.industry_large_code
left join uicode im ON u.parent_id = 'code.industry.middle' AND u.id = h.industry_middle_code
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="adminSeq > 0">
and a.seq = #{adminSeq}
</if>
</select>
</mapper>