diff --git a/bhs/bhs-system/src/main/java/com/bhs/controller/ProductController.java b/bhs/bhs-system/src/main/java/com/bhs/controller/ProductController.java new file mode 100644 index 0000000000000000000000000000000000000000..c829ea69b37cea156ee9c69a00a1949d4df1911f --- /dev/null +++ b/bhs/bhs-system/src/main/java/com/bhs/controller/ProductController.java @@ -0,0 +1,22 @@ +package com.bhs.controller; + +import com.bhs.pojo.Item; +import com.bhs.service.Product.ProductService; +import com.bhs.vo.ResponseData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/menu/product") +@CrossOrigin +public class ProductController { + @Autowired + private ProductService productService; + @PostMapping("/getDetails/{id}") + public ResponseData getDetails(@PathVariable("id") Integer id){ + Item productDetails=productService.getDetails(id); + return ResponseData.success(productDetails); + } +} diff --git a/bhs/bhs-system/src/main/java/com/bhs/mappers/Product/ProductMapper.java b/bhs/bhs-system/src/main/java/com/bhs/mappers/Product/ProductMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..a529856305d6df70a7e5285a7b476234299d4f07 --- /dev/null +++ b/bhs/bhs-system/src/main/java/com/bhs/mappers/Product/ProductMapper.java @@ -0,0 +1,13 @@ +package com.bhs.mappers.Product; + +import com.bhs.pojo.Item; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface ProductMapper { + @Select("SELECT id,menu_id,name,price,img_path,created,updated,status,top_menu_id,repertory,advantage " + + "FROM item " + + "WHERE id=#{id}") + Item getDetails(Integer id); +} diff --git a/bhs/bhs-system/src/main/java/com/bhs/service/Product/ProductService.java b/bhs/bhs-system/src/main/java/com/bhs/service/Product/ProductService.java new file mode 100644 index 0000000000000000000000000000000000000000..988186539a30299df6900dd3fcb3d28d73bae95c --- /dev/null +++ b/bhs/bhs-system/src/main/java/com/bhs/service/Product/ProductService.java @@ -0,0 +1,11 @@ +package com.bhs.service.Product; + +import com.bhs.pojo.Item; + +import java.util.List; + +public interface ProductService { + + Item getDetails(Integer productID); + +} diff --git a/bhs/bhs-system/src/main/java/com/bhs/service/Product/impl/ProductServiceImpl.java b/bhs/bhs-system/src/main/java/com/bhs/service/Product/impl/ProductServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5881bd2a7a71dfc666536372fc19cd18a30baad2 --- /dev/null +++ b/bhs/bhs-system/src/main/java/com/bhs/service/Product/impl/ProductServiceImpl.java @@ -0,0 +1,22 @@ +package com.bhs.service.Product.impl; + +import com.bhs.mappers.Product.ProductMapper; +import com.bhs.pojo.Item; +import com.bhs.service.Product.ProductService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ProductServiceImpl implements ProductService { + @Autowired + private ProductMapper productMapper; + + @Override + public Item getDetails(Integer id) { + return productMapper.getDetails(id); + } + + +} diff --git a/bhs/bhs-system/target/classes/com/bhs/controller/ProductController.class b/bhs/bhs-system/target/classes/com/bhs/controller/ProductController.class new file mode 100644 index 0000000000000000000000000000000000000000..1a19dc95cc3c9d85e0917ba0e96eab86ac296bd5 Binary files /dev/null and b/bhs/bhs-system/target/classes/com/bhs/controller/ProductController.class differ diff --git a/bhs/bhs-system/target/classes/com/bhs/mappers/Product/ProductMapper.class b/bhs/bhs-system/target/classes/com/bhs/mappers/Product/ProductMapper.class new file mode 100644 index 0000000000000000000000000000000000000000..fd766d23e509a7fb29e86ed05eadee94544fda61 Binary files /dev/null and b/bhs/bhs-system/target/classes/com/bhs/mappers/Product/ProductMapper.class differ diff --git a/bhs/bhs-system/target/classes/com/bhs/service/Product/ProductService.class b/bhs/bhs-system/target/classes/com/bhs/service/Product/ProductService.class new file mode 100644 index 0000000000000000000000000000000000000000..9a423ef2a423e3e33bb09c3d54cf91cae2982afc Binary files /dev/null and b/bhs/bhs-system/target/classes/com/bhs/service/Product/ProductService.class differ diff --git a/bhs/bhs-system/target/classes/com/bhs/service/Product/impl/ProductServiceImpl.class b/bhs/bhs-system/target/classes/com/bhs/service/Product/impl/ProductServiceImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..1d30099cb1276fb4eb1e68ef98f53185b7e26249 Binary files /dev/null and b/bhs/bhs-system/target/classes/com/bhs/service/Product/impl/ProductServiceImpl.class differ diff --git a/bhs/bhs-user/DSB.http b/bhs/bhs-user/DSB.http new file mode 100644 index 0000000000000000000000000000000000000000..3f7c761f25457874dab661963c147bccfa3734d5 --- /dev/null +++ b/bhs/bhs-user/DSB.http @@ -0,0 +1 @@ +POST http://localhost:1009/menu/product/getDetails/8 \ No newline at end of file diff --git a/vue-store/src/App.vue b/vue-store/src/App.vue index c158a9b1620af3ae56e8ca0a6fdc38e47831e0e4..b21ed4bdb528cbafc2086181c9dfe7127ecec750 100644 --- a/vue-store/src/App.vue +++ b/vue-store/src/App.vue @@ -8,6 +8,7 @@