[BO] 임가현황, 조사원현황 엑셀 다운로드 작업 중 (1)

This commit is contained in:
kangsunlee
2025-07-04 09:56:03 +09:00
parent 38a9ca2997
commit f53cab803b
23 changed files with 692 additions and 70 deletions

View File

@@ -26,7 +26,11 @@
THEN bat.unit
ELSE ui_unit.code_text
END AS unitText, /* 단위 */
bat.price AS price /* 현금(원) */
bat.price AS price, /* 현금(원) */
bat.category, /* 유형(엑셀용) */
bat.income_code, /* 수입부호(엑셀용) */
bat.expense_code, /* 지출부호(엑셀용) */
ui_crop.code_value AS cropValue /* 재배형태코드(엑셀용) */
FROM bank_auto_transfer bat
LEFT JOIN uicode ui_crop
ON ui_crop.parent_id = 'code.record.crop'
@@ -51,6 +55,9 @@
resultType="app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferExpenseRecords">
/* getBankAutoTransferExpenseRecords : 은행자동이체 (지출) 내역 목록 조회 */
SELECT bat.id, /* 지출 id */
bat.category, /* 유형(엑셀용) */
bat.income_code, /* 수입부호(엑셀용) */
bat.expense_code, /* 지출부호(엑셀용) */
CASE
WHEN ui_category.id = 'code.bank.input.self'
THEN bat.transfer_category

View File

@@ -23,6 +23,7 @@
df.town, /* 읍면동 */
df.available_area, /* 가능면적 */
df.crop_name, /* 재배작물명 */
df.crop_code, /* 작물부호 */
df.land_area, /* 면적 */
df.main_yield, /* 주생산물 수확량 */
CASE

View File

@@ -72,7 +72,12 @@
vs.second_visit_date AS secondVisitDate,
COALESCE(vs.is_gift_sent, false) AS isGiftSent,
r.researcher_name AS researcherName,
r.researcher_phone AS researcherPhone
r.researcher_phone AS researcherPhone,
h.owner_age, /* 엑셀용 */
h.address, /* 엑셀용 */
h.industry_sub_middle, /* 엑셀용 */
h.industry_detail, /* 엑셀용 */
h.usage_type /* 엑셀용 */
FROM v_household_with_code h
CROSS JOIN total_days td
LEFT JOIN daily_progress dp ON h.seq = dp.household_seq
@@ -224,6 +229,9 @@
</if>
ORDER BY hvr.householdNum ASC
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
<if test="cmd.isPaging">
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
</if>
</select>
</mapper>

View File

@@ -35,7 +35,10 @@
and a.account_disabled = #{searchAccountDisabled}
</if>
group by a.seq
LIMIT #{size} OFFSET #{page}*#{size}
<if test="isPaging">
LIMIT #{size} OFFSET #{page}*#{size}
</if>
</select>
<select id="countAll" parameterType="app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO" resultType="long">
@@ -92,9 +95,17 @@
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
case h.is_panel when false then '유지' when true then '탈락' end panel_flag,
h.owner_age,
h.address,
h.industry_sub_middle,
h.industry_detail,
h.usage_type,
a.name AS researcherName,
a.phone AS researcherPhone
from household h
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
join admin a ON a.seq = rhh.admin_seq and a.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.id = h.region_detail_code
@@ -104,7 +115,10 @@
<if test="seq > 0">
and rhh.admin_seq = #{seq}
</if>
LIMIT #{size} OFFSET #{page}*#{size}
<if test="isPaging">
LIMIT #{size} OFFSET #{page}*#{size}
</if>
</select>
<select id="mappingHouseholdListCountAll">

View File

