Procházet zdrojové kódy

품목분류 저장 api 수정

dwkim před 2 roky
rodič
revize
526d692d68

+ 1 - 0
src/main/java/com/oqpo/api/entity/stinfo/ItemClassMngEntity.java

@@ -27,5 +27,6 @@ public class ItemClassMngEntity implements Serializable {
27 27
     private String sysRegId ;
28 28
     private String sysChgDttm ;
29 29
     private String sysChgId ;
30
+    private String cLevel;
30 31
 
31 32
 }

+ 2 - 1
src/main/java/com/oqpo/api/enums/SystemMessageCode.java

@@ -26,7 +26,8 @@ public enum SystemMessageCode {
26 26
     BATCH_OK (90000, "배치 성공", HttpStatus.OK),
27 27
     ERR_PW(40001, "현재의 비밀번호가 틀립니다. ", HttpStatus.BAD_REQUEST),
28 28
     ERR_FIND_ID(40002, "입력하신  정보로 등록된 아이디가 없습니다.", HttpStatus.BAD_REQUEST),
29
-    ERR_FIND_PW(40003, "입력하신  정보로 등록된 아이디가 없습니다.", HttpStatus.BAD_REQUEST)
29
+    ERR_FIND_PW(40003, "입력하신  정보로 등록된 아이디가 없습니다.", HttpStatus.BAD_REQUEST),
30
+    ERR_ITEMCLASS (40004, "품목분류 중복발생하였습니다.!", HttpStatus.BAD_REQUEST),
30 31
     ;
31 32
 
32 33
 

+ 2 - 0
src/main/java/com/oqpo/api/mapper/stinfo/ItemMapper.java

@@ -40,4 +40,6 @@ public interface ItemMapper {
40 40
     int selectItemClassMngGridCnt(@Param("sBrandId") String sBrandId, @Param("sItemClass1") String sItemClass1, @Param("sItemClass2") String sItemClass2,  @Param("sItemClass3") String sItemClass3, @Param("sItemClass4") String sItemClass4,@Param("sItemClassNm") String sItemClassNm)throws Exception;
41 41
     ItemClassMngEntity selectItemClassMngInfo(@Param("brandId") String brandId, @Param("itemClassMgntNo") String itemClassMgntNo)throws Exception;
42 42
 
43
+    int selectItemClassMaxClass(@Param("sBrandId") String sBrandId, @Param("cLevel") String cLevel, @Param("sItemClass1") String sItemClass1, @Param("sItemClass2") String sItemClass2,  @Param("sItemClass3") String sItemClass3, @Param("sItemClass4") String sItemClass4);
44
+
43 45
 }

+ 43 - 1
src/main/java/com/oqpo/api/service/stinfo/ItemService.java

@@ -4,6 +4,7 @@ package com.oqpo.api.service.stinfo;
4 4
 import com.oqpo.api.entity.oper.FileEntity;
5 5
 import com.oqpo.api.entity.oper.UserMngEntity;
6 6
 import com.oqpo.api.entity.stinfo.*;
7
+import com.oqpo.api.enums.SystemMessageCode;
7 8
 import com.oqpo.api.exception.GlobalException;
8 9
 import com.oqpo.api.mapper.FileMapper;
9 10
 import com.oqpo.api.mapper.oper.UserMngMapper;
@@ -97,7 +98,7 @@ public class ItemService extends CommonService {
97 98
     /* 품목 정보 */
98 99
     public ItemInfoResponse selectItemInfo(String brandId, String itemId) throws Exception {
99 100
 
100
-        ItemEntity entity = itemMapper.selectItemInfo(brandId, itemId);
101
+        ItemEntity entity = itemMapper.selectItemInfo( brandId, itemId);
101 102
         List<FileEntity> fileImageInfoList = null;
102 103
 
103 104
         if (!"".equals(entity.getItemImageFileNo())) {
@@ -232,7 +233,48 @@ public class ItemService extends CommonService {
232 233
             entity.setPrnSeq(saveItemClassMngInfolRequest.getPrnSeq());
233 234
 
234 235
             if ("C".equals(saveItemClassMngInfolRequest.getViewCd())) {
236
+                String classLevel = "1";
237
+                if ("".equals(entity.getItemClass1()))
238
+                {
239
+                    // level 1 추가
240
+                    classLevel = "1";
241
+                } else {
242
+                    if ("".equals(entity.getItemClass2()))
243
+                    {
244
+                        // level 2 추가
245
+                        classLevel = "2";
246
+                    } else {
247
+                        if ("".equals(entity.getItemClass3()))
248
+                        {
249
+                            // level 3 추가
250
+                            classLevel = "3";
251
+                        } else {
252
+                            if ("".equals(entity.getItemClass4()))
253
+                            {
254
+                                // level 4 추가
255
+                                classLevel = "4";
256
+                            } else {
257
+                                // 오류
258
+                                throw new GlobalException(SystemMessageCode.ERR_ITEMCLASS);
259
+                            }
260
+                        }
261
+                    }
262
+                }
263
+
264
+                System.out.println("=classLevel============================>" + classLevel );
265
+                entity.setCLevel(classLevel);
266
+                int classNum = itemMapper.selectItemClassMaxClass(entity.getBrandId(), entity.getCLevel(), entity.getItemClass1(), entity.getItemClass2(), entity.getItemClass3(), entity.getItemClass4() ) ;
267
+                if ("1".equals(classLevel)) {
268
+                    entity.setItemClass1(Integer.toString(classNum));
269
+                } else if ("2".equals(classLevel)) {
270
+                    entity.setItemClass2(Integer.toString(classNum));
271
+                }  else if ("3".equals(classLevel)) {
272
+                    entity.setItemClass3(Integer.toString(classNum));
273
+                }  else if ("4".equals(classLevel)) {
274
+                    entity.setItemClass4(Integer.toString(classNum));
275
+                }
235 276
                 entity.setItemClassMgntNo(fnGetKeyNo(31));        // 품목분류 아이디 부여
277
+
236 278
                 itemMapper.insertItemClassMngInfo(userId, entity);
237 279
             } else if ("U".equals(saveItemClassMngInfolRequest.getViewCd())) {
238 280
                 itemMapper.updateItemClassMngInfo(userId, entity);

+ 23 - 0
src/main/resources/mybatis/sqlmaps/stinfo/Item.xml

@@ -419,4 +419,27 @@
419 419
             where brand_id = #{brandId}
420 420
             and   item_class_mgnt_no =  #{itemClassMgntNo}
421 421
     </select>
422
+
423
+    <select id="selectItemClassMaxClass" resultType="Integer">
424
+            select
425
+                    max(case when #{cLevel} = '1' then cast(nvl(item_class1,0) as unsigned )
426
+                            when #{cLevel} = '2' then cast(nvl(item_class2,0) as unsigned )
427
+                            when #{cLevel} = '3' then cast(nvl(item_class3,0) as unsigned )
428
+                            else   cast(nvl(item_class4,0) as unsigned )  end ) + 10 as mno
429
+            from item_class_mgnt
430
+            where brand_id = #{sBrandId}
431
+            <if test="sItemClass1 != null and sItemClass1 != ''">
432
+                and   item_class1 = #{sItemClass1}
433
+            </if>
434
+            <if test="sItemClass2 != null and sItemClass2 != ''">
435
+                and   item_class2 = #{sItemClass2}
436
+            </if>
437
+            <if test="sItemClass3 != null and sItemClass3 != ''">
438
+                and   item_class3 = #{sItemClass3}
439
+            </if>
440
+            <if test="sItemClass4 != null and sItemClass4 != ''">
441
+                and   item_class4 = #{sItemClass4}
442
+            </if>
443
+    </select>
444
+
422 445
 </mapper>