[Bo] 일계부 등록 내용 엑셀 다운로드(수입, 지출 외의 건)
This commit is contained in:
@@ -7,10 +7,7 @@ import app.module.admin.usecase.household.getHouseholdStatus.ports.application.d
|
||||
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.adapters.web.model.GetDailyRecordStatusDetailReqVO;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.GetDailyRecordStatusDetailPortIn;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyExpenseRecords;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyIncomeRecords;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatusDetail;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatusCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.*;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.adapters.web.model.GetDailyRecordsStatusReqVO;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.ports.application.domain.GetDailyRecordsStatus;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.ports.application.domain.GetDailyRecordsStatusCmd;
|
||||
@@ -67,16 +64,19 @@ class GetDailyRecordStatusDetailController {
|
||||
ownerName = householdInfo.getHouseholdName();
|
||||
}
|
||||
|
||||
GetDailyRecordStatusDetail recordView =
|
||||
portIn.operate(new GetDailyRecordStatusCmd(reqVO.getRecordMonth(), reqVO.getHouseholdSeq())).orElse(null);
|
||||
GetDailyRecordStatusDetail recordView = portIn.operate(
|
||||
new GetDailyRecordStatusCmd(reqVO.getRecordMonth(), reqVO.getHouseholdSeq())).orElse(null);
|
||||
|
||||
|
||||
// 시트 1: 등록 현황 목록
|
||||
// 시트 : 등록 현황 목록
|
||||
ExcelSheetDto sheet1 = this.getIncomeSheet(recordView, householdNum, ownerName);
|
||||
ExcelSheetDto sheet2 = this.getExpenseSheet(recordView, householdNum, ownerName);
|
||||
ExcelSheetDto sheet2 = this.getWorkSheet(recordView, householdNum, ownerName);
|
||||
ExcelSheetDto sheet3 = this.getExpenseSheet(recordView, householdNum, ownerName);
|
||||
ExcelSheetDto sheet4 = this.getPowerSheet(recordView, householdNum, ownerName);
|
||||
ExcelSheetDto sheet5 = this.getForestrySheet(recordView, householdNum, ownerName);
|
||||
ExcelSheetDto sheet6 = this.getFarmingSheet(recordView, householdNum, ownerName);
|
||||
|
||||
// 시트 모음
|
||||
List<ExcelSheetDto> sheets = List.of(sheet1, sheet2);
|
||||
List<ExcelSheetDto> sheets = List.of(sheet1, sheet2, sheet3, sheet4, sheet5, sheet6);
|
||||
|
||||
byte[] excel = ExcelWriterUtil.writeExcel(sheets);
|
||||
|
||||
@@ -89,6 +89,14 @@ class GetDailyRecordStatusDetailController {
|
||||
.body(excel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 수입 엑셀 시트 생성
|
||||
*
|
||||
* @param recordView 조회 데이터
|
||||
* @param householdNum 임가번호
|
||||
* @param ownerName 경영주 이름
|
||||
* @return 엑셀 시트
|
||||
*/
|
||||
private ExcelSheetDto getIncomeSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
if (recordView != null && !recordView.getIncomes().isEmpty()) {
|
||||
@@ -104,7 +112,7 @@ class GetDailyRecordStatusDetailController {
|
||||
row.add(StringUtils.defaultString(record.getIncomeKind()));
|
||||
row.add(StringUtils.defaultString(record.getIncomeKindMark()));
|
||||
row.add(StringUtils.defaultString(record.getSourcePurpose()));
|
||||
row.add(record.getQuantity() != null ? StringUtils.defaultString(record.getQuantity().toString()) : "");
|
||||
row.add(StringUtils.defaultString(record.getQuantity()));
|
||||
row.add(StringUtils.defaultString(record.getUnitText()));
|
||||
row.add(StringUtils.defaultString(record.getPrice()));
|
||||
row.add(StringUtils.defaultString(record.getEstimatedValue()));
|
||||
@@ -126,6 +134,67 @@ class GetDailyRecordStatusDetailController {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 임업노동 엑셀 시트 생성
|
||||
*
|
||||
* @param recordView 조회 데이터
|
||||
* @param householdNum 임가번호
|
||||
* @param ownerName 경영주 이름
|
||||
* @return 엑셀 시트
|
||||
*/
|
||||
private ExcelSheetDto getWorkSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
if (recordView != null && !recordView.getWorks().isEmpty()) {
|
||||
for (GetDailyWorkRecords record : recordView.getWorks()) {
|
||||
List<String> row = new ArrayList<>(List.of(householdNum, ownerName,
|
||||
record.getStartDay(),
|
||||
record.getEndDay(),
|
||||
StringUtils.defaultString(record.getItemName()),
|
||||
StringUtils.defaultString(record.getItemMark()),
|
||||
StringUtils.defaultString(record.getWorkName()),
|
||||
StringUtils.defaultString(record.getWorkMark())));
|
||||
|
||||
row.add(StringUtils.defaultString(record.getWorkLandArea()));
|
||||
row.add(StringUtils.defaultString(record.getAreaUnitText()));
|
||||
row.add(StringUtils.defaultString(record.getHarvestQuantity()));
|
||||
row.add(StringUtils.defaultString(record.getHarvestUnitText()));
|
||||
row.add(StringUtils.defaultString(record.getOwnerTime()));
|
||||
row.add(StringUtils.defaultString(record.getSpouseTime()));
|
||||
row.add(StringUtils.defaultString(record.getFamilyMHours()));
|
||||
row.add(StringUtils.defaultString(record.getFamilyFHours()));
|
||||
row.add(StringUtils.defaultString(record.getHiredMHours()));
|
||||
row.add(StringUtils.defaultString(record.getHiredFHours()));
|
||||
row.add(StringUtils.defaultString(record.getSharedMHours()));
|
||||
row.add(StringUtils.defaultString(record.getSharedFHours()));
|
||||
row.add(StringUtils.defaultString(record.getVolunteerMHours()));
|
||||
row.add(StringUtils.defaultString(record.getVolunteerFHours()));
|
||||
|
||||
rows.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
return new ExcelSheetDto(
|
||||
"임업노동 투입",
|
||||
List.of("임가번호", "경영주 성명", "날", "짜", "품목명", "품목부호", "작업명", "작업 부호", "작업면적", "단위", "수확량", "단위",
|
||||
"경영주", "배우자", "가족노동-남", "가족노동-여", "고용노동-남", "고용노동-여", "품앗이-남", "품앗이-여", "일손돕기-남", "일손돕기-여"),
|
||||
rows,
|
||||
Set.of(8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21),
|
||||
Map.of(
|
||||
0, IndexedColors.LIGHT_YELLOW,
|
||||
2, IndexedColors.LIGHT_TURQUOISE,
|
||||
3, IndexedColors.LIGHT_TURQUOISE
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 지출 엑셀 시트 생성
|
||||
*
|
||||
* @param recordView 조회 데이터
|
||||
* @param householdNum 임가번호
|
||||
* @param ownerName 경영주 이름
|
||||
* @return 엑셀 시트
|
||||
*/
|
||||
private ExcelSheetDto getExpenseSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
if (recordView != null && !recordView.getExpenses().isEmpty()) {
|
||||
@@ -140,7 +209,7 @@ class GetDailyRecordStatusDetailController {
|
||||
row.add(StringUtils.defaultString(record.getExpenseKind()));
|
||||
row.add(StringUtils.defaultString(record.getExpenseKindMark()));
|
||||
row.add(StringUtils.defaultString(record.getSourcePurpose()));
|
||||
row.add(record.getQuantity() != null ? StringUtils.defaultString(record.getQuantity().toString()) : "");
|
||||
row.add(StringUtils.defaultString(record.getQuantity()));
|
||||
row.add(StringUtils.defaultString(record.getUnitText()));
|
||||
row.add(StringUtils.defaultString(record.getPrice()));
|
||||
row.add(StringUtils.defaultString(record.getEstimatedValue()));
|
||||
@@ -161,4 +230,115 @@ class GetDailyRecordStatusDetailController {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 동력 사용시간 엑셀 시트 생성
|
||||
*
|
||||
* @param recordView 조회 데이터
|
||||
* @param householdNum 임가번호
|
||||
* @param ownerName 경영주 이름
|
||||
* @return 엑셀 시트
|
||||
*/
|
||||
private ExcelSheetDto getPowerSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
if (recordView != null && !recordView.getPowers().isEmpty()) {
|
||||
for (GetDailyPowerRecords record : recordView.getPowers()) {
|
||||
rows.add(List.of(householdNum, ownerName,
|
||||
record.getStartDay(),
|
||||
record.getEndDay(),
|
||||
StringUtils.defaultString(record.getEquipmentName()),
|
||||
StringUtils.defaultString(record.getEquipmentMark()),
|
||||
StringUtils.defaultString(record.getOwnedHours()),
|
||||
StringUtils.defaultString(record.getLeasedHours())));
|
||||
}
|
||||
}
|
||||
|
||||
return new ExcelSheetDto(
|
||||
"동력사용시간",
|
||||
List.of("임가번호", "경영주 성명", "날", "짜", "명칭", "명칭 부호", "자가 사용시간", "임차 사용시간"),
|
||||
rows,
|
||||
Set.of(6, 7),
|
||||
Map.of(
|
||||
0, IndexedColors.LIGHT_YELLOW,
|
||||
2, IndexedColors.LIGHT_TURQUOISE,
|
||||
3, IndexedColors.LIGHT_TURQUOISE
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 임업 자가소비량 엑셀 시트 생성
|
||||
*
|
||||
* @param recordView 조회 데이터
|
||||
* @param householdNum 임가번호
|
||||
* @param ownerName 경영주 이름
|
||||
* @return 엑셀 시트
|
||||
*/
|
||||
private ExcelSheetDto getForestrySheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
if (recordView != null && !recordView.getForestries().isEmpty()) {
|
||||
for (GetDailyForestryRecords record : recordView.getForestries()) {
|
||||
rows.add(List.of(householdNum, ownerName,
|
||||
record.getStartDay(),
|
||||
record.getEndDay(),
|
||||
StringUtils.defaultString(record.getIncomeMark()),
|
||||
StringUtils.defaultString(record.getExpenseMark()),
|
||||
StringUtils.defaultString(record.getProductName()),
|
||||
StringUtils.defaultString(record.getUsage()),
|
||||
StringUtils.defaultString(record.getQuantity()),
|
||||
StringUtils.defaultString(record.getUnitText()),
|
||||
StringUtils.defaultString(record.getEstimatedValue())));
|
||||
}
|
||||
}
|
||||
|
||||
return new ExcelSheetDto(
|
||||
"임업_자가소비량",
|
||||
List.of("임가번호", "경영주 성명", "날", "짜", "수입 부호", "지출 부호", "생산물", "용도", "수량", "단위", "현물(평가액)"),
|
||||
rows,
|
||||
Set.of(8, 10),
|
||||
Map.of(
|
||||
0, IndexedColors.LIGHT_YELLOW,
|
||||
2, IndexedColors.LIGHT_TURQUOISE,
|
||||
3, IndexedColors.LIGHT_TURQUOISE
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 농업 자가소비량 엑셀 시트 생성
|
||||
*
|
||||
* @param recordView 조회 데이터
|
||||
* @param householdNum 임가번호
|
||||
* @param ownerName 경영주 이름
|
||||
* @return 엑셀 시트
|
||||
*/
|
||||
private ExcelSheetDto getFarmingSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
if (recordView != null && !recordView.getFarmings().isEmpty()) {
|
||||
for (GetDailyFarmingRecords record : recordView.getFarmings()) {
|
||||
rows.add(List.of(householdNum, ownerName,
|
||||
record.getStartDay(),
|
||||
record.getEndDay(),
|
||||
StringUtils.defaultString(record.getIncomeMark()),
|
||||
StringUtils.defaultString(record.getExpenseMark()),
|
||||
StringUtils.defaultString(record.getProductName()),
|
||||
StringUtils.defaultString(record.getUsage()),
|
||||
StringUtils.defaultString(record.getQuantity()),
|
||||
StringUtils.defaultString(record.getUnitText()),
|
||||
StringUtils.defaultString(record.getEstimatedValue())));
|
||||
}
|
||||
}
|
||||
|
||||
return new ExcelSheetDto(
|
||||
"농업_자가소비량",
|
||||
List.of("임가번호", "경영주 성명", "날", "짜", "수입 부호", "지출 부호", "생산물", "용도", "수량", "단위", "현물(평가액)"),
|
||||
rows,
|
||||
Set.of(8, 10),
|
||||
Map.of(
|
||||
0, IndexedColors.LIGHT_YELLOW,
|
||||
2, IndexedColors.LIGHT_TURQUOISE,
|
||||
3, IndexedColors.LIGHT_TURQUOISE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,15 +8,17 @@ import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetDailyFarmingRecords {
|
||||
private Long id;
|
||||
private String incomeMark;
|
||||
private String expenseMark;
|
||||
private String productName;
|
||||
private String usage;
|
||||
private BigDecimal quantity;
|
||||
private String quantity;
|
||||
private String unitText;
|
||||
private String estimatedValue;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
}
|
||||
|
||||
@@ -8,16 +8,18 @@ import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetDailyForestryRecords {
|
||||
private Long id;
|
||||
private String incomeMark;
|
||||
private String expenseMark;
|
||||
private String productName;
|
||||
private String usage;
|
||||
private BigDecimal quantity;
|
||||
private String quantity;
|
||||
private String unitCode;
|
||||
private String unitText;
|
||||
private String estimatedValue;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class GetDailyIncomeRecords {
|
||||
private String incomeKind;
|
||||
private String incomeKindMark;
|
||||
private String sourcePurpose;
|
||||
private BigDecimal quantity;
|
||||
private String quantity;
|
||||
private String unitCode;
|
||||
private String unitText;
|
||||
private String price;
|
||||
|
||||
@@ -8,13 +8,14 @@ import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetDailyPowerRecords {
|
||||
private Long id;
|
||||
private String equipmentName;
|
||||
private BigDecimal ownedHours;
|
||||
private BigDecimal leasedHours;
|
||||
private String equipmentMark;
|
||||
private String ownedHours;
|
||||
private String leasedHours;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
}
|
||||
|
||||
@@ -22,4 +22,12 @@ public class GetDailyRecordStatusCmd {
|
||||
private Long recordSeq;
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
|
||||
/**
|
||||
* 월 검색 여부
|
||||
* @return true=월 검색, false=단일 검색
|
||||
*/
|
||||
public boolean isSearchMonth() {
|
||||
return recordMonth != null && householdSeq != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetDailyWorkRecords {
|
||||
private Long id;
|
||||
private String itemName;
|
||||
private String itemMark;
|
||||
private String workName;
|
||||
private String workMark;
|
||||
private String workLandArea;
|
||||
private String areaUnitText;
|
||||
private String harvestQuantity;
|
||||
@@ -29,4 +29,6 @@ public class GetDailyWorkRecords {
|
||||
private String volunteerFHours;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user