[BO] 조사원현황 countAll 쿼리 수정

This commit is contained in:
kangsunlee
2025-06-30 18:25:53 +09:00
parent 8db1496e72
commit fb28099db6

View File

@@ -39,17 +39,25 @@
</select>
<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
where
ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
select COUNT(DISTINCT a.seq)
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq AND ahr.is_deleted = false
left join researcher_has_household rhh ON rhh.admin_seq = a.seq AND rhh.is_deleted = false
left join household h ON h.seq = rhh.household_seq AND h.is_panel IS true AND h.is_deleted = false
where ahr.role_id = 'ROLE_RESEARCHER'
<if test="searchField == '' and searchValue != null and searchValue != ''">
and (a.name LIKE CONCAT('%', #{searchValue}, '%') OR a.phone LIKE CONCAT('%', #{searchValue}, '%'))
</if>
<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="searchArea != null and searchArea != ''">
and a.region_main_code = #{searchArea}
</if>
<if test="searchAccountDisabled != null and searchAccountDisabled != ''">
and a.account_disabled = #{searchAccountDisabled}
</if>