diff --git a/src/main/java/com/interplug/qcast/biz/mainPage/MainPageController.java b/src/main/java/com/interplug/qcast/biz/mainPage/MainPageController.java new file mode 100644 index 00000000..fed0ac51 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/mainPage/MainPageController.java @@ -0,0 +1,53 @@ +package com.interplug.qcast.biz.mainPage; + +import com.interplug.qcast.biz.mainPage.dto.MainPageResponse; +import com.interplug.qcast.biz.object.ObjectService; +import com.interplug.qcast.biz.object.dto.ObjectRequest; +import com.interplug.qcast.biz.object.dto.ObjectResponse; +import com.interplug.qcast.biz.object.dto.SaleStoreResponse; +import com.interplug.qcast.config.message.Messages; +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Slf4j +@RestController +@RequestMapping("/api/main-page") +@RequiredArgsConstructor +public class MainPageController { + + private final ObjectService objectService; + + @Operation(description = "메인 물건정보 목록을 조회한다.") + @GetMapping("/object/{saleStoreId}/list") + @ResponseStatus(HttpStatus.OK) + public MainPageResponse selectObjectList(@PathVariable String saleStoreId) throws Exception { + MainPageResponse mainPageResponse = new MainPageResponse(); + + // 판매점명 조회 + SaleStoreResponse saleStoreResponse = objectService.selectSaleStoreInfo(saleStoreId); + if (saleStoreResponse != null) { + mainPageResponse.setSaleStoreId(saleStoreId); + mainPageResponse.setSaleStoreName(saleStoreResponse.getSaleStoreName()); + mainPageResponse.setBusinessCharger(saleStoreResponse.getBusinessCharger()); + mainPageResponse.setBusinessChargerTel(saleStoreResponse.getBusinessChargerTel()); + mainPageResponse.setBusinessChargerMail(saleStoreResponse.getBusinessChargerMail()); + } + + // 물건정보 목록 조회 + ObjectRequest objectRequest = new ObjectRequest(); + objectRequest.setSaleStoreId(saleStoreId); + objectRequest.setStartRow("1"); + objectRequest.setEndRow("3"); + + List objectList = objectService.selectObjectList(objectRequest); + mainPageResponse.setObjectList(objectList); + + return mainPageResponse; + } +} diff --git a/src/main/java/com/interplug/qcast/biz/mainPage/dto/MainPageResponse.java b/src/main/java/com/interplug/qcast/biz/mainPage/dto/MainPageResponse.java new file mode 100644 index 00000000..89f767ca --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/mainPage/dto/MainPageResponse.java @@ -0,0 +1,29 @@ +package com.interplug.qcast.biz.mainPage.dto; + +import com.interplug.qcast.biz.object.dto.ObjectResponse; +import com.interplug.qcast.biz.object.dto.PlanResponse; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +//@Data +@Getter +@Setter +public class MainPageResponse { + // 판매점정보 + @Schema(description = "판매점ID") + private String saleStoreId; + @Schema(description = "판매점명") + private String saleStoreName; + @Schema(description = "영업사원명") + private String businessCharger; + @Schema(description = "영업사원 연락처") + private String businessChargerTel; + @Schema(description = "영업사원 메일주소") + private String businessChargerMail; + + @Schema(description = "물건정보 목록") + private List objectList; +} diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java b/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java index 2842360f..a5bf56c8 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java @@ -22,6 +22,9 @@ interface ObjectMapper { // 판매점 목록 조회 public List selectSaleStoreList(String saleStoreId); + // 판매점 정보 조회 + public SaleStoreResponse selectSaleStoreInfo(String saleStoreId); + // 물건정보 목록 조회 public List selectObjectList(ObjectRequest objectRequest); diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java index 1f5c0f59..164ffc5d 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java @@ -48,6 +48,10 @@ public class ObjectService { } } + public SaleStoreResponse selectSaleStoreInfo(String saleStoreId) throws Exception { + return objectMapper.selectSaleStoreInfo(saleStoreId); + } + public List selectObjectList(ObjectRequest objectRequest) throws Exception { return objectMapper.selectObjectList(objectRequest); } diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/SaleStoreResponse.java b/src/main/java/com/interplug/qcast/biz/object/dto/SaleStoreResponse.java index f60e4cb5..b172ceca 100644 --- a/src/main/java/com/interplug/qcast/biz/object/dto/SaleStoreResponse.java +++ b/src/main/java/com/interplug/qcast/biz/object/dto/SaleStoreResponse.java @@ -19,4 +19,11 @@ public class SaleStoreResponse { private String saleStoreLevel; @Schema(description = "1차점판매점ID") private String firstAgentId; + + @Schema(description = "영업사원명") + private String businessCharger; + @Schema(description = "영업사원 연락처") + private String businessChargerTel; + @Schema(description = "영업사원 메일주소") + private String businessChargerMail; } diff --git a/src/main/resources/mappers/object/objectMapper.xml b/src/main/resources/mappers/object/objectMapper.xml index 46c841cc..1ec46287 100644 --- a/src/main/resources/mappers/object/objectMapper.xml +++ b/src/main/resources/mappers/object/objectMapper.xml @@ -79,7 +79,7 @@ , A.SALE_STORE_NAME , A.SALE_STORE_LEVEL , A.FIRST_AGENT_ID - FROM M_SALES_STORE A + FROM M_SALES_STORE A WITH(NOLOCK) WHERE SALE_STORE_ID = (SELECT FIRST_AGENT_ID FROM M_SALES_STORE WHERE SALE_STORE_ID = #{saleStoreId} AND DEL_FLG = '0') AND APPROVE_FLG = '2' AND DEL_FLG = '0' @@ -93,6 +93,19 @@ FROM SALES_STORE_CTE A + +