@@ -275,7 +275,7 @@
<button type="button" class="btn" onclick="showExcelHouseholdModal();">
<span class="btn-txt">엑셀 업로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn">
<button type="button" class="btn" onclick="goExcel();">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
<!-- 관리자만 노출 -->
@@ -484,6 +484,24 @@
}
</script>
<script>
// 엑셀 다운로드
const goExcel = () => {
const url = '/api/households/excel';
const f = document.reqForm;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
if (url !== '') {
location.href = url + '?' + new URLSearchParams(data).toString();
} else {
console.warn('엑셀 다운르도 경로 없음.')
}
}
</script>
<script>
// 체크박스 전체 선택
document.getElementById('checkedAll').addEventListener('change', function () {

View File

@@ -436,11 +436,11 @@
if (el.dataset.tabValue === 'tab1') {
url = $('.tab-content .daily-record-list').is(':hidden') ? '/api/household/dailyRecordStatus/excel' : '/api/household/dailyRecordsStatus/excel';
} else if (el.dataset.tabValue === 'tab2') {
url = '';
url = $('.tab-content .forest-product').is(':hidden') ? '' : '/api/household/forestProduct/excel';
} else if (el.dataset.tabValue === 'tab3') {
url = '';
url = $('.tab-content .bank-auto-transfer').is(':hidden') ? '' : '/api/household/bankAutoTransfer/excel';
} else if (el.dataset.tabValue === 'tab4') {
url = '';
url = $('.tab-content .household-visit').is(':hidden') ? '' : '/api/household/visitInfos/excel';
}
console.log('goExcel', el.dataset.tabValue, url);

View File

@@ -51,6 +51,7 @@
<section>
<form autocomplete="off" method="get" name="householdReqForm" th:object="${reqVO}">
<input type="hidden" name="currentMonth" th:value="${currentMonth}">
<input type="hidden" name="isPaging">
<div class="component-tab" data-active="tab1">
<div class="tab-head">
@@ -167,12 +168,9 @@
</button>
</div>
<div class="btns-col-2 align-right" th:unless="${activeProfile != 'local'}">
<button type="button" class="btn">
<button type="button" class="btn" onclick="goExcel();">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn">
<span class="btn-txt">인쇄 <i class="ico-print" aria-hidden="true"></i></span>
</button>
</div>
</div>
</div>
@@ -210,6 +208,7 @@
const getHouseholdList = (pageNo) => {
const f = document.householdReqForm;
f.page.value = pageNo;
f.isPaging.value = true;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/api/researcher/mappingHouseholdList',
@@ -356,15 +355,29 @@
);
}
function goExcel() {
const selectedTab = document.querySelector('.tab-label[aria-selected="true"]');
let url = '';
if (selectedTab.dataset.tabValue === 'tab1') {
url = '/api/researcher/mappingHouseholdList/excel';
} else if (selectedTab.dataset.tabValue === 'tab2') {
url = ''; // 임가방문정보
}
const f = document.householdReqForm;
f.isPaging.value = false;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
location.href = '/admin/researchers/excel?' + new URLSearchParams(data).toString();
if (url !== '') {
location.href = url + '?' + new URLSearchParams(data).toString();
} else {
console.warn('엑셀 다운르도 경로 없음.')
}
}
// 체크박스 선택/해제

View File

@@ -9,6 +9,8 @@
<!-- hidden parameters -->
<input name="sort" th:field="*{sort}" type="hidden"/>
<input name="page" th:field="*{page}" type="hidden"/>
<input name="isPaging" type="hidden"/>
<div class="input-group">
<div class="input-label">
<p class="label-txt">
@@ -108,6 +110,7 @@
const getResearchers = (pageNo) => {
const f = document.reqForm;
f.page.value = pageNo;
f.isPaging.value = true;
let dataOj = $(f).serializeObject();
@@ -191,12 +194,14 @@
function goExcel() {
const f = document.reqForm;
f.isPaging.value = false;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
location.href = '/admin/researchers/excel?' + new URLSearchParams(data).toString();
location.href = '/api/researcher/list/excel?' + new URLSearchParams(data).toString();
}
// 체크박스 선택/해제