diff --git a/spzx-manager/src/main/java/com/atguigu/spzx/manger/controller/ProductSpecController.java b/spzx-manager/src/main/java/com/atguigu/spzx/manger/controller/ProductSpecController.java index 9c601df..9dace83 100644 --- a/spzx-manager/src/main/java/com/atguigu/spzx/manger/controller/ProductSpecController.java +++ b/spzx-manager/src/main/java/com/atguigu/spzx/manger/controller/ProductSpecController.java @@ -3,12 +3,15 @@ package com.atguigu.spzx.manger.controller; import com.atguigu.spzx.manger.service.ProductSpecService; import com.atguigu.spzx.model.entity.product.ProductSpec; import com.atguigu.spzx.model.vo.result.Result; +import com.atguigu.spzx.model.vo.result.ResultCodeEnum; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + @Tag(name = "商品规格管理") @RestController @RequestMapping(value = "/admin/product/productSpec") @@ -43,4 +46,11 @@ public class ProductSpecController { productSpecService.deleteById(id); return Result.success(); } + + @Operation(summary = "加载商品规格数据", description = "加载商品规格数据") + @GetMapping("findAll") + public Result> findAll() { + List list = productSpecService.findAll(); + return Result.build(list, ResultCodeEnum.SUCCESS); + } } \ No newline at end of file diff --git a/spzx-manager/src/main/java/com/atguigu/spzx/manger/mapper/ProductSpecMapper.java b/spzx-manager/src/main/java/com/atguigu/spzx/manger/mapper/ProductSpecMapper.java index 8264b95..07e54ea 100644 --- a/spzx-manager/src/main/java/com/atguigu/spzx/manger/mapper/ProductSpecMapper.java +++ b/spzx-manager/src/main/java/com/atguigu/spzx/manger/mapper/ProductSpecMapper.java @@ -34,4 +34,11 @@ public interface ProductSpecMapper { * @param id 要删除的ID */ void deleteById(Long id); + + /** + * 加载商品规格数据 + * + * @return 列表 + */ + List findAll(); } diff --git a/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/ProductSpecService.java b/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/ProductSpecService.java index fd87850..f379a47 100644 --- a/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/ProductSpecService.java +++ b/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/ProductSpecService.java @@ -3,6 +3,8 @@ package com.atguigu.spzx.manger.service; import com.atguigu.spzx.model.entity.product.ProductSpec; import com.github.pagehelper.PageInfo; +import java.util.List; + public interface ProductSpecService { /** * 列表查询 @@ -33,4 +35,11 @@ public interface ProductSpecService { * @param id 要删除的ID */ void deleteById(Long id); + + /** + * 加载商品规格数据 + * + * @return 列表 + */ + List findAll(); } diff --git a/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/ProductSpecServiceImpl.java b/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/ProductSpecServiceImpl.java index ffcf39e..7ae24bb 100644 --- a/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/ProductSpecServiceImpl.java +++ b/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/ProductSpecServiceImpl.java @@ -75,4 +75,14 @@ public class ProductSpecServiceImpl implements ProductSpecService { emptyUtil.isEmpty(id, MessageConstant.UPDATE_ID_IS_NOT_EMPTY); productSpecMapper.deleteById(id); } + + /** + * 加载商品规格数据 + * + * @return 列表 + */ + @Override + public List findAll() { + return productSpecMapper.findAll(); + } } diff --git a/spzx-manager/src/main/resources/mapper/ProductSpecMapper.xml b/spzx-manager/src/main/resources/mapper/ProductSpecMapper.xml index 32fde16..3239963 100644 --- a/spzx-manager/src/main/resources/mapper/ProductSpecMapper.xml +++ b/spzx-manager/src/main/resources/mapper/ProductSpecMapper.xml @@ -41,4 +41,11 @@ from product_spec where is_deleted = 0 order by id desc + + +