浏览代码

단위 팝업 검색 수정

dwkim 2 年之前
父节点
当前提交
620cc10b53

+ 7 - 0
src/main/java/com/oqpo/api/mapper/stinfo/ItemUnitMapper.java

@@ -22,9 +22,16 @@ public interface ItemUnitMapper {
22 22
     List<ItemUnitEntity> selectPopItemBrandUnitGridList(@Param("sBrandId") String sBrandId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation, GridRequest gridRequest)throws Exception;
23 23
     int selectPopItemBrandUnitGridCnt(@Param("sBrandId") String sBrandId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation)throws Exception;
24 24
 
25
+    List<ItemUnitEntity> selectPopNewItemBrandUnitGridList(@Param("sBrandId") String sBrandId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation, GridRequest gridRequest)throws Exception;
26
+    int selectPopNewItemBrandUnitGridCnt(@Param("sBrandId") String sBrandId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation)throws Exception;
27
+
25 28
     List<ItemUnitEntity> selectPopItemStoreUnitGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, GridRequest gridRequest)throws Exception;
26 29
     int selectPopItemStoreUnitGridCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn)throws Exception;
27 30
 
31
+    List<ItemUnitEntity> selectPopNewItemStoreUnitGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, GridRequest gridRequest)throws Exception;
32
+    int selectPopNewItemStoreUnitGridCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn)throws Exception;
33
+
34
+
28 35
     int insertItemUnitInfo(@Param("userId") String userId, ItemUnitEntity entity) throws Exception;
29 36
     int updateItemUnitInfo(@Param("userId") String userId, ItemUnitEntity entity) throws Exception;
30 37
 

+ 42 - 0
src/main/java/com/oqpo/api/service/stinfo/ItemService.java

@@ -90,6 +90,48 @@ public class ItemService extends CommonService {
90 90
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
91 91
     }
92 92
 
93
+    /*
94
+      팝업 신규 품목 리스트 조회
95
+     */
96
+    public GridResponse selectPopNewItemGridList(String sBrandId,String sStoreId, String sPodrPssblDvsn, String sItemNm, String sSpplyId, String sWhsId, String sLocation, GridRequest gridRequest) throws Exception {
97
+        int gridPage = gridRequest.getGridPage();
98
+        int gridSize = gridRequest.getGridSize();
99
+
100
+        int gridRecords = 0 ;
101
+        int gridTotal = 0;
102
+        List<ItemUnitEntity> entities =  new ArrayList<ItemUnitEntity>()  ;
103
+
104
+        if ("".equals(sStoreId)) {
105
+            gridRecords = itemUnitMapper.selectPopNewItemBrandUnitGridCnt( sBrandId,sItemNm,  sPodrPssblDvsn, sSpplyId, sWhsId, sLocation );
106
+            gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
107
+            entities = itemUnitMapper.selectPopNewItemBrandUnitGridList(sBrandId, sItemNm, sPodrPssblDvsn, sSpplyId, sWhsId, sLocation,  gridRequest);
108
+        } else {
109
+            gridRecords = itemUnitMapper.selectPopNewItemStoreUnitGridCnt( sBrandId,sStoreId,sItemNm, sPodrPssblDvsn );
110
+            gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
111
+            entities = itemUnitMapper.selectPopNewItemStoreUnitGridList(sBrandId,sStoreId, sItemNm, sPodrPssblDvsn,  gridRequest);
112
+        }
113
+
114
+        List<Object> gridRows = entities.stream()
115
+                .map(m -> ItemPopSearchResponse.builder()
116
+                        .viewCd("R")
117
+                        .itemId(m.getItemId())
118
+                        .itemNm(m.getItemNm())
119
+                        .podrPssblDvsn(m.getPodrPssblDvsn())
120
+                        .podrPssblDvsnNm(m.getPodrPssblDvsnNm())
121
+                        .unit(m.getUnit())
122
+                        .unitNm(m.getUnitNm())
123
+                        .unitAmt(m.getUnitAmt())
124
+                        .stddQty(m.getStddQty())
125
+                        .unitGubun(m.getUnitGubun())
126
+                        .spplyId(m.getSpplyId())
127
+                        .brandUnitUnqNo(m.getBrandUnitUnqNo())
128
+                        .storeUnitUnqNo(m.getStoreUnitUnqNo() == null ? "" : m.getStoreUnitUnqNo())
129
+                        .whsPassQty(m.getWhsPassQty() == null ? 0 : m.getWhsPassQty())
130
+                        .build())
131
+                .collect(Collectors.toList());
132
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
133
+    }
134
+
93 135
     /*
94 136
       품목 그리드 리스트 조회
95 137
      */

