아이템 조회 쿼리 조건 추가

This commit is contained in:
DESKTOP-6ARNG1Q\dlsgk 2025-01-10 14:00:19 +09:00
parent 1a98b4c18a
commit 7247edd59e
5 changed files with 56 additions and 32 deletions

View File

@ -1,6 +1,14 @@
package com.interplug.qcast.biz.displayItem; package com.interplug.qcast.biz.displayItem;
import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemDetailResponse;
import com.interplug.qcast.biz.displayItem.dto.ItemRequest;
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 java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -9,13 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemDetailResponse;
import com.interplug.qcast.biz.displayItem.dto.ItemResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
@RestController @RestController
@ -42,16 +43,15 @@ public class DisplayItemController {
/** /**
* 제품 목록 조회 * 제품 목록 조회
* *
* @param saleStoreId * @param itemRequest
* @return * @return
* @throws Exception * @throws Exception
*/ */
@Operation(description = "제품 목록을 조회한다.") @Operation(description = "제품 목록을 조회한다.")
@GetMapping("/item-list") @PostMapping("/item-list")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
public List<ItemResponse> getItemList(@RequestParam String saleStoreId) public List<ItemResponse> getItemList(@RequestBody ItemRequest itemRequest) throws Exception {
throws Exception { return displayItemService.getItemList(itemRequest);
return displayItemService.getItemList(saleStoreId);
} }
/** /**

View File

@ -10,7 +10,7 @@ public interface DisplayItemMapper {
void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws Exception; void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws Exception;
List<ItemResponse> getItemList(@Param("saleStoreId") String saleStoreId); List<ItemResponse> getItemList(ItemRequest itemRequest);
ItemDetailResponse getItemDetail(@Param("itemId") String itemId); ItemDetailResponse getItemDetail(@Param("itemId") String itemId);

View File

@ -1,19 +1,14 @@
package com.interplug.qcast.biz.displayItem; package com.interplug.qcast.biz.displayItem;
import java.util.List; import com.interplug.qcast.biz.displayItem.dto.*;
import org.springframework.stereotype.Service;
import com.interplug.qcast.biz.displayItem.dto.BomSyncResponse;
import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemDetailResponse;
import com.interplug.qcast.biz.displayItem.dto.ItemResponse;
import com.interplug.qcast.biz.displayItem.dto.ItemSyncResponse;
import com.interplug.qcast.biz.displayItem.dto.PriceItemSyncResponse;
import com.interplug.qcast.biz.estimate.EstimateMapper; import com.interplug.qcast.biz.estimate.EstimateMapper;
import com.interplug.qcast.biz.estimate.dto.NoteRequest; import com.interplug.qcast.biz.estimate.dto.NoteRequest;
import com.interplug.qcast.biz.estimate.dto.NoteResponse; import com.interplug.qcast.biz.estimate.dto.NoteResponse;
import io.micrometer.common.util.StringUtils; import io.micrometer.common.util.StringUtils;
import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j @Slf4j
@Service @Service
@ -37,11 +32,11 @@ public class DisplayItemService {
/** /**
* 아이템 목록 조회 * 아이템 목록 조회
* *
* @param saleStoreId * @param itemRequest
* @return * @return
*/ */
public List<ItemResponse> getItemList(String saleStoreId) { public List<ItemResponse> getItemList(ItemRequest itemRequest) {
return displayItemMapper.getItemList(saleStoreId); return displayItemMapper.getItemList(itemRequest);
} }
/** /**

View File

@ -0,0 +1,17 @@
package com.interplug.qcast.biz.displayItem.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ItemRequest {
@Schema(description = "Sale Store Id")
private String saleStoreId;
@Schema(description = "Cold Zone Flg")
private String coldZoneFlg;
@Schema(description = "Salt-affected Flg")
private String saltAffectedFlg;
}

View File

@ -44,11 +44,11 @@
); );
</insert> </insert>
<select id="getItemList" parameterType="String" resultType="com.interplug.qcast.biz.displayItem.dto.ItemResponse" > <select id="getItemList" parameterType="com.interplug.qcast.biz.displayItem.dto.ItemRequest" resultType="com.interplug.qcast.biz.displayItem.dto.ItemResponse" >
/* sqlid : com.interplug.qcast.displayItem.getItemList */ /* sqlid : com.interplug.qcast.displayItem.getItemList */
SELECT TT.* SELECT TT.*
FROM ( FROM (
SELECT /* 전체 목록중 미표시 제품 */ SELECT /* 전체 목록중 미표시 제품 제외 */
MI.ITEM_ID MI.ITEM_ID
, MI.ITEM_NO , MI.ITEM_NO
, MI.ITEM_NAME , MI.ITEM_NAME
@ -59,13 +59,19 @@
AND SSDI.SALE_STORE_ID = #{saleStoreId} AND SSDI.SALE_STORE_ID = #{saleStoreId}
AND SSDI.DISP_TYPE_CD = 'DISP002' /* 미표시 */ AND SSDI.DISP_TYPE_CD = 'DISP002' /* 미표시 */
AND dbo.fn_fmtdDate(GETDATE(), 'YYYYMMDD') BETWEEN SSDI.START_DATE AND SSDI.END_DATE AND dbo.fn_fmtdDate(GETDATE(), 'YYYYMMDD') BETWEEN SSDI.START_DATE AND SSDI.END_DATE
WHERE MI.LIMITED_RELEASE_FLG = 0 WHERE SSDI.ITEM_ID IS NULL
AND MI.DEL_FLG = 0 AND MI.DEL_FLG = 0
AND SSDI.ITEM_ID IS NULL AND MI.LIMITED_RELEASE_FLG = 0
<if test='coldZoneFlg != null and coldZoneFlg == "1"'>
AND MI.COLD_ZONE_FLG = #{coldZoneFlg}
</if>
<if test='saltAffectedFlg != null and saltAffectedFlg == "1"'>
AND MI.SALT_AFFECTED_FLG = #{saltAffectedFlg}
</if>
UNION ALL UNION ALL
SELECT /* 미표시 제품 중 판매점만 표시 */ SELECT /* 미표시 제품 중 등록된 표시 제품 표시 */
MI.ITEM_ID MI.ITEM_ID
, MI.ITEM_NO , MI.ITEM_NO
, MI.ITEM_NAME , MI.ITEM_NAME
@ -75,6 +81,12 @@
ON MI.ITEM_ID = SSDI.ITEM_ID ON MI.ITEM_ID = SSDI.ITEM_ID
AND MI.LIMITED_RELEASE_FLG = 1 AND MI.LIMITED_RELEASE_FLG = 1
AND MI.DEL_FLG = 0 AND MI.DEL_FLG = 0
<if test='coldZoneFlg != null and coldZoneFlg == "1"'>
AND MI.COLD_ZONE_FLG = #{coldZoneFlg}
</if>
<if test='saltAffectedFlg != null and saltAffectedFlg == "1"'>
AND MI.SALT_AFFECTED_FLG = #{saltAffectedFlg}
</if>
WHERE SSDI.SALE_STORE_ID = #{saleStoreId} WHERE SSDI.SALE_STORE_ID = #{saleStoreId}
AND SSDI.DISP_TYPE_CD = 'DISP001' /* 표시 */ AND SSDI.DISP_TYPE_CD = 'DISP001' /* 표시 */
AND dbo.fn_fmtdDate(GETDATE(), 'YYYYMMDD') BETWEEN SSDI.START_DATE AND SSDI.END_DATE AND dbo.fn_fmtdDate(GETDATE(), 'YYYYMMDD') BETWEEN SSDI.START_DATE AND SSDI.END_DATE