[Bo] 일계부 등록 내용 엑셀 다운로드(수입, 지출 외의 건)

This commit is contained in:
김현주
2025-07-03 14:34:55 +09:00
parent d904ff1baa
commit 1c2ea218ec
8 changed files with 314 additions and 48 deletions

View File

@@ -44,7 +44,7 @@
di.estimated_value, /* 현물평가액 */
di.updated_by, /* 최종수정자 */
TO_CHAR(di.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
<if test="recordSeq == null">
<if test="searchMonth == true">
, ddg.start_day
, ddg.end_day
</if>
@@ -55,7 +55,7 @@
LEFT JOIN uicode ui_unit
ON ui_unit.parent_id = 'code.record.unit'
AND ui_unit.id = di.unit_code
<if test="recordSeq == null">
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = di.daily_record_seq
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
@@ -63,11 +63,11 @@
ON ddg.group_no = dr.day_group_no
</if>
WHERE di.is_deleted = false
<if test="recordSeq != null">
<if test="searchMonth == false">
AND di.daily_record_seq = #{recordSeq}
ORDER BY di.created_at
</if>
<if test="recordSeq == null">
<if test="searchMonth == true">
ORDER BY ddg.start_day asc, di.created_at asc
</if>
</select>
@@ -77,7 +77,9 @@
/* getDailyWorkRecords : 일계부 등록 현황 상세 임업노동 투입 내역 조회 */
SELECT dw.id,
dw.item_name, /* 품목명 */
dw.work_name, /* 작업명*/
dw.item_mark,
dw.work_name, /* 작업명*/
dw.work_mark,
dw.work_land_area, /* 작업 면적 */
CASE
WHEN dw.area_unit_code = 'code.record.area.self'
@@ -102,6 +104,10 @@
dw.volunteer_f_hours, /* 일손돕기(여) */
dw.updated_by, /* 최종수정자 */
dw.updated_at /* 최종수정날짜 */
<if test="searchMonth == true">
, ddg.start_day
, ddg.end_day
</if>
FROM daily_work dw
LEFT JOIN uicode ui_area
ON ui_area.parent_id = 'code.record.area'
@@ -109,9 +115,21 @@
LEFT JOIN uicode ui_harvest
ON ui_harvest.parent_id = 'code.record.unit'
AND ui_harvest.id = dw.harvest_unit_code
WHERE dw.daily_record_seq = #{recordSeq}
AND dw.is_deleted = false
ORDER BY dw.created_at
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = dw.daily_record_seq
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
LEFT JOIN daily_day_group ddg
ON ddg.group_no = dr.day_group_no
</if>
WHERE dw.is_deleted = false
<if test="searchMonth == false">
AND dw.daily_record_seq = #{recordSeq}
ORDER BY dw.created_at
</if>
<if test="searchMonth == true">
ORDER BY ddg.start_day asc, dw.created_at asc
</if>
</select>
<select id="getDailyExpenseRecords"
@@ -137,15 +155,15 @@
de.estimated_value, /* 현물평가액 */
de.updated_by, /* 최종수정자 */
TO_CHAR(de.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
<if test="recordSeq == null">
, ddg.start_day
, ddg.end_day
<if test="searchMonth == true">
, ddg.start_day
, ddg.end_day
</if>
FROM daily_expense de
LEFT JOIN uicode ui_unit
ON ui_unit.parent_id = 'code.record.unit'
AND ui_unit.id = de.unit_code
<if test="recordSeq == null">
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = de.daily_record_seq
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
@@ -153,11 +171,11 @@
ON ddg.group_no = dr.day_group_no
</if>
WHERE de.is_deleted = false
<if test="recordSeq != null">
<if test="searchMonth == false">
AND de.daily_record_seq = #{recordSeq}
ORDER BY de.created_at
</if>
<if test="recordSeq == null">
<if test="searchMonth == true">
ORDER BY ddg.start_day asc, de.created_at asc
</if>
</select>
@@ -167,20 +185,39 @@
/* getDailyPowerRecords : 일계부 등록 현황 상세 동력사용시간 조회 */
SELECT dp.id, /* 동력사용시간 id */
dp.equipment_name, /* 명칭 */
dp.equipment_mark, /* 명칭 부호 */
dp.owned_hours, /* 자가 사용시간 */
dp.leased_hours, /* 임가 사용시간 */
dp.updated_by, /* 최종수정자 */
TO_CHAR(dp.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
<if test="searchMonth == true">
, ddg.start_day
, ddg.end_day
</if>
FROM daily_power dp
WHERE dp.daily_record_seq = #{recordSeq}
AND dp.is_deleted = false
ORDER BY dp.created_at
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = dp.daily_record_seq
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
LEFT JOIN daily_day_group ddg
ON ddg.group_no = dr.day_group_no
</if>
WHERE dp.is_deleted = false
<if test="searchMonth == false">
AND dp.daily_record_seq = #{recordSeq}
ORDER BY dp.created_at
</if>
<if test="searchMonth == true">
ORDER BY ddg.start_day asc, dp.created_at asc
</if>
</select>
<select id="getDailyForestryRecords"
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyForestryRecords">
/* getDailyForestryRecords : 일계부 등록 현황 상세 자가임업 생산물 중 자가소비량 조회 */
SELECT df.id, /* 자가임업 id */
df.income_mark,
df.expense_mark,
df.product_name, /* 생산물 */
df.usage, /* 용도 */
df.quantity, /* 수량 */
@@ -193,19 +230,37 @@
df.estimated_value, /* 현물평가액 */
df.updated_by, /* 최종수정자 */
TO_CHAR(df.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
<if test="searchMonth == true">
, ddg.start_day
, ddg.end_day
</if>
FROM daily_forestry df
LEFT JOIN uicode ui_unit
ON ui_unit.parent_id = 'code.record.unit'
AND ui_unit.id = df.unit_code
WHERE df.daily_record_seq = #{recordSeq}
AND df.is_deleted = false
ORDER BY df.created_at
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = df.daily_record_seq
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
LEFT JOIN daily_day_group ddg
ON ddg.group_no = dr.day_group_no
</if>
WHERE df.is_deleted = false
<if test="searchMonth == false">
AND df.daily_record_seq = #{recordSeq}
ORDER BY df.created_at
</if>
<if test="searchMonth == true">
ORDER BY ddg.start_day asc, df.created_at asc
</if>
</select>
<select id="getDailyFarmingRecords"
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyFarmingRecords">
/* getDailyFarmingRecords : 일계부 등록 현황 상세 자가농업 생산물 중 자가소비량 조회 */
SELECT df.id, /* 자가농업 id */
df.income_mark,
df.expense_mark,
CASE
WHEN df.product_code = 'code.record.farming.self'
THEN df.product_self
@@ -221,6 +276,10 @@
df.estimated_value, /* 현물평가액 */
df.updated_by, /* 최종수정자 */
TO_CHAR(df.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
<if test="searchMonth == true">
, ddg.start_day
, ddg.end_day
</if>
FROM daily_farming df
LEFT JOIN uicode ui_product
ON ui_product.parent_id = 'code.record.farming'
@@ -228,9 +287,21 @@
LEFT JOIN uicode ui_unit
ON ui_unit.parent_id = 'code.record.unit'
AND ui_unit.id = df.unit_code
WHERE df.daily_record_seq = #{recordSeq}
AND df.is_deleted = false
ORDER BY df.created_at
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = df.daily_record_seq
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
LEFT JOIN daily_day_group ddg
ON ddg.group_no = dr.day_group_no
</if>
WHERE df.is_deleted = false
<if test="searchMonth == false">
AND df.daily_record_seq = #{recordSeq}
ORDER BY df.created_at
</if>
<if test="searchMonth == true">
ORDER BY ddg.start_day asc, df.created_at asc
</if>
</select>
</mapper>