+ 16 - 0
src/main/java/com/oqpo/api/web/controller/stinfo/ItemController.java

@@ -50,6 +50,22 @@ public class ItemController {
50 50
         return ResponseEntity.ok(itemService.selectPopItemGridList(itemPopGridRequest.getSBrandId(), itemPopGridRequest.getSStoreId(), itemPopGridRequest.getSPodrPssblDvsn(), itemPopGridRequest.getSItemNm(), itemPopGridRequest.getSSpplyId(), itemPopGridRequest.getSWhsId(), itemPopGridRequest.getSLocation(), itemPopGridRequest.toDTO(itemPopGridRequest)) );
51 51
     }
52 52
 
53
+    /**
54
+     * 설명 : 품목 신규팝업 그리드 리스트
55
+     *
56
+     * @param ItemPopGridRequest
57
+     * @return
58
+     * @throws Exception
59
+     */
60
+    @ApiImplicitParams({
61
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
62
+    })
63
+    @ApiOperation(value = " 품목 신규 팝업 그리드 리스트")
64
+    @PostMapping("/pop-new-grid-list")
65
+    public ResponseEntity<GridResponse> selectPopNewItemGridList( @RequestBody @Valid ItemPopGridRequest itemPopGridRequest) throws Exception {
66
+        return ResponseEntity.ok(itemService.selectPopNewItemGridList(itemPopGridRequest.getSBrandId(), itemPopGridRequest.getSStoreId(), itemPopGridRequest.getSPodrPssblDvsn(), itemPopGridRequest.getSItemNm(), itemPopGridRequest.getSSpplyId(), itemPopGridRequest.getSWhsId(), itemPopGridRequest.getSLocation(), itemPopGridRequest.toDTO(itemPopGridRequest)) );
67
+    }
68
+
53 69
     /**
54 70
      * 설명 : 품목 그리드 리스트
55 71
      *

+ 124 - 0
src/main/resources/mybatis/sqlmaps/stinfo/ItemUnit.xml

@@ -262,6 +262,73 @@
262 262
         </if>
263 263
     </select>
264 264
 
265
+
266
+    <select id="selectPopNewItemBrandUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
267
+        select  /* selectPopNewItemBrandUnitGridList */
268
+        iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
269
+        ,iInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', iInfo.unit) as unit_nm, bInfo.stdd_qty, bInfo.unit_amt, bInfo.brand_unit_unq_no
270
+        ,'B' as unit_gubun, bInfo.spply_id
271
+        <if test="sWhsId == null or sWhsId == '' or sLocation = null or sLocation == ''">
272
+            ,0 as whs_pass_qty
273
+        </if>
274
+        <if test="sWhsId != null and sWhsId != '' and sLocation != null and sLocation != ''">
275
+            , nvl((stck.stck_qty - stck.wait_qty),0) as whs_pass_qty
276
+        </if>
277
+        from item_base_info iInfo
278
+        left outer join brand_item_unit_info bInfo on iInfo.brand_id = bInfo.brand_id and iInfo.item_id = bInfo.item_id and date_format(now(),'%Y%m%d') between bInfo.cont_stt_dt and bInfo.cont_end_dt
279
+        <if test="sSpplyId != null and sSpplyId != '' ">
280
+            and bInfo.spply_id = #{sSpplyId}
281
+        </if>
282
+
283
+        <if test="sWhsId != null and sWhsId != '' and sLocation != null and sLocation != ''">
284
+            left outer join stck_mgnt_base_info stck on stck.brand_id = iInfo.brand_id and stck.item_id = iInfo.item_id and whs_id = #{sWhsId} and location = #{sLocation}
285
+        </if>
286
+        where iInfo.brand_id = #{sBrandId}
287
+        AND   iInfo.item_st_cd = 'IS00'
288
+        <if test="sItemNm != null and sItemNm != ''">
289
+            and  (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
290
+        </if>
291
+        <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
292
+            and   iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
293
+        </if>
294
+        <choose>
295
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
296
+                <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
297
+                    <if test="gridRequest.sord == 'asc'.toString()">
298
+                        order by iInfo.item_nm asc
299
+                    </if>
300
+                    <if test="gridRequest.sord == 'desc'.toString()">
301
+                        order by iInfo.item_nm desc
302
+                    </if>
303
+                </if>
304
+            </when>
305
+            <otherwise>
306
+                order by iInfo.item_nm asc
307
+            </otherwise>
308
+        </choose>
309
+        <if test="gridRequest.pagingYn == true">
310
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
311
+        </if>
312
+    </select>
313
+
314
+    <select id="selectPopNewItemBrandUnitGridCnt" resultType="int">
315
+        select  /* selectPopNewItemBrandUnitGridCnt */
316
+        count(*)
317
+        from item_base_info iInfo
318
+        left outer join brand_item_unit_info bInfo on iInfo.brand_id = bInfo.brand_id and iInfo.item_id = bInfo.item_id and date_format(now(),'%Y%m%d') between bInfo.cont_stt_dt and bInfo.cont_end_dt
319
+        <if test="sSpplyId != null and sSpplyId != '' ">
320
+            and bInfo.spply_id = #{sSpplyId}
321
+        </if>
322
+        where iInfo.brand_id = #{sBrandId}
323
+        AND   iInfo.item_st_cd = 'IS00'
324
+        <if test="sItemNm != null and sItemNm != ''">
325
+            and  (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
326
+        </if>
327
+        <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
328
+            and   iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
329
+        </if>
330
+    </select>
331
+
265 332
     <select id="selectPopItemStoreUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
266 333
         select  /* selectPopItemStoreUnitGridList */
267 334
                 iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
@@ -319,4 +386,61 @@
319 386
         </if>
320 387
     </select>
321 388
 
389
+    <select id="selectPopNewItemStoreUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
390
+        select  /* selectPopNewItemStoreUnitGridList */
391
+        iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
392
+        ,iInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', iInfo.unit) as unit_nm, sInfo.stdd_qty, sInfo.unit_amt, sInfo.store_unit_unq_no
393
+        ,'S' as unit_gubun, sInfo.brand_unit_unq_no
394
+        , 0 as whs_pass_qty, '' as spply_id
395
+        from item_base_info iInfo
396
+        join store_base_info store on iInfo.brand_id = store.brand_id   and store.store_id = #{sStoreId}
397
+        join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
398
+        and store.store_id = sInfo.store_id  and sInfo.store_id =  #{sStoreId}
399
+        and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
400
+        where iInfo.brand_id =  #{sBrandId}
401
+        AND   iInfo.item_st_cd = 'IS00'
402
+        <if test="sItemNm != null and sItemNm != ''">
403
+            and  (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
404
+        </if>
405
+        <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
406
+            and   iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
407
+        </if>
408
+        <choose>
409
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
410
+                <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
411
+                    <if test="gridRequest.sord == 'asc'.toString()">
412
+                        order by iInfo.item_nm asc
413
+                    </if>
414
+                    <if test="gridRequest.sord == 'desc'.toString()">
415
+                        order by iInfo.item_nm desc
416
+                    </if>
417
+                </if>
418
+            </when>
419
+            <otherwise>
420
+                order by iInfo.item_nm asc
421
+            </otherwise>
422
+        </choose>
423
+        <if test="gridRequest.pagingYn == true">
424
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
425
+        </if>
426
+    </select>
427
+
428
+    <select id="selectPopNewItemStoreUnitGridCnt" resultType="int">
429
+        select  /* selectPopNewItemStoreUnitGridCnt */
430
+        count(*)
431
+        from item_base_info iInfo
432
+        join store_base_info store on iInfo.brand_id = store.brand_id   and store.store_id = #{sStoreId}
433
+        join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
434
+        and store.store_id = sInfo.store_id  and sInfo.store_id =  #{sStoreId}
435
+        and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
436
+        where iInfo.brand_id =  #{sBrandId}
437
+        AND   iInfo.item_st_cd = 'IS00'
438
+        <if test="sItemNm != null and sItemNm != ''">
439
+            and  (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
440
+        </if>
441
+        <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
442
+            and   iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
443
+        </if>
444
+    </select>
445
+
322 446
 </mapper>