Merge branch 'dev' into feature/qcast-121

This commit is contained in:
DESKTOP-6ARNG1Q\dlsgk 2024-09-23 17:34:34 +09:00
commit 112f84ec90
6 changed files with 110 additions and 1 deletions

View File

@ -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<ObjectResponse> objectList = objectService.selectObjectList(objectRequest);
mainPageResponse.setObjectList(objectList);
return mainPageResponse;
}
}

View File

@ -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<ObjectResponse> objectList;
}

View File

@ -22,6 +22,9 @@ interface ObjectMapper {
// 판매점 목록 조회
public List<SaleStoreResponse> selectSaleStoreList(String saleStoreId);
// 판매점 정보 조회
public SaleStoreResponse selectSaleStoreInfo(String saleStoreId);
// 물건정보 목록 조회
public List<ObjectResponse> selectObjectList(ObjectRequest objectRequest);

View File

@ -48,6 +48,10 @@ public class ObjectService {
}
}
public SaleStoreResponse selectSaleStoreInfo(String saleStoreId) throws Exception {
return objectMapper.selectSaleStoreInfo(saleStoreId);
}
public List<ObjectResponse> selectObjectList(ObjectRequest objectRequest) throws Exception {
return objectMapper.selectObjectList(objectRequest);
}

View File

@ -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;
}

View File

@ -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
</select>
<select id="selectSaleStoreInfo" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
/* sqlid : com.interplug.qcast.biz.object.selectSaleStoreInfo */
SELECT
A.SALE_STORE_NAME
, B.BUSINESS_CHARGER
, B.BUSINESS_CHARGER_TEL
, B.BUSINESS_CHARGER_MAIL
FROM M_SALES_STORE A WITH(NOLOCK)
LEFT JOIN M_BUSINESS_CHARGER B WITH(NOLOCK)
ON A.BUSINESS_CHARGER_CD = B.BUSINESS_CHARGER_CD
WHERE A.SALE_STORE_ID = #{saleStoreId}
</select>
<select id="selectObjectList" parameterType="com.interplug.qcast.biz.object.dto.ObjectRequest" resultType="com.interplug.qcast.biz.object.dto.ObjectResponse">
/* sqlid : com.interplug.qcast.biz.object.selectObjectList */
/* 계층형 구조에 맞는 SALE_STORE_ID 축출 - 재귀함수 */