조사원 현황 수정

This commit is contained in:
주수현
2025-06-14 17:43:04 +09:00
parent efe27296bf
commit f061085ce3
9 changed files with 178 additions and 122 deletions

View File

@@ -11,7 +11,7 @@
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
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
@@ -25,6 +25,9 @@
<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>
@@ -56,7 +59,7 @@
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
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
@@ -86,8 +89,8 @@
left join uicode il ON il.parent_id = 'code.industry.large' AND il.id = h.industry_large_code
left join uicode im ON im.parent_id = 'code.industry.middle' AND im.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 test="seq > 0">
and ahr.admin_seq = #{seq}
</if>
LIMIT #{size} OFFSET #{page}*#{size}
</select>
@@ -98,8 +101,8 @@
from household h
join admin_has_role ahr ON h.seq = ahr.admin_seq
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="adminSeq > 0">
and a.admin_seq = #{adminSeq}
<if test="seq > 0">
and ahr.admin_seq = #{seq}
</if>
</select>
@@ -108,7 +111,7 @@
select
rhv.id,
rhv.admin_seq,
rhv.household_seq
rhv.household_seq,
h.household_num,
h.owner_name,
rhv.visit_date,
@@ -119,8 +122,11 @@
join household h on rhv.household_seq = h.seq
join admin a on a.seq = rhv.admin_seq
where rhv.is_deleted = false
<if test="adminSeq > 0">
and rhv.admin_seq = #{adminSeq}
<if test="seq > 0">
and rhv.admin_seq = #{seq}
</if>
<if test="searchMonth != null and searchMonth != ''">
and TO_CHAR(rhv.visit_date ,'YYYYMM')= #{searchMonth}
</if>
LIMIT #{size} OFFSET #{page}*#{size}
</select>
@@ -129,9 +135,23 @@
select count(*)
from researcher_household_visit rhv
where rhv.is_deleted = false
<if test="adminSeq > 0">
and rhv.admin_seq = #{adminSeq}
<if test="seq > 0">
and rhv.admin_seq = #{seq}
</if>
<if test="searchMonth != null and searchMonth != ''">
and TO_CHAR(rhv.visit_date ,'YYYYMM')= #{searchMonth}
</if>
</select>
<update id="visitHouseholdDelete">
update researcher_household_visit
set is_deleted = true,
deleted_at = NOW(),
deleted_by = #{deletedBy}
where id in (
<foreach collection="selectIds" item="item" separator=",">
#{item}
</foreach>)
</update>
</mapper>