엑셀 다운로드 일계부 등록 데이터 작업중,,,

This commit is contained in:
주수현
2025-07-11 16:54:50 +09:00
parent 2a8671b967
commit b7845f14d7
10 changed files with 279 additions and 26 deletions

View File

@@ -150,4 +150,83 @@
</foreach>
ORDER BY household_num
</select>
<select id="forestProducts"
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetForestProducts">
/* 엑셀 다운로드 - 일계부 등록데이터 ( 1.임산물현황 ) 조회 */
WITH unit_codes AS (
SELECT id, code_text
FROM uicode
WHERE parent_id = 'code.record.unit'
AND is_deleted = false
)
SELECT
h.household_num,
h.owner_name,
fp.street_num,
fp.land_type,
fp.town,
fp.available_area,
fp.crop_name,
crop_code.code_text AS crop_code_name,
fp.land_area,
fp.main_yield,
CASE WHEN fp.main_yield_unit_code = 'code.record.unit.self' THEN fp.main_yield_unit
ELSE (select code_text from unit_codes where id = fp.main_yield_unit_code) END AS main_yield_unit_code_name,
fp.main_sale_amount,
CASE WHEN fp.main_sale_unit_code = 'code.record.unit.self' THEN fp.main_sale_unit
ELSE (select code_text from unit_codes where id = fp.main_sale_unit_code) END AS main_sale_unit_code_name,
fp.sub_yield,
CASE WHEN fp.sub_yield_unit_code = 'code.record.unit.self' THEN fp.sub_yield_unit
ELSE (select code_text from unit_codes where id = fp.sub_yield_unit_code) END AS sub_yield_unit_code_name,
fp.sub_sale_amount ,
CASE WHEN fp.sub_sale_unit_code = 'code.record.unit.self' THEN fp.sub_sale_unit
ELSE (select code_text from unit_codes where id = fp.sub_sale_unit_code) END AS sub_sale_unit_code_name
FROM forest_product fp
JOIN household h on fp.household_seq = h.seq and h.is_deleted = false
LEFT JOIN uicode crop_code on crop_code.parent_id = 'code.record.crop' and crop_code.id = fp.crop_code
WHERE fp.is_deleted = false
AND fp.month = #{recordMonth}
AND fp.household_seq IN
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
#{seq}
</foreach>
ORDER BY household_num
</select>
<select id="bankAutoTransfers"
resultType="app.module.admin.usecase.household.excelDownload.getHouseholdsExcel.ports.application.domain.GetBankAutoTransfers">
/* 엑셀 다운로드 - 일계부 등록데이터 ( 2.자동이체_수입(지출) ) 조회 */
WITH category_codes AS (
SELECT id, code_text
FROM uicode
WHERE (parent_id = 'code.bank.input' OR parent_id = 'code.bank.output')
AND is_deleted = false
)
SELECT
h.household_num,
h.owner_name,
transfer_type.code_text as transfer_type_name,
bat.income_code,
bat.expense_code,
crop_code.code_text as crop_code_name,
CASE WHEN bat.transfer_category_code = 'code.bank.input.self' OR bat.transfer_category_code = 'code.bank.output.self' THEN bat.transfer_category
ELSE (select code_text from category_codes where id = bat.transfer_category_code) END AS transfer_category_code_name,
bat.source_purpose,
bat.count,
unit_code.code_text as unit_code_name,
bat.price
FROM bank_auto_transfer bat
JOIN household h on bat.household_seq = h.seq and h.is_deleted = false
LEFT JOIN uicode transfer_type on transfer_type.parent_id = 'code.bank' and transfer_type.id = bat.transfer_type
LEFT JOIN uicode crop_code on crop_code.parent_id = 'code.record.crop' and crop_code.id = bat.crop_code
LEFT JOIN uicode unit_code on unit_code.parent_id = 'code.count.unit' and unit_code.id = bat.unit_code
WHERE bat.is_deleted = false
AND bat.month = #{recordMonth}
AND bat.household_seq IN
<foreach collection="householdSeqs" item="seq" open="(" separator="," close=")">
#{seq}
</foreach>
ORDER BY household_num
</select>
</mapper>