diff --git a/admin/src/main/java/app/module/admin/config/application/enums/UsageType.java b/admin/src/main/java/app/module/admin/config/application/enums/UsageType.java new file mode 100644 index 00000000..3c22a604 --- /dev/null +++ b/admin/src/main/java/app/module/admin/config/application/enums/UsageType.java @@ -0,0 +1,12 @@ +package app.module.admin.config.application.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum UsageType { + MOBILE("모바일"), + PAPER("지류"); + private final String desc; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/adapters/web/GetHouseholdsStatusController.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/adapters/web/GetHouseholdsStatusController.java index 495a3195..8ae36b22 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/adapters/web/GetHouseholdsStatusController.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/adapters/web/GetHouseholdsStatusController.java @@ -1,52 +1,163 @@ package app.module.admin.usecase.household.getHouseholdsStatus.adapters.web; +import app.module.admin.config.application.enums.ManagementType; +import app.module.admin.config.application.enums.UsageType; import app.module.admin.config.application.util.AdminUtil; +import app.module.admin.config.application.util.ExcelWriterUtil; +import app.module.admin.config.application.util.model.ExcelSheetDto; +import app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model.GetHouseholdsStatusReqVO; import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortIn; import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus; import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.IndexedColors; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.GetMapping; -import app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model.GetHouseholdsStatusReqVO; -import app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model.GetHouseholdsStatusResVO; +import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor class GetHouseholdsStatusController { - private final GetHouseholdsStatusPortIn portIn; + private final GetHouseholdsStatusPortIn portIn; - @GetMapping(path = "/api/households") - ResponseEntity> operate( - @PageableDefault(size = 10) Pageable pageable, - GetHouseholdsStatusReqVO reqVO) { - return ResponseEntity.status(HttpStatus.OK).body( + @GetMapping(path = "/api/households") + ResponseEntity> operate(@PageableDefault(size = 10) Pageable pageable, + GetHouseholdsStatusReqVO reqVO) { + return ResponseEntity.status(HttpStatus.OK).body( + portIn.operate(pageable, + new GetHouseholdsStatusCmd( + reqVO.getRecordMonth(), + reqVO.getOwnerField(), + reqVO.getOwnerValue(), + reqVO.getRegionMainCode(), + reqVO.getRegionSubCode(), + reqVO.getRegionDetailCode(), + reqVO.getIndustryLargeCode(), + reqVO.getIndustryMiddleCode(), + reqVO.getProgressType() != null ? reqVO.getProgressType().name() : null, + reqVO.getIsFirstVisited(), + reqVO.getIsSecondVisited(), + reqVO.getIsGiftSent(), + reqVO.getResearcherField(), + reqVO.getResearcherValue(), + reqVO.getIsPanel(), + AdminUtil.getLoginUserSeq(), + reqVO.getUserRole(), + reqVO.getUserRegionMainCode(), + Boolean.TRUE))); + } - portIn.operate(pageable, - new GetHouseholdsStatusCmd( - reqVO.getRecordMonth(), - reqVO.getOwnerField(), - reqVO.getOwnerValue(), - reqVO.getRegionMainCode(), - reqVO.getRegionSubCode(), - reqVO.getRegionDetailCode(), - reqVO.getIndustryLargeCode(), - reqVO.getIndustryMiddleCode(), - reqVO.getProgressType() != null ? reqVO.getProgressType().name() : null, - reqVO.getIsFirstVisited(), - reqVO.getIsSecondVisited(), - reqVO.getIsGiftSent(), - reqVO.getResearcherField(), - reqVO.getResearcherValue(), - reqVO.getIsPanel(), - AdminUtil.getLoginUserSeq(), - reqVO.getUserRole(), - reqVO.getUserRegionMainCode() - )) - ); - } + /** + * 임가현황 엑셀 다운로드 + * + * @param reqVO 검색 조건 + * @return 엑셀 파일 다운로드 + */ + @GetMapping(path = "/api/households/excel") + ResponseEntity exportHouseholdsExcel(Pageable pageable, + GetHouseholdsStatusReqVO reqVO) { + + Page households = + portIn.operate(pageable, + new GetHouseholdsStatusCmd( + reqVO.getRecordMonth(), + reqVO.getOwnerField(), + reqVO.getOwnerValue(), + reqVO.getRegionMainCode(), + reqVO.getRegionSubCode(), + reqVO.getRegionDetailCode(), + reqVO.getIndustryLargeCode(), + reqVO.getIndustryMiddleCode(), + reqVO.getProgressType() != null ? reqVO.getProgressType().name() : null, + reqVO.getIsFirstVisited(), + reqVO.getIsSecondVisited(), + reqVO.getIsGiftSent(), + reqVO.getResearcherField(), + reqVO.getResearcherValue(), + reqVO.getIsPanel(), + AdminUtil.getLoginUserSeq(), + reqVO.getUserRole(), + reqVO.getUserRegionMainCode(), + Boolean.FALSE)); // 임가 전체 목록을 가져온다. + + List> rows = new ArrayList<>(); + for(GetHouseholdsStatus item : households.getContent()) { + rows.add(List.of( + item.getHouseholdNum(), + item.getHouseholdName(), + StringUtils.defaultString(item.getOwnerAge().toString()), + StringUtils.defaultString(item.getHouseholdPhone()), + StringUtils.defaultString(item.getRegionMainName()), + StringUtils.defaultString(item.getRegionSubName()), + StringUtils.defaultString(item.getRegionDetailName()), + StringUtils.defaultString(item.getAddress()), + StringUtils.defaultString(item.getIndustryLargeName()), + StringUtils.defaultString(item.getIndustryMiddleName()), + StringUtils.defaultString(item.getIndustrySubMiddle()), + StringUtils.defaultString(item.getIndustryDetail()), + StringUtils.defaultString(item.getProgressPercent().toString()) + "%", + StringUtils.defaultString(item.getFirstVisitDate()), + StringUtils.defaultString(item.getSecondVisitDate()), + item.getIsGiftSent() ? "전달" : "미전달", + StringUtils.defaultString(item.getResearcherName()), + StringUtils.defaultString(item.getResearcherPhone()), + item.getUsageType() != null ? UsageType.valueOf(item.getUsageType()).getDesc() : "", + item.getIsPanel() ? "1. 유지" : "2. 탈락" + )); + } + + // 시트 1: 임가 목록 + ExcelSheetDto sheet1 = new ExcelSheetDto("임가 목록", + List.of( + "임가번호", + "경영주 성명", + "연령", + "연락처", + "실사", + "지역", + "세부지역", + "전체 주소", + "업종_대분류", + "업종_중분류1", + "업종_중분류2", + "규모/세부품목", + "당월 일계부 현황", + "당월 1차 임가방문", + "당월 2차 임가방문", + "답례품 전달", + "조사원", + "조사원 연락처", + "이용 구분", + "유지여부"), + rows, + null, + Map.of(0, IndexedColors.LIGHT_YELLOW)); + + List sheets = List.of(sheet1); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + String rawFileName = "01. 임가 목록[" + reqVO.getRecordMonth() + "]_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java index adade0c7..91e28d52 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java @@ -28,5 +28,10 @@ public class GetHouseholdsStatus { private Boolean isGiftSent; private String researcherName; private String researcherPhone; + private Integer ownerAge; + private String address; + private String industrySubMiddle; + private String industryDetail; + private String usageType; private Integer total; } diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatusCmd.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatusCmd.java index 57f44a56..999fbf6d 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatusCmd.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatusCmd.java @@ -46,4 +46,6 @@ public class GetHouseholdsStatusCmd { private String userRole; // 로그인한 유저 실사 지역 private String userRegionMainCode; + // 페이징처리 여부 + private Boolean isPaging; } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/adapters/web/GetBankAutoTransferRecordsController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/adapters/web/GetBankAutoTransferRecordsController.java index 7742f24e..6c503ebe 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/adapters/web/GetBankAutoTransferRecordsController.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/adapters/web/GetBankAutoTransferRecordsController.java @@ -1,23 +1,128 @@ package app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.adapters.web; +import app.module.admin.config.application.util.ExcelWriterUtil; +import app.module.admin.config.application.util.model.ExcelSheetDto; +import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn; +import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatus; +import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd; +import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.adapters.web.model.GetAutoTransferRecordsReqVO; import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.ports.GetBankAutoTransferRecordsPortIn; +import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferExpenseRecords; +import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferIncomeRecords; import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecords; import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferRecordsCmd; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.GetMapping; -import app.module.admin.usecase.household.tab.bankAutoTransfer.getBankAutoTransferRecords.adapters.web.model.GetAutoTransferRecordsReqVO; +import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor class GetBankAutoTransferRecordsController { private final GetBankAutoTransferRecordsPortIn portIn; + private final GetHouseholdStatusPortIn getHouseholdStatusPortIn; @GetMapping(path = "/api/household/bankAutoTransfer") ResponseEntity operate(GetAutoTransferRecordsReqVO reqVO) { return ResponseEntity.status(HttpStatus.OK).body(portIn.operate( new GetBankAutoTransferRecordsCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth()))); } + + /** + * 은행자동이체내역 엑셀 다운로드 + * + * @param reqVO 검색 조건 + * @return 엑셀 파일 다운로드 + */ + @GetMapping("/api/household/bankAutoTransfer/excel") + public ResponseEntity exportBankExcel(GetAutoTransferRecordsReqVO reqVO) { + + String householdNum = "-"; + String ownerName = "-"; + GetHouseholdStatus householdInfo = getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(reqVO.getHouseholdSeq())).orElse(null); + if (householdInfo != null) { + householdNum = householdInfo.getHouseholdNum(); + ownerName = householdInfo.getHouseholdName(); + } + + GetBankAutoTransferRecords bankRecords = + portIn.operate(new GetBankAutoTransferRecordsCmd( + reqVO.getHouseholdSeq(), reqVO.getRecordMonth())); + + List> rowsIncome = new ArrayList<>(); + for(GetBankAutoTransferIncomeRecords record : bankRecords.getIncomes()) { + rowsIncome.add(List.of( + householdNum, // 임가번호 + ownerName, // 경영주 성명 + StringUtils.defaultString(record.getCategory()), // 유형 + StringUtils.defaultString(record.getIncomeCode()), // 수입 부호 + StringUtils.defaultString(record.getExpenseCode()), // 지출 부호 + StringUtils.defaultString(record.getCropValue()), // 재배형태 코드 + StringUtils.defaultString(record.getCategoryText()), // 수입의 종류 + StringUtils.defaultString(record.getTarget()), // 대상 + StringUtils.defaultString(record.getSourcePurpose()), // 수입원 + StringUtils.defaultString(record.getCount()), // 수량 + StringUtils.defaultString(record.getUnitText()), // 단위 + StringUtils.defaultString(record.getPrice().toString()))); // 현금(원) + } + + // 시트 1: 수입 목록 + ExcelSheetDto sheet1 = new ExcelSheetDto( + "수입", + List.of("임가번호", "경영주 성명", "유형", "수입 부호", "지출 부호", "재배형태 코드", "수입의 종류", "대상", "수입원", "수량", "단위", "현금(원)"), + rowsIncome, + Collections.singleton(11), + Map.of(0, IndexedColors.LIGHT_YELLOW) + ); + + List> rowsExpense = new ArrayList<>(); + for(GetBankAutoTransferExpenseRecords record : bankRecords.getExpenses()) { + rowsExpense.add(List.of( + householdNum, // 임가번호 + ownerName, // 경영주 성명 + StringUtils.defaultString(record.getCategory()), // 유형 + StringUtils.defaultString(record.getIncomeCode()), // 수입 부호 + StringUtils.defaultString(record.getExpenseCode()), // 지출 부호 + StringUtils.defaultString(record.getCategoryText()), // 지출의 종류 + StringUtils.defaultString(record.getSourcePurpose()), // 용도 + StringUtils.defaultString(record.getCount()), // 수량 + StringUtils.defaultString(record.getUnitText()), // 단위 + StringUtils.defaultString(record.getPrice().toString()))); // 현금(원) + } + + // 시트 2: 지출 목록 + ExcelSheetDto sheet2 = new ExcelSheetDto( + "지출", + List.of("임가번호", "경영주 성명", "유형", "수입 부호", "지출 부호", "지출의 종류", "용도", "수량", "단위", "현금(원)"), + rowsExpense, + Collections.singleton(9), + Map.of(0, IndexedColors.LIGHT_YELLOW) + ); + + // 시트 모음 + List sheets = List.of(sheet1, sheet2); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + String rawFileName = "04. 은행 자동이체 내역[" + reqVO.getRecordMonth() + "][" + householdNum + "]_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferExpenseRecords.java b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferExpenseRecords.java index 72db805a..e3409eb2 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferExpenseRecords.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferExpenseRecords.java @@ -11,6 +11,9 @@ import lombok.Setter; @EqualsAndHashCode public class GetBankAutoTransferExpenseRecords { private Long id; + private String category; + private String incomeCode; + private String expenseCode; private String categoryText; private String sourcePurpose; private String count; diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferIncomeRecords.java b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferIncomeRecords.java index 8802f84d..18a49f25 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferIncomeRecords.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/getBankAutoTransferRecords/ports/application/domain/GetBankAutoTransferIncomeRecords.java @@ -18,4 +18,8 @@ public class GetBankAutoTransferIncomeRecords { private String count; private String unitText; private Integer price; + private String category; + private String incomeCode; + private String expenseCode; + private String cropValue; } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/web/GetForestProductsStatusController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/web/GetForestProductsStatusController.java index d09b5293..880cd82d 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/web/GetForestProductsStatusController.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/web/GetForestProductsStatusController.java @@ -1,25 +1,124 @@ package app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.adapters.web; +import app.module.admin.config.application.util.ExcelWriterUtil; +import app.module.admin.config.application.util.model.ExcelSheetDto; +import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn; +import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatus; +import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd; +import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.adapters.web.model.GetForestProductsStatusReqVO; import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.GetForestProductsStatusPortIn; +import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatus; import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd; import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatusResult; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.GetMapping; -import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.adapters.web.model.GetForestProductsStatusReqVO; +import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor class GetForestProductsStatusController { - private final GetForestProductsStatusPortIn portIn; - @GetMapping(path = "/api/household/forestProducts") - ResponseEntity operate( - GetForestProductsStatusReqVO reqVO) { - return ResponseEntity.status(HttpStatus.OK) - .body(portIn.operate( + private final GetForestProductsStatusPortIn portIn; + private final GetHouseholdStatusPortIn getHouseholdStatusPortIn; + + @GetMapping(path = "/api/household/forestProducts") + ResponseEntity operate(GetForestProductsStatusReqVO reqVO) { + return ResponseEntity.status(HttpStatus.OK).body(portIn.operate( new GetForestProductsStatusCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth()))); - } + } + + /** + * 임산물현황 엑셀 다운로드 + * + * @param reqVO 검색 조건 + * @return 엑셀 파일 다운로드 + */ + @GetMapping("/api/household/forestProduct/excel") + public ResponseEntity exportForestExcel(GetForestProductsStatusReqVO reqVO) { + + String householdNum = "-"; + String ownerName = "-"; + GetHouseholdStatus householdInfo = getHouseholdStatusPortIn + .operate(new GetHouseholdStatusCmd(reqVO.getHouseholdSeq())).orElse(null); + if (householdInfo != null) { + householdNum = householdInfo.getHouseholdNum(); + ownerName = householdInfo.getHouseholdName(); + } + + GetForestProductsStatusResult forestRecords = + portIn.operate( + new GetForestProductsStatusCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth())); + + List> rows = new ArrayList<>(); + for (GetForestProductsStatus record : forestRecords.getForestProducts()) { + rows.add(List.of( + householdNum, + ownerName, + StringUtils.defaultString(record.getStreetNum()), + StringUtils.defaultString(record.getLandType()), + StringUtils.defaultString(record.getTown()), + StringUtils.defaultString(record.getAvailableArea()), + StringUtils.defaultString(record.getCropName()), + StringUtils.defaultString(record.getCropeCode()), + StringUtils.defaultString(record.getLandArea()), + StringUtils.defaultString(record.getMainYield()), + StringUtils.defaultString(record.getMainYieldUnitText()), + StringUtils.defaultString(record.getMainSaleAmount()), + StringUtils.defaultString(record.getMainSaleAmountUnitText()), + StringUtils.defaultString(record.getSubYield()), + StringUtils.defaultString(record.getSubYieldUnitText()), + StringUtils.defaultString(record.getSubSaleAmount()), + StringUtils.defaultString(record.getSubSaleAmountUnitText()) + )); + } + + // 시트 1: 임산물 현황 목록 + ExcelSheetDto sheet1 = new ExcelSheetDto("임산물 현황", + List.of( + "임가번호", + "경영주 성명", + "지번", + "지목", + "읍면동", + "가능면적(평)", + "재배 작물명", + "작물 부호", + "면적", + "주생산물 수확량", + "단위", + "주생산물 판매량", + "단위", + "부생산물 수확량", + "단위", + "부생산물 판매량", + "단위"), + rows, + null, + Map.of(0, IndexedColors.LIGHT_YELLOW)); + + List sheets = List.of(sheet1); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + String rawFileName = "05. 임산물 현황[" + reqVO.getRecordMonth() + "][" + householdNum + "]_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatus.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatus.java index 07d7c35e..a254c048 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatus.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatus.java @@ -16,6 +16,7 @@ public class GetForestProductsStatus { private String town; private String availableArea; private String cropName; + private String cropeCode; private String landArea; private String mainYield; private String mainYieldUnitText; diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/getHouseholdVisitInfos/adapters/web/GetHouseholdVisitInfosController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/getHouseholdVisitInfos/adapters/web/GetHouseholdVisitInfosController.java index 958a7df0..17494f8e 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/getHouseholdVisitInfos/adapters/web/GetHouseholdVisitInfosController.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/getHouseholdVisitInfos/adapters/web/GetHouseholdVisitInfosController.java @@ -1,25 +1,109 @@ package app.module.admin.usecase.household.tab.householdVisit.getHouseholdVisitInfos.adapters.web; +import app.module.admin.config.application.enums.ManagementType; +import app.module.admin.config.application.util.ExcelWriterUtil; +import app.module.admin.config.application.util.model.ExcelSheetDto; +import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn; +import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatus; +import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd; +import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.adapters.web.model.GetForestProductsStatusReqVO; +import app.module.admin.usecase.household.tab.householdVisit.getHouseholdVisitInfos.adapters.web.model.GetHouseholdVisitInfosReqVO; import app.module.admin.usecase.household.tab.householdVisit.getHouseholdVisitInfos.ports.GetHouseholdVisitInfosPortIn; import app.module.admin.usecase.household.tab.householdVisit.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfos; import app.module.admin.usecase.household.tab.householdVisit.getHouseholdVisitInfos.ports.application.domain.GetHouseholdVisitInfosCmd; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Optional; import lombok.RequiredArgsConstructor; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.GetMapping; -import app.module.admin.usecase.household.tab.householdVisit.getHouseholdVisitInfos.adapters.web.model.GetHouseholdVisitInfosReqVO; +import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor class GetHouseholdVisitInfosController { - private final GetHouseholdVisitInfosPortIn portIn; - @GetMapping(path = "/api/household/visitInfos") - ResponseEntity> operate( - GetHouseholdVisitInfosReqVO reqVO) { - return ResponseEntity.status(HttpStatus.OK).body(portIn.operate( - new GetHouseholdVisitInfosCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth()))); - } + private final GetHouseholdVisitInfosPortIn portIn; + private final GetHouseholdStatusPortIn getHouseholdStatusPortIn; + + @GetMapping(path = "/api/household/visitInfos") + ResponseEntity> operate(GetHouseholdVisitInfosReqVO reqVO) { + return ResponseEntity.status(HttpStatus.OK).body(portIn.operate( + new GetHouseholdVisitInfosCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth()))); + } + + /** + * 임가방문정보 엑셀 다운로드 + * + * @param reqVO 검색 조건 + * @return 엑셀 파일 다운로드 + */ + @GetMapping("/api/household/visitInfos/excel") + public ResponseEntity exportVisitExcel(GetForestProductsStatusReqVO reqVO) { + + String householdNum = "-"; + String ownerName = "-"; + GetHouseholdStatus householdInfo = getHouseholdStatusPortIn + .operate(new GetHouseholdStatusCmd(reqVO.getHouseholdSeq())).orElse(null); + if (householdInfo != null) { + householdNum = householdInfo.getHouseholdNum(); + ownerName = householdInfo.getHouseholdName(); + } + + List visitInfos = portIn.operate( + new GetHouseholdVisitInfosCmd(reqVO.getHouseholdSeq(), reqVO.getRecordMonth())); + + List> rows = new ArrayList<>(); + for (GetHouseholdVisitInfos record : visitInfos) { + rows.add(List.of( + householdNum, + ownerName, + record.getVisitDate(), + Optional.ofNullable(ManagementType.from(record.getManagementType())) + .map(ManagementType::getDesc).orElse(""), + record.getContent(), + record.getUpdatedBy() + " (" + record.getUpdatedAt() + ")", + record.getIsGiftSent() ? "전달 완료" : "-" + )); + } + + // 시트 1: 임가방문정보 목록 + ExcelSheetDto sheet1 = new ExcelSheetDto("임가방문정보", + List.of( + "임가번호", + "경영주 성명", + "방문일", + "관리분야", + "내용", + "최종 작성자", + "답례품 전달"), + rows, + Collections.singleton(11), + Map.of( + 0, IndexedColors.LIGHT_YELLOW, + 2, IndexedColors.LIGHT_TURQUOISE + )); + + List sheets = List.of(sheet1); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + String rawFileName = "06. 임가방문정보[" + reqVO.getRecordMonth() + "][" + householdNum + "]_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersHouseholdVisitDto.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersHouseholdVisitDto.java index cf12ec9b..56c5085b 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersHouseholdVisitDto.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersHouseholdVisitDto.java @@ -15,5 +15,6 @@ public class ResearchersHouseholdVisitDto { private ManagementType managementType; private String content; private String isGiftSentFlag; - private LocalDateTime createdAt; + private String updatedAt; + private String updatedBy; } diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersMappingHouseholdDto.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersMappingHouseholdDto.java index 76b4c09c..7aa7c779 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersMappingHouseholdDto.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/model/ResearchersMappingHouseholdDto.java @@ -14,4 +14,11 @@ public class ResearchersMappingHouseholdDto { private String industryLargeCodeName; private String industryMiddleCodeName; private String panelFlag; + private Integer ownerAge; + private String address; + private String industrySubMiddle; + private String industryDetail; + private String usageType; + private String researcherName; + private String researcherPhone; } diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/ResearcherApiController.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/ResearcherApiController.java index c62fedb7..1fb8da3d 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/ResearcherApiController.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/ResearcherApiController.java @@ -1,11 +1,29 @@ package app.module.admin.usecase.researcher.adpaters.web; +import app.module.admin.config.application.enums.UsageType; import app.module.admin.config.application.util.AdminUtil; +import app.module.admin.config.application.util.ExcelWriterUtil; +import app.module.admin.config.application.util.model.ExcelSheetDto; +import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto; +import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto; +import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto; import app.module.admin.usecase.researcher.adpaters.web.model.*; import app.module.admin.usecase.researcher.ports.ResearcherPortIn; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Map; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.springframework.data.domain.Page; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -65,4 +83,160 @@ class ResearcherApiController { return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.updateMappingHousehold(reqVO)); } + @GetMapping(path = "/list/excel") + ResponseEntity exportResearchersExcel(@ModelAttribute("reqVO") ResearchersListReqVO reqVO) { + + Page researchers = researcherPortIn.list(reqVO); + + List> rows = new ArrayList<>(); + for(ResearchersDto item : researchers.getContent()) { + rows.add(List.of( + StringUtils.defaultString(item.getId()), + StringUtils.defaultString(item.getName()), + StringUtils.defaultString(item.getPhone()), + StringUtils.defaultString(item.getRegionMainCodeName()), + StringUtils.defaultString(item.getAccountDisabledFlag()) + )); + } + + // 시트 1: 조사원 목록 + ExcelSheetDto sheet1 = new ExcelSheetDto( + "조사원 목록", + List.of("아이디", "이름", "전화번호", "실사", "사용여부"), + rows, + null, + Map.of(0, IndexedColors.LIGHT_YELLOW) + ); + + // 시트 모음 + List sheets = List.of(sheet1); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + String rawFileName = "07. 조사원 목록" + "_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } + + @GetMapping(path = "/mappingHouseholdList/excel") + ResponseEntity exportMappingHouseholdsExcel(@ModelAttribute ResearchersDetailReqVO reqVO) { + + Page mappingHouseholds = + researcherPortIn.mappingHouseholdList(reqVO); + + List> rows = new ArrayList<>(); + for(ResearchersMappingHouseholdDto item : mappingHouseholds.getContent()) { + rows.add(List.of( + StringUtils.defaultString(item.getHouseholdNum()), + StringUtils.defaultString(item.getOwnerName()), + StringUtils.defaultString(item.getOwnerAge().toString()), + StringUtils.defaultString(item.getPhone()), + StringUtils.defaultString(item.getRegionMainCodeName()), + StringUtils.defaultString(item.getRegionSubCodeName()), + StringUtils.defaultString(item.getRegionDetailCodeName()), + StringUtils.defaultString(item.getAddress()), + StringUtils.defaultString(item.getIndustryLargeCodeName()), + StringUtils.defaultString(item.getIndustryMiddleCodeName()), + StringUtils.defaultString(item.getIndustrySubMiddle()), + StringUtils.defaultString(item.getIndustryDetail()), + StringUtils.defaultString(item.getResearcherName()), + StringUtils.defaultString(item.getResearcherPhone()), + item.getUsageType() != null ? UsageType.valueOf(item.getUsageType()).getDesc() : "", + StringUtils.defaultString(item.getPanelFlag()) + )); + } + + // 시트 1: 임가 목록 + ExcelSheetDto sheet1 = new ExcelSheetDto( + "임가 목록", + List.of( + "임가번호", + "경영주 성명", + "연령", + "연락처", + "실사", + "지역", + "세부지역", + "전체 주소", + "업종_대분류", + "업종_중분류1", + "업종_중분류2", + "규모/세부품목", + "조사원", + "조사원 연락처", + "이용 구분", + "유지여부"), + rows, + null, + Map.of(0, IndexedColors.LIGHT_YELLOW) + ); + + // 시트 모음 + List sheets = List.of(sheet1); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + String rawFileName = "08. 담당 임가 목록" + "_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } + + @GetMapping(path = "/visitHousehold/list/excel") + ResponseEntity exportVisitHouseholdExcel(@ModelAttribute ResearchersDetailReqVO reqVO) { + + List visitInfos = researcherPortIn.visitHouseholdList(reqVO); + + List> rows = new ArrayList<>(); + for(ResearchersHouseholdVisitDto item : visitInfos) { + rows.add(List.of( + StringUtils.defaultString(item.getHouseholdNum()), + StringUtils.defaultString(item.getOwnerName()), + StringUtils.defaultString(item.getVisitDate()), + item.getManagementType() != null ? item.getManagementType().getDesc() : "", + StringUtils.defaultString(item.getContent()), + item.getUpdatedBy() + " (" + item.getUpdatedAt() + ")", + StringUtils.defaultString(item.getIsGiftSentFlag()) + )); + } + + // 시트 1: 임가방문정보 + ExcelSheetDto sheet1 = new ExcelSheetDto( + "임가방문정보", + List.of( + "임가번호", + "경영주 성명", + "방문일", + "관리분야", + "내용", + "최종 작성자", + "답례품 전달"), + rows, + null, + Map.of( + 0, IndexedColors.LIGHT_YELLOW, + 2, IndexedColors.LIGHT_TURQUOISE + )); + + // 시트 모음 + List sheets = List.of(sheet1); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + String rawFileName = "06. 임가방문정보" + "_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } + } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersDetailReqVO.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersDetailReqVO.java index f5337e74..a83d08b9 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersDetailReqVO.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersDetailReqVO.java @@ -10,6 +10,7 @@ public class ResearchersDetailReqVO { private Integer size; private Integer seq; private String searchMonth; + private Boolean isPaging; public Integer getPage() { // 요청 페이지 넘버 - 초기값 `0` diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersListReqVO.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersListReqVO.java index 35e0850b..fe11fba4 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersListReqVO.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersListReqVO.java @@ -17,6 +17,7 @@ public class ResearchersListReqVO { private String searchValue; private String searchArea; private String searchAccountDisabled; + private Boolean isPaging; public Integer getPage() { // 요청 페이지 넘버 - 초기값 `0` diff --git a/admin/src/main/resources/mappers/household/GetBankAutoTransferRecordsMapper.xml b/admin/src/main/resources/mappers/household/GetBankAutoTransferRecordsMapper.xml index 25f738ca..d1c16bd7 100644 --- a/admin/src/main/resources/mappers/household/GetBankAutoTransferRecordsMapper.xml +++ b/admin/src/main/resources/mappers/household/GetBankAutoTransferRecordsMapper.xml @@ -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 diff --git a/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml b/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml index 6af17c80..89ee559a 100644 --- a/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml +++ b/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml @@ -23,6 +23,7 @@ df.town, /* 읍면동 */ df.available_area, /* 가능면적 */ df.crop_name, /* 재배작물명 */ + df.crop_code, /* 작물부호 */ df.land_area, /* 면적 */ df.main_yield, /* 주생산물 수확량 */ CASE diff --git a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml index 270c1f79..45390b05 100644 --- a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml +++ b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml @@ -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 @@ ORDER BY hvr.householdNum ASC - OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY + + + OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY + \ No newline at end of file diff --git a/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml b/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml index 31036719..2df460ba 100644 --- a/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml +++ b/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml @@ -35,7 +35,10 @@ and a.account_disabled = #{searchAccountDisabled} group by a.seq - LIMIT #{size} OFFSET #{page}*#{size} + + + LIMIT #{size} OFFSET #{page}*#{size} +