diff --git a/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownController.java b/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownController.java index 531a83fd..4b86b008 100644 --- a/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownController.java +++ b/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownController.java @@ -1,14 +1,25 @@ package com.interplug.qcast.biz.excelDown; -import com.interplug.qcast.biz.excelDown.dto.*; +import java.util.List; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; +import com.interplug.qcast.biz.excelDown.dto.NtrCtsCmpRequest; +import com.interplug.qcast.biz.excelDown.dto.NtrCtsCmpResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotItemResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotPlanResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotRequest; +import com.interplug.qcast.biz.excelDown.dto.QuotResponse; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplRequest; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.*; - -import java.util.List; @Slf4j @RestController @@ -16,36 +27,47 @@ import java.util.List; @RequiredArgsConstructor @Tag(name = "ExcelDownController", description = "과거데이터 엑셀다운로드 API") public class ExcelDownController { - private final ExcelDownService excelDownService; + private final ExcelDownService excelDownService; - @Operation(description = "과거데이터_견적 엑셀다운로드 조회") - @PostMapping("/quot-excl-down-data") - @ResponseStatus(HttpStatus.OK) - public QuotResponse quotExclDownData(@RequestBody QuotRequest quotRequest) throws Exception { + @Operation(description = "과거데이터_견적 엑셀다운로드 조회") + @PostMapping("/quot-excl-down-data") + @ResponseStatus(HttpStatus.OK) + public QuotResponse quotExclDownData(@RequestBody QuotRequest quotRequest) throws Exception { - List quotPlanExclDownData = excelDownService.selectQuotPlanExclDownData(quotRequest); - List quotItemExclDownData = excelDownService.selectQuotItemExclDownData(quotRequest); + List quotPlanExclDownData = + excelDownService.selectQuotPlanExclDownData(quotRequest); + List quotItemExclDownData = + excelDownService.selectQuotItemExclDownData(quotRequest); - QuotResponse quotRes = new QuotResponse(); - quotRes.setQuotPlanList(quotPlanExclDownData); - quotRes.setQuotItemList(quotItemExclDownData); + QuotResponse quotRes = new QuotResponse(); + quotRes.setQuotPlanList(quotPlanExclDownData); + quotRes.setQuotItemList(quotItemExclDownData); - return quotRes; - } + return quotRes; + } - @Operation(description = "과거데이터_자연재해보상입력 엑셀다운로드 조회") - @PostMapping("/ntr-cts-cmp-excl-down-data") - @ResponseStatus(HttpStatus.OK) - public List ntrCtsCmpExclDownData(@RequestBody NtrCtsCmpRequest ntrCtsCmpRequest) throws Exception { - return excelDownService.selectNtrCtsCmpExclDownData(ntrCtsCmpRequest); - } + @Operation(description = "과거데이터_자연재해보상입력 엑셀다운로드 조회") + @PostMapping("/ntr-cts-cmp-excl-down-data") + @ResponseStatus(HttpStatus.OK) + public List ntrCtsCmpExclDownData( + @RequestBody NtrCtsCmpRequest ntrCtsCmpRequest) throws Exception { + return excelDownService.selectNtrCtsCmpExclDownData(ntrCtsCmpRequest); + } - @Operation(description = "과거데이터_보증서발행완료 물건 엑셀다운로드 조회") - @PostMapping("/wrnt-isnc-cmpl-excl-down-data") - @ResponseStatus(HttpStatus.OK) - public List warrantyIssuedCmpExclDownData(@RequestBody WrntIsncCmplRequest wrntIsncCmplRequest) throws Exception { - return excelDownService.selectWarrantyIssuedCmpExclDownData(wrntIsncCmplRequest); - } + @Operation(description = "과거데이터_보증서발행완료 물건 엑셀다운로드 조회") + @PostMapping("/wrnt-isnc-cmpl-excl-down-data") + @ResponseStatus(HttpStatus.OK) + public List warrantyIssuedCmpExclDownData( + @RequestBody WrntIsncCmplRequest wrntIsncCmplRequest) throws Exception { + return excelDownService.selectWarrantyIssuedCmpExclDownData(wrntIsncCmplRequest); + } + @Operation(description = "과거데이터_보증서발행완료 물건 파일 다운로드 조회") + @PostMapping("/wrnt-isnc-cmpl-file-down") + @ResponseStatus(HttpStatus.OK) + public void warrantyIssuedCmpFileDown(@RequestBody WrntIsncCmplRequest wrntIsncCmplRequest, + HttpServletResponse response) throws Exception { + excelDownService.selectWarrantyIssuedCmpFileData(wrntIsncCmplRequest, response); + } } diff --git a/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownMapper.java b/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownMapper.java index 094ac172..580272a4 100644 --- a/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownMapper.java +++ b/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownMapper.java @@ -1,17 +1,28 @@ package com.interplug.qcast.biz.excelDown; -import com.interplug.qcast.biz.excelDown.dto.*; -import org.apache.ibatis.annotations.Mapper; - import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import com.interplug.qcast.biz.excelDown.dto.NtrCtsCmpRequest; +import com.interplug.qcast.biz.excelDown.dto.NtrCtsCmpResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotItemResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotPlanResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotRequest; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplFileResponse; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplRequest; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplResponse; @Mapper interface ExcelDownMapper { - List selectQuotPlanExclDownData(QuotRequest quotRequest) throws Exception; + List selectQuotPlanExclDownData(QuotRequest quotRequest) throws Exception; - List selectQuotItemExclDownData(QuotRequest quotRequest) throws Exception; + List selectQuotItemExclDownData(QuotRequest quotRequest) throws Exception; - List selectNtrCtsCmpExclDownData(NtrCtsCmpRequest ntrCtsCmpRequest) throws Exception; + List selectNtrCtsCmpExclDownData(NtrCtsCmpRequest ntrCtsCmpRequest) + throws Exception; - List selectWarrantyIssuedCmpExclDownData(WrntIsncCmplRequest wrntIsncCmplRequest) throws Exception; + List selectWarrantyIssuedCmpExclDownData( + WrntIsncCmplRequest wrntIsncCmplRequest) throws Exception; + + List selectWarrantyIssuedCmpFileData( + WrntIsncCmplRequest wrntIsncCmplRequest) throws Exception; } diff --git a/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownService.java b/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownService.java index 939cd6b8..f2e2e7fc 100644 --- a/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownService.java +++ b/src/main/java/com/interplug/qcast/biz/excelDown/ExcelDownService.java @@ -1,31 +1,81 @@ package com.interplug.qcast.biz.excelDown; -import com.interplug.qcast.biz.excelDown.dto.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import com.interplug.qcast.biz.excelDown.dto.NtrCtsCmpRequest; +import com.interplug.qcast.biz.excelDown.dto.NtrCtsCmpResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotItemResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotPlanResponse; +import com.interplug.qcast.biz.excelDown.dto.QuotRequest; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplFileResponse; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplRequest; +import com.interplug.qcast.biz.excelDown.dto.WrntIsncCmplResponse; +import com.interplug.qcast.config.Exception.BaseException; +import com.interplug.qcast.config.message.Messages; +import com.interplug.qcast.util.ZipFileManager; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; @Slf4j @Service @RequiredArgsConstructor public class ExcelDownService { - private final ExcelDownMapper excelDownMapper; + private final ExcelDownMapper excelDownMapper; - public List selectQuotPlanExclDownData(QuotRequest quotRequest) throws Exception { - return excelDownMapper.selectQuotPlanExclDownData(quotRequest); - } + private final ZipFileManager zipFileManager; - public List selectQuotItemExclDownData(QuotRequest quotRequest) throws Exception { - return excelDownMapper.selectQuotItemExclDownData(quotRequest); - } + @Autowired + Messages message; - public List selectNtrCtsCmpExclDownData(NtrCtsCmpRequest ntrCtsCmpRequest) throws Exception { - return excelDownMapper.selectNtrCtsCmpExclDownData(ntrCtsCmpRequest); - } + @Value("${file.ini.root.path}") + private String baseDirPath; - public List selectWarrantyIssuedCmpExclDownData(WrntIsncCmplRequest wrntIsncCmplRequest) throws Exception { - return excelDownMapper.selectWarrantyIssuedCmpExclDownData(wrntIsncCmplRequest); + public List selectQuotPlanExclDownData(QuotRequest quotRequest) + throws Exception { + return excelDownMapper.selectQuotPlanExclDownData(quotRequest); + } + + public List selectQuotItemExclDownData(QuotRequest quotRequest) + throws Exception { + return excelDownMapper.selectQuotItemExclDownData(quotRequest); + } + + public List selectNtrCtsCmpExclDownData(NtrCtsCmpRequest ntrCtsCmpRequest) + throws Exception { + return excelDownMapper.selectNtrCtsCmpExclDownData(ntrCtsCmpRequest); + } + + public List selectWarrantyIssuedCmpExclDownData( + WrntIsncCmplRequest wrntIsncCmplRequest) throws Exception { + return excelDownMapper.selectWarrantyIssuedCmpExclDownData(wrntIsncCmplRequest); + } + + public void selectWarrantyIssuedCmpFileData(WrntIsncCmplRequest wrntIsncCmplRequest, + HttpServletResponse response) throws Exception { + List listData = + excelDownMapper.selectWarrantyIssuedCmpFileData(wrntIsncCmplRequest); + + if (listData != null && listData.size() > 0) { + // 파일 목록 설정 + List> listFile = new ArrayList>(); + Map mapFile = null; + + for (WrntIsncCmplFileResponse res : listData) { + mapFile = new HashMap(); + mapFile.put("directory", res.getObjectNo()); + mapFile.put("filename", baseDirPath + "\\" + res.getObjectNo() + "\\" + res.getFaileName()); + listFile.add(mapFile); + } + + zipFileManager.createZipFile(response, "Warranty-issued-completed-files", listFile); + } else { + throw new BaseException(message.getMessage("common.message.no.dataDown")); } + } } diff --git a/src/main/java/com/interplug/qcast/biz/excelDown/dto/WrntIsncCmplFileResponse.java b/src/main/java/com/interplug/qcast/biz/excelDown/dto/WrntIsncCmplFileResponse.java new file mode 100644 index 00000000..ef1f06bb --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/excelDown/dto/WrntIsncCmplFileResponse.java @@ -0,0 +1,18 @@ +package com.interplug.qcast.biz.excelDown.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class WrntIsncCmplFileResponse { + @Schema(description = "부동산 관리 번호") + private String objectNo; + @Schema(description = "계획") + private String planNo; + @Schema(description = "번호") + private String no; + @Schema(description = "파일명") + private String faileName; +} diff --git a/src/main/java/com/interplug/qcast/biz/excelDown/dto/WrntIsncCmplRequest.java b/src/main/java/com/interplug/qcast/biz/excelDown/dto/WrntIsncCmplRequest.java index 276b869e..0fa2cffd 100644 --- a/src/main/java/com/interplug/qcast/biz/excelDown/dto/WrntIsncCmplRequest.java +++ b/src/main/java/com/interplug/qcast/biz/excelDown/dto/WrntIsncCmplRequest.java @@ -21,4 +21,6 @@ public class WrntIsncCmplRequest { private String sch_objectNm; @Schema(description = "판매대리점Id") private String sch_saleStoreId; + @Schema(description = "보증서번호") + private String sch_warrantyNo; } \ No newline at end of file diff --git a/src/main/java/com/interplug/qcast/util/ZipFileManager.java b/src/main/java/com/interplug/qcast/util/ZipFileManager.java index 9cbce912..785b86c8 100644 --- a/src/main/java/com/interplug/qcast/util/ZipFileManager.java +++ b/src/main/java/com/interplug/qcast/util/ZipFileManager.java @@ -5,9 +5,12 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Path; import java.util.List; +import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.interplug.qcast.config.message.Messages; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -17,22 +20,26 @@ import lombok.extern.slf4j.Slf4j; @RequiredArgsConstructor public class ZipFileManager { + @Autowired + Messages message; + /** * zip file을 생성하여 ZipOutputStream를 반환하는 method * * @param response HttpServletResponse * @param strCreateFileName 생성할 file 이름 - * @param listFilePath 파일 경로 목록 + * @param listFilePath 파일 정보 목록 */ public void createZipFile(HttpServletResponse response, String strCreateFileName, - List listFilePath) throws Exception { + List> listFile) throws Exception { // 압축될 파일명이 존재하지 않을 경우 if (strCreateFileName == null || "".equals(strCreateFileName)) - throw new IllegalArgumentException("파일명이 존재하지 않습니다."); + throw new IllegalArgumentException( + message.getMessage("common.message.data.no.exists", "file name")); // 파일이 존재하지 않을 경우 - if (listFilePath == null || listFilePath.size() == 0) - throw new IllegalArgumentException("파일이 존재하지 않습니다."); + if (listFile == null || listFile.size() == 0) + throw new IllegalArgumentException(message.getMessage("common.message.no.dataDown")); // zip 파일명 String strZipName = strCreateFileName + ".zip"; @@ -43,12 +50,14 @@ public class ZipFileManager { response.setStatus(HttpServletResponse.SC_OK); try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) { - for (String strSourceFile : listFilePath) { + for (Map mapFile : listFile) { + String strDirectory = mapFile.get("directory"); + String strSourceFile = mapFile.get("filename"); Path path = Path.of(strSourceFile); try (FileInputStream fis = new FileInputStream(path.toFile())) { // 압축될 파일명을 ZipEntry에 담아준다 - ZipEntry zipEntry = new ZipEntry(path.getFileName().toString()); + ZipEntry zipEntry = new ZipEntry(strDirectory + "\\" + path.getFileName().toString()); // 압축될 파일명을 ZipOutputStream 에 담아준다 zos.putNextEntry(zipEntry); @@ -59,12 +68,14 @@ public class ZipFileManager { zos.write(buffer, 0, length); } } catch (FileNotFoundException e) { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - throw new IllegalArgumentException("파일 변환 작업중, [ " + strZipName + " ] 파일을 찾을 수 없습니다."); + // response.setStatus(HttpServletResponse.SC_NOT_FOUND); + // throw new IllegalArgumentException("파일 변환 작업중, [ " + strSourceFile + " ] 파일을 찾을 수 + // 없습니다."); + log.debug("파일 변환 작업중, [ " + strSourceFile + " ] 파일을 찾을 수 없습니다."); } catch (IOException e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); throw new IllegalArgumentException( - "파일 변환 작업중, [ " + strZipName + " ] 파일을 다운로드 할 수 없습니다."); + "파일 변환 작업중, [ " + strSourceFile + " ] 파일을 다운로드 할 수 없습니다."); } finally { // ZipOutputStream 에 담아둔 압축될 파일명을 flush 시켜준다 zos.flush(); diff --git a/src/main/resources/mappers/excelDown/excelDownMapper.xml b/src/main/resources/mappers/excelDown/excelDownMapper.xml index 8ddc2089..260f0fa0 100644 --- a/src/main/resources/mappers/excelDown/excelDownMapper.xml +++ b/src/main/resources/mappers/excelDown/excelDownMapper.xml @@ -128,52 +128,52 @@ , CONVERT(varchar, A.DRAWING_ESTIMATE_CREATE_DATE, 120) AS DRAWING_ESTIMATE_CREATE_DATE/* プラン見積作成日 */ --> FROM T_OBJECT B - LEFT JOIN T_PLAN A + LEFT OUTER JOIN T_PLAN A ON A.OBJECT_NO = B.OBJECT_NO - LEFT JOIN M_COMM_L C1 + LEFT OUTER JOIN M_COMM_L C1 ON C1.CODE = B.OBJECT_STATUS_ID AND C1.HEAD_CD = '201700' - LEFT JOIN M_WORK_PROGRESS D + LEFT OUTER JOIN M_WORK_PROGRESS D ON B.WORK_NO = D.WORK_NO - LEFT JOIN M_PREFECTURE E + LEFT OUTER JOIN M_PREFECTURE E ON B.PREF_ID = E.PREF_ID - - LEFT JOIN M_SALES_STORE G + + LEFT OUTER JOIN M_SALES_STORE G ON B.SALE_STORE_ID = G.SALE_STORE_ID /*본인정보*/ - LEFT JOIN T_STATISTICS H + LEFT OUTER JOIN T_STATISTICS H ON A.OBJECT_NO = H.OBJECT_NO and A.PLAN_NO = H.PLAN_NO - - - - LEFT JOIN M_BUSINESS_CHARGER L + + + + LEFT OUTER JOIN M_BUSINESS_CHARGER L ON G.BUSINESS_CHARGER_CD = L.BUSINESS_CHARGER_CD - LEFT JOIN M_BUSINESS_TEAM M + LEFT OUTER JOIN M_BUSINESS_TEAM M ON L.BUSINESS_TEAM_CD = M.BUSINESS_TEAM_CD - LEFT JOIN M_COMM_L C2 + LEFT OUTER JOIN M_COMM_L C2 ON C2.CODE = A.ROOF_KIND_ID AND C2.HEAD_CD = '201800' - LEFT JOIN M_COMM_L C3 + LEFT OUTER JOIN M_COMM_L C3 ON C3.CODE = A.ROOF_MATERIAL_ID AND C3.HEAD_CD = '201900' - LEFT JOIN M_SUPPORT_METHOD P + LEFT OUTER JOIN M_SUPPORT_METHOD P ON A.SUPPORT_METHOD_ID = P.SUPPORT_METHOD_ID - LEFT JOIN M_COMM_L C4 + LEFT OUTER JOIN M_COMM_L C4 ON C4.CODE = A.CONSTRUCT_SPECIFICATION AND C4.HEAD_CD = '201300' - - - - LEFT JOIN T_ROOF_INSTALLED_HEIGHT U + + + + LEFT OUTER JOIN T_ROOF_INSTALLED_HEIGHT U ON A.OBJECT_NO = U.OBJECT_NO - LEFT JOIN T_APPROVAL_CAPATICY V + LEFT OUTER JOIN T_APPROVAL_CAPATICY V ON A.OBJECT_NO = V.OBJECT_NO AND A.PLAN_NO = V.PLAN_NO - LEFT JOIN T_MENSODO W + LEFT OUTER JOIN T_MENSODO W ON A.OBJECT_NO = W.OBJECT_NO - LEFT JOIN M_USER X + LEFT OUTER JOIN M_USER X ON A.LAST_EDIT_USER = X.USER_ID - LEFT JOIN M_SALES_STORE Y + LEFT OUTER JOIN M_SALES_STORE Y ON G.FIRST_AGENT_ID = Y.SALE_STORE_ID /*1차점정보*/ WHERE A.DEL_FLG = 0 AND B.DEL_FLG = 0 @@ -225,31 +225,31 @@ , D.FIRST_AGENT_FLG /* 一次代理店フラグ */ --> FROM T_OBJECT C - LEFT JOIN M_SALES_STORE D + LEFT OUTER JOIN M_SALES_STORE D ON C.SALE_STORE_ID = D.SALE_STORE_ID - LEFT JOIN T_PLAN B + LEFT OUTER JOIN T_PLAN B ON C.OBJECT_NO = B.OBJECT_NO LEFT OUTER JOIN T_PART_ESTIMATE A ON A.OBJECT_NO = B.OBJECT_NO AND A.PLAN_NO = B.PLAN_NO - LEFT JOIN T_STATISTICS E + LEFT OUTER JOIN T_STATISTICS E ON A.OBJECT_NO = E.OBJECT_NO AND A.PLAN_NO = E.PLAN_NO - LEFT JOIN M_BUSINESS_GROUP F + LEFT OUTER JOIN M_BUSINESS_GROUP F ON C.BUSINESS_GROUP_CD = F.BUSINESS_GROUP_CD AND F.DEL_FLG = 0 - LEFT JOIN M_BUSINESS_CHARGER G + LEFT OUTER JOIN M_BUSINESS_CHARGER G ON C.BUSINESS_CHARGER_CD = G.BUSINESS_CHARGER_CD AND G.DEL_FLG = 0 - LEFT JOIN M_SALES_STORE H + LEFT OUTER JOIN M_SALES_STORE H ON D.FIRST_AGENT_ID = H.SALE_STORE_ID AND H.DEL_FLG = 0 - LEFT JOIN M_PREFECTURE I + LEFT OUTER JOIN M_PREFECTURE I ON C.PREF_ID = I.PREF_ID - LEFT JOIN M_BUSINESS_CHARGER J + LEFT OUTER JOIN M_BUSINESS_CHARGER J ON D.BUSINESS_CHARGER_CD = J.BUSINESS_CHARGER_CD AND J.DEL_FLG = 0 - LEFT JOIN M_BUSINESS_TEAM K + LEFT OUTER JOIN M_BUSINESS_TEAM K ON J.BUSINESS_TEAM_CD = K.BUSINESS_TEAM_CD AND K.DEL_FLG = 0 WHERE C.DEL_FLG = 0 @@ -343,11 +343,11 @@ END AS EQUIP_GUARANTEE_YEARS_RETROACT /* 기기보증연수(소급) 機器保証年数_遡及 */ , CAST(A.SUNSHINE_COPENSATE_YEARS AS NVARCHAR) + '年' AS SUNSHINE_COPENSATE_YEARS /* 일조보상연수 日照補償年数 */ FROM T_GUARANTEE A - LEFT JOIN M_PREFECTURE B + LEFT OUTER JOIN M_PREFECTURE B ON A.GUARANTEE_RECEIVE_USER_PREF_ID = B.PREF_ID - LEFT JOIN M_PREFECTURE C + LEFT OUTER JOIN M_PREFECTURE C ON A.SETUP_PLACE_PREF_ID = C.PREF_ID - LEFT JOIN T_OBJECT D + LEFT OUTER JOIN T_OBJECT D ON A.OBJECT_NO = D.OBJECT_NO WHERE D.DEL_FLG != 1 AND D.ESTIMATE_DETAIL_CREATE_DATE #{sch_baseDt} + ' 23:59:59' /* 과거일자 기준일 */ @@ -431,33 +431,66 @@ , A.LAST_EDIT_USER /* 최종 업데이트자 */ , A.LAST_EDIT_DATETIME /* 최종 갱신시 */ FROM T_GUARANTEE A - LEFT JOIN T_OBJECT D - ON A.OBJECT_NO = D.OBJECT_NO - WHERE D.DEL_FLG = 0 - - - - - AND A.GUARANTEE_ISSUE_DATE =]]> #{sch_startDt} + ' 00:00:00' - AND A.GUARANTEE_ISSUE_DATE #{sch_endDt} + ' 23:59:59' - - - AND A.GUARANTEE_APPLY_DATE =]]> #{sch_startDt} + ' 00:00:00' - AND A.GUARANTEE_APPLY_DATE #{sch_endDt} + ' 23:59:59' - - - - - - AND A.OBJECT_NO LIKE '%' + #{sch_objectNo} + '%' - - - AND A.SETUP_PLACE_OBJECT_NAME LIKE '%' + #{sch_objectNm} + '%' - - - AND D.SALE_STORE_ID = #{sch_saleStoreId} - - - + LEFT OUTER JOIN T_OBJECT B + ON A.OBJECT_NO = B.OBJECT_NO + AND B.DEL_FLG = 0 + LEFT OUTER JOIN W_WARRANTY C + ON A.OBJECT_NO = C.OBJECT_NO + + + + + + + + + + AND A.GUARANTEE_ISSUE_DATE =]]> #{sch_startDt} + ' 00:00:00' + AND A.GUARANTEE_ISSUE_DATE #{sch_endDt} + ' 23:59:59' + + + AND A.GUARANTEE_APPLY_DATE =]]> #{sch_startDt} + ' 00:00:00' + AND A.GUARANTEE_APPLY_DATE #{sch_endDt} + ' 23:59:59' + + + + + + AND A.OBJECT_NO LIKE '%' + #{sch_objectNo} + '%' + + + AND A.SETUP_PLACE_OBJECT_NAME LIKE '%' + #{sch_objectNm} + '%' + + + AND B.SALE_STORE_ID = #{sch_saleStoreId} + + + AND C.WARRANTY_NO1 LIKE '%' + #{sch_warrantyNo} + '%' + + + + + + + \ No newline at end of file