Browse Source

가맹점 브랜드 리스트 api 추가

dwkim 2 years ago
parent
commit
2018084a29

+ 3 - 0
src/main/java/com/oqpo/api/mapper/stinfo/BrandMapper.java

@@ -15,4 +15,7 @@ public interface BrandMapper {
15 15
 
16 16
     List<BrandEntity> selectPopBrandGridList(@Param("userId") String userId, @Param("authTpCd") String authTpCd, @Param("brandNm") String brandNm , GridRequest gridRequest)throws Exception;
17 17
     int selectPopBrandGridCnt(@Param("userId") String userId, @Param("authTpCd") String authTpCd, @Param("brandNm") String brandNm )throws Exception;
18
+
19
+    List<BrandEntity> selectAfflBrandList(@Param("afflShopId") String afflShopId)throws Exception;
20
+
18 21
 }

+ 12 - 1
src/main/java/com/oqpo/api/service/stinfo/BrandService.java

@@ -2,12 +2,15 @@ package com.oqpo.api.service.stinfo;
2 2
 
3 3
 
4 4
 
5
+import com.oqpo.api.entity.CodeEntity;
5 6
 import com.oqpo.api.entity.stinfo.BrandEntity;
6 7
 import com.oqpo.api.mapper.stinfo.BrandMapper;
7 8
 import com.oqpo.api.service.CommonService;
8 9
 import com.oqpo.api.web.dto.request.GridRequest;
9 10
 import com.oqpo.api.web.dto.response.GridResponse;
11
+import com.oqpo.api.web.dto.response.code.CodeSearchListResponse;
10 12
 import com.oqpo.api.web.dto.response.stinfo.BrandSearchResponse;
13
+import com.oqpo.api.web.dto.response.stinfo.brand.AfflBrandSearchResponse;
11 14
 import lombok.extern.slf4j.Slf4j;
12 15
 import org.springframework.beans.factory.annotation.Autowired;
13 16
 import org.springframework.stereotype.Service;
@@ -22,7 +25,7 @@ public class BrandService extends CommonService {
22 25
     private BrandMapper brandMapper;
23 26
 
24 27
     /*
25
-      가맹점 리스트 조회
28
+      session 브랜드 리스트 조회
26 29
      */
27 30
     public List<BrandEntity> selectTargetBrandGridList(String userId, String authTpCd) throws Exception {
28 31
         return brandMapper.selectTargetBrandGridList(userId, authTpCd);
@@ -50,4 +53,12 @@ public class BrandService extends CommonService {
50 53
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
51 54
     }
52 55
 
56
+    /*
57
+      가맹점 브랜드 리스트 조회
58
+     */
59
+    public AfflBrandSearchResponse selectAfflBrandList(String afflShopId) throws Exception {
60
+        List<BrandEntity> entities = brandMapper.selectAfflBrandList(afflShopId);
61
+        return AfflBrandSearchResponse.toDTO(entities);
62
+    }
63
+
53 64
 }

+ 20 - 0
src/main/java/com/oqpo/api/web/controller/stinfo/BrandController.java

@@ -3,6 +3,8 @@ package com.oqpo.api.web.controller.stinfo;
3 3
 import com.oqpo.api.service.stinfo.BrandService;
4 4
 import com.oqpo.api.web.dto.request.stinfo.brand.BrandGridRequest;
5 5
 import com.oqpo.api.web.dto.response.GridResponse;
6
+import com.oqpo.api.web.dto.response.code.CodeSearchListResponse;
7
+import com.oqpo.api.web.dto.response.stinfo.brand.AfflBrandSearchResponse;
6 8
 import io.swagger.annotations.ApiImplicitParam;
7 9
 import io.swagger.annotations.ApiImplicitParams;
8 10
 import io.swagger.annotations.ApiOperation;
@@ -37,4 +39,22 @@ public class BrandController {
37 39
         return ResponseEntity.ok(brandService.selectPopBrandGridList(userId, authTpCd, brandGridRequest.getBrandNm(), brandGridRequest.toDTO(brandGridRequest)));
38 40
     }
39 41
 
42
+
43
+    /**
44
+     * 설명 : 가맹점 브랜드 리스트
45
+     *
46
+     * @param afflShopId
47
+     * @return
48
+     * @throws Exception
49
+     */
50
+    @ApiImplicitParams({
51
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
52
+            @ApiImplicitParam(name = "afflShopId", value = "가맹점아이디", required = true, dataType = "String", paramType = "query")
53
+    })
54
+    @ApiOperation(value = "가맹점 브랜드 리스트")
55
+    @GetMapping("/affl_brand_list")
56
+    public ResponseEntity<AfflBrandSearchResponse> selectAfflBrandList(@RequestParam(value = "afflShopId", required = true) String afflShopId) throws Exception {
57
+        return ResponseEntity.ok(brandService.selectAfflBrandList(afflShopId));
58
+    }
59
+
40 60
 }

+ 46 - 0
src/main/java/com/oqpo/api/web/dto/response/stinfo/brand/AfflBrandSearchResponse.java

@@ -0,0 +1,46 @@
1
+package com.oqpo.api.web.dto.response.stinfo.brand;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.oper.NticeEntity;
5
+import com.oqpo.api.entity.stinfo.BrandEntity;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.*;
8
+
9
+import java.util.List;
10
+import java.util.stream.Collectors;
11
+
12
+@Getter
13
+@Setter
14
+@Builder
15
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
16
+@JsonInclude(JsonInclude.Include.ALWAYS)
17
+public class AfflBrandSearchResponse {
18
+
19
+    @ApiModelProperty(value = "브랜드리스트")
20
+    private List<SearchBrand> searchList;
21
+
22
+
23
+    public static AfflBrandSearchResponse toDTO(List<BrandEntity> entities) {
24
+        if (entities == null) return null;
25
+        return AfflBrandSearchResponse.builder()
26
+                .searchList(entities.stream()
27
+                        .map(m -> SearchBrand.builder()
28
+                                .brandId(m.getBrandId())
29
+                                .brandNm(m.getBrandNm())
30
+                                .build())
31
+                        .collect(Collectors.toList()))
32
+                .build();
33
+    }
34
+
35
+
36
+    @Getter
37
+    @Builder
38
+    @AllArgsConstructor(access = AccessLevel.PROTECTED)
39
+    static class SearchBrand {
40
+        @ApiModelProperty(value = "브랜드아이디")
41
+        private String brandId;
42
+
43
+        @ApiModelProperty(value = "브랜드명")
44
+        private String brandNm;
45
+    }
46
+}

+ 8 - 0
src/main/resources/mybatis/sqlmaps/stinfo/brand.xml

@@ -76,4 +76,12 @@
76 76
     </select>
77 77
 
78 78
 
79
+    <select id="selectAfflBrandList" resultType="com.oqpo.api.entity.stinfo.BrandEntity">
80
+        select brand_id, brand_nm
81
+        from brand_base_info
82
+        where st_cd = 'S000'
83
+        and affl_shop_id = #{afflShopId}
84
+    </select>
85
+
86
+
79 87
 </mapper>