From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001
From: lee <4766465@qq.com>
Date: Wed, 18 Dec 2024 13:27:00 +0800
Subject: [PATCH] init

---
 yami-shop-api/src/main/java/com/yami/shop/api/controller/SkuController.java |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/SkuController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/SkuController.java
new file mode 100644
index 0000000..4bcd0d1
--- /dev/null
+++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/SkuController.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
+ *
+ * https://www.mall4j.com/
+ *
+ * 未经允许,不可做商业用途!
+ *
+ * 版权所有,侵权必究!
+ */
+package com.yami.shop.api.controller;
+
+import com.yami.shop.bean.app.dto.SkuDto;
+import com.yami.shop.bean.model.Sku;
+import com.yami.shop.common.i18n.I18nMessage;
+import com.yami.shop.common.response.ServerResponseEntity;
+import com.yami.shop.service.SkuService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import ma.glasnost.orika.MapperFacade;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author LGH
+ */
+@RestController
+@RequestMapping("/sku")
+@Tag(name = "sku规格接口")
+@AllArgsConstructor
+public class SkuController {
+
+    private final SkuService skuService;
+
+    private final MapperFacade mapperFacade;
+
+    @GetMapping("/getSkuList")
+    @Operation(summary = "通过prodId获取上架的规格列表" , description = "通过prodId获取上架的规格列表")
+    @Parameter(name = "prodId", description = "商品id" )
+    public ServerResponseEntity<List<SkuDto>> getSkuListByProdId(Long prodId) {
+        List<Sku> skus = skuService.listPutOnSkuAndSkuStock(prodId, I18nMessage.getDbLang());
+        List<SkuDto> skuDtoList = mapperFacade.mapAsList(skus, SkuDto.class);
+        return ServerResponseEntity.success(skuDtoList);
+    }
+}

--
Gitblit v1.9.3