item 조회 api 추가

This commit is contained in:
DESKTOP-6ARNG1Q\dlsgk 2024-10-28 15:49:00 +09:00
parent 1812a803b1
commit 481612ef50
4 changed files with 89 additions and 0 deletions

View File

@ -1,8 +1,10 @@
package com.interplug.qcast.biz.displayItem;
import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
@ -23,4 +25,19 @@ public class DisplayItemController {
throws Exception {
displayItemService.setStoreDisplayItemSave(displayItemRequest);
}
@Operation(description = "제품 목록을 조회한다.")
@GetMapping("/item_list")
@ResponseStatus(HttpStatus.OK)
public List<ItemResponse> getItemList(@RequestParam("saleStoreId") String saleStoreId)
throws Exception {
return displayItemService.getItemList(saleStoreId);
}
@Operation(description = "제품 상세 정보를 조회한다.")
@GetMapping("/item_detail")
@ResponseStatus(HttpStatus.OK)
public ItemResponse getItemDetail(@RequestParam("itemId") String itemId) throws Exception {
return displayItemService.getItemDetail(itemId);
}
}

View File

@ -1,10 +1,17 @@
package com.interplug.qcast.biz.displayItem;
import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemResponse;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface DisplayItemMapper {
void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws Exception;
List<ItemResponse> getItemList(@Param("saleStoreId") String saleStoreId);
ItemResponse getItemDetail(@Param("itemId") String itemId);
}

View File

@ -1,6 +1,8 @@
package com.interplug.qcast.biz.displayItem;
import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemResponse;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -15,4 +17,12 @@ public class DisplayItemService {
public void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws Exception {
displayItemMapper.setStoreDisplayItemSave(displayItemRequest);
}
public List<ItemResponse> getItemList(String saleStoreId) {
return displayItemMapper.getItemList(saleStoreId);
}
public ItemResponse getItemDetail(String itemId) {
return displayItemMapper.getItemDetail(itemId);
}
}

View File

@ -43,4 +43,59 @@
, #{lastEditDatetime}
);
</insert>
<select id="getItemList" parameterType="String" resultType="com.interplug.qcast.biz.displayItem.dto.ItemResponse" >
/* sqlid : com.interplug.qcast.displayItem.getItemList */
SELECT TT.*
FROM (
SELECT /* 전체 목록중 미표시 제품 */
MI.ITEM_ID
, MI.ITEM_NAME
, MI.DISP_ORDER
FROM M_ITEM MI
LEFT OUTER JOIN M_SALES_STORE_DISP_ITEM SSDI
ON MI.ITEM_ID = SSDI.ITEM_ID
AND SSDI.SALE_STORE_ID = #{saleStoreId}
AND SSDI.DISP_TYPE_CD = 'DISP002' /* 미표시 */
AND dbo.fn_fmtdDate(GETDATE(), 'YYYYMMDD') BETWEEN SSDI.START_DATE AND SSDI.END_DATE
WHERE MI.LIMITED_RELEASE_FLG = 0
AND MI.DEL_FLG = 0
AND SSDI.ITEM_ID IS NULL
UNION ALL
SELECT /* 미표시 제품 중 판매점만 표시 */
MI.ITEM_ID
, MI.ITEM_NAME
, MI.DISP_ORDER
FROM M_SALES_STORE_DISP_ITEM SSDI
INNER JOIN M_ITEM MI
ON MI.ITEM_ID = SSDI.ITEM_ID
AND MI.LIMITED_RELEASE_FLG = 1
AND MI.DEL_FLG = 0
WHERE SSDI.SALE_STORE_ID = #{saleStoreId}
AND SSDI.DISP_TYPE_CD = 'DISP001' /* 표시 */
AND dbo.fn_fmtdDate(GETDATE(), 'YYYYMMDD') BETWEEN SSDI.START_DATE AND SSDI.END_DATE
) TT
ORDER BY TT.DISP_ORDER
</select>
<select id="getItemDetail" parameterType="String" resultType="com.interplug.qcast.biz.displayItem.dto.ItemResponse" >
/* sqlid : com.interplug.qcast.displayItem.getItemDetail */
SELECT
MI.ITEM_ID
, MI.ITEM_NAME
, MI.GOODS_NO
, MI.UNIT
, MI.SPECIFICATION
, MI.PNOW_W
, MI.ITEM_GROUP
, MI.MODULE_FLG
, MI.PKG_MATERIAL_FLG
, MI.FILE_UPLOAD_FLG
FROM M_ITEM MI
WHERE MI.DEL_FLG = 0
AND MI.ITEM_ID = #{itemId}
</select>
</mapper>