From 20610745710775ebe9d7e2da6d8decdcbdc04182 Mon Sep 17 00:00:00 2001 From: ronger Date: Fri, 16 Feb 2024 14:23:03 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BA=A7=E5=93=81=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rymcu/forest/mapper/ProductMapper.java | 2 +- .../com/rymcu/forest/service/ProductService.java | 2 +- .../forest/service/impl/ProductServiceImpl.java | 2 +- .../forest/web/api/product/ProductController.java | 14 ++++++++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rymcu/forest/mapper/ProductMapper.java b/src/main/java/com/rymcu/forest/mapper/ProductMapper.java index 4fb8757..173657a 100644 --- a/src/main/java/com/rymcu/forest/mapper/ProductMapper.java +++ b/src/main/java/com/rymcu/forest/mapper/ProductMapper.java @@ -38,5 +38,5 @@ public interface ProductMapper extends Mapper { * @param type * @return */ - ProductDTO selectProductDTOById(@Param("idProduct") Integer idProduct, @Param("type") Integer type); + ProductDTO selectProductDTOById(@Param("idProduct") Long idProduct, @Param("type") Integer type); } diff --git a/src/main/java/com/rymcu/forest/service/ProductService.java b/src/main/java/com/rymcu/forest/service/ProductService.java index 3851c37..fa14811 100644 --- a/src/main/java/com/rymcu/forest/service/ProductService.java +++ b/src/main/java/com/rymcu/forest/service/ProductService.java @@ -28,5 +28,5 @@ public interface ProductService extends Service { * @param type * @return */ - ProductDTO findProductDTOById(Integer idProduct, Integer type); + ProductDTO findProductDTOById(Long idProduct, Integer type); } diff --git a/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java index b6ddaa6..35f53b5 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java @@ -29,7 +29,7 @@ public class ProductServiceImpl extends AbstractService implements Prod } @Override - public ProductDTO findProductDTOById(Integer idProduct, Integer type) { + public ProductDTO findProductDTOById(Long idProduct, Integer type) { return productMapper.selectProductDTOById(idProduct, type); } } diff --git a/src/main/java/com/rymcu/forest/web/api/product/ProductController.java b/src/main/java/com/rymcu/forest/web/api/product/ProductController.java index 6675a1f..c3229ae 100644 --- a/src/main/java/com/rymcu/forest/web/api/product/ProductController.java +++ b/src/main/java/com/rymcu/forest/web/api/product/ProductController.java @@ -1,8 +1,10 @@ package com.rymcu.forest.web.api.product; +import com.rymcu.forest.core.result.GlobalResult; +import com.rymcu.forest.core.result.GlobalResultGenerator; +import com.rymcu.forest.dto.ProductDTO; import com.rymcu.forest.service.ProductService; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -20,4 +22,12 @@ public class ProductController { @Resource private ProductService productService; + + + @GetMapping("/detail/{idProduct}") + public GlobalResult detail(@PathVariable Long idProduct, @RequestParam(defaultValue = "2") Integer type) { + ProductDTO dto = productService.findProductDTOById(idProduct, type); + return GlobalResultGenerator.genSuccessResult(dto); + } + }