Merge branch 'susu' into dev
This commit is contained in:
@@ -83,16 +83,16 @@
|
||||
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
|
||||
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
||||
left join uicode rm ON rm.parent_id = 'code.region.main' AND rm.id = h.region_main_code
|
||||
left join uicode rs ON rs.parent_id = 'code.region.sub' AND rs.id = h.region_sub_code
|
||||
left join uicode rd ON rd.parent_id = 'code.region.detail' AND rd.id = h.region_detail_code
|
||||
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="seq > 0">
|
||||
and ahr.admin_seq = #{seq}
|
||||
</if>
|
||||
where 1=1
|
||||
<if test="seq > 0">
|
||||
and rhh.admin_seq = #{seq}
|
||||
</if>
|
||||
LIMIT #{size} OFFSET #{page}*#{size}
|
||||
</select>
|
||||
|
||||
@@ -100,10 +100,10 @@
|
||||
select
|
||||
count(*)
|
||||
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
|
||||
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
||||
where 1=1
|
||||
<if test="seq > 0">
|
||||
and ahr.admin_seq = #{seq}
|
||||
and rhh.admin_seq = #{seq}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -155,4 +155,31 @@
|
||||
</foreach>)
|
||||
</update>
|
||||
|
||||
<update id="deleteHouseholdResearcherMapping">
|
||||
update researcher_has_household
|
||||
set is_deleted = true,
|
||||
deleted_at = NOW(),
|
||||
deleted_by = #{deletedBy}
|
||||
where household_seq = #{householdSeq}
|
||||
</update>
|
||||
|
||||
<update id="insertHouseholdResearcherMapping">
|
||||
insert into researcher_has_household(
|
||||
id,
|
||||
admin_seq,
|
||||
household_seq,
|
||||
created_at,
|
||||
created_by,
|
||||
updated_at,
|
||||
updated_by
|
||||
)values(
|
||||
nextval('household_has_role_seq'),
|
||||
#{researcherSeq},
|
||||
#{householdSeq},
|
||||
NOW(),
|
||||
#{createdBy},
|
||||
NOW(),
|
||||
#{createdBy}
|
||||
)
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -15,8 +15,10 @@
|
||||
<section class="filter-wrap">
|
||||
<div class="form-area">
|
||||
<form autocomplete="off" method="get" name="reqHouseholdForm" id="reqHouseholdForm">
|
||||
<input name="page" th:field="*{reqVO.page}" type="hidden"/>
|
||||
<input type="hidden" name="page" th:field="*{reqVO.page}"/>
|
||||
<input type="hidden" name="researcherSeq" id="researcherSeq" th:value="${researcherSeq}">
|
||||
<input type="hidden" name="regionMainCode" th:value="${regionMainCode}">
|
||||
<input type="hidden" name="researcherName" id="researcherName" th:value="${researcherName}">
|
||||
<!-- 경영주 -->
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
@@ -141,8 +143,11 @@
|
||||
|
||||
<script th:inline="javascript">
|
||||
const showHouseholdModal = (button) => {
|
||||
// 버튼의 data-region-main-code 속성에서 regionMainCode 가져오기
|
||||
const regionMainCode = button.getAttribute('data-region-main-code') || '';
|
||||
const researcherSeq = button.getAttribute('data-researcher-seq') || '';
|
||||
const researcherName = button.getAttribute('data-researcher-name') || '';
|
||||
$('#researcherSeq').val(researcherSeq);
|
||||
$('#researcherName').val(researcherName);
|
||||
const existingModal = document.querySelector("#mappingHouseholdModal");
|
||||
if (existingModal) {
|
||||
existingModal.remove();
|
||||
@@ -183,10 +188,10 @@
|
||||
$(response.content).each((idx, ct) => {
|
||||
tbody.append(
|
||||
`
|
||||
<tr data-id="${ct.id}">
|
||||
<tr data-id="${ct.householdSeq}">
|
||||
<td>
|
||||
<label>
|
||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.seq}"/>
|
||||
<input class="form-check-input" name="householdSelect" type="checkbox" value="${ct.householdSeq}"/>
|
||||
</label>
|
||||
</td>
|
||||
<td>${ct.householdNum}</td>
|
||||
@@ -221,7 +226,7 @@
|
||||
const registerHouseholds = () => {
|
||||
const selectedIds = [];
|
||||
$('input[name="householdSelect"]:checked').each(function () {
|
||||
selectedIds.push($(this).val());
|
||||
selectedIds.push(Number($(this).val()));
|
||||
});
|
||||
|
||||
if (selectedIds.length === 0) {
|
||||
@@ -229,21 +234,31 @@
|
||||
return;
|
||||
}
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/researcher/mappingHousehold/search',
|
||||
{ regionMainCode: regionMainCode },
|
||||
function (response) {
|
||||
$("#mappingHouseholdModal").append(response);
|
||||
// 모달 표시
|
||||
if(confirm("총 "+selectedIds.length+"건에 대하여 조사원을 "+$('#researcherName').val()+"으로 설정하시겠습니까?")) {
|
||||
|
||||
},
|
||||
function (code, rstData) {
|
||||
alert('임가 등록에 실패했습니다.');
|
||||
},
|
||||
'get',
|
||||
'json',
|
||||
null
|
||||
);
|
||||
const data = {
|
||||
selectedIds: selectedIds,
|
||||
researcherSeq: $('#researcherSeq').val()
|
||||
};
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/researcher/mappingHousehold/update',
|
||||
JSON.stringify(data),
|
||||
function (response) {
|
||||
if (response === selectedIds.length) {
|
||||
alert('맵핑 완료되었습니다.');
|
||||
}
|
||||
document.querySelector(".modal01").ui.close();
|
||||
},
|
||||
function (code, rstData) {
|
||||
alert('임가 맵핑에 실패했습니다.');
|
||||
document.querySelector(".modal01").ui.close();
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
null
|
||||
);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</p>
|
||||
|
||||
<div id="researcher-tab1" >
|
||||
<button type="button" class="btn" th:data-region-main-code="${researcherDto.regionMainCode}" onclick="showHouseholdModal(this)">
|
||||
<button type="button" class="btn" th:data-researcher-seq="${researcherDto.seq}" th:data-region-main-code="${researcherDto.regionMainCode}" th:data-researcher-name="${researcherDto.name}" onclick="showHouseholdModal(this)">
|
||||
<span class="btn-txt">임가매핑</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -236,7 +236,6 @@
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 임가 방문 정보
|
||||
const getHouseholdVisitList = (pageNo) => {
|
||||
const f = document.householdReqForm;
|
||||
@@ -359,10 +358,6 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user