From 71508d505033c97539e3210b2b4118af217af8f7 Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Sat, 16 Dec 2023 16:23:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 -- .idea/dataSources.xml | 2 +- .idea/encodings.xml | 12 -- .idea/inspectionProfiles/Project_Default.xml | 6 - .idea/misc.xml | 11 +- .idea/uiDesigner.xml | 124 ------------------ spzx-common/common-util/pom.xml | 10 +- .../controller/CategoryBrandController.java | 10 ++ .../bunny/controller/ProductController.java | 34 +++++ .../interceptor/LoginAuthInterceptor.java | 1 + .../cn/bunny/mapper/CategoryBrandMapper.java | 4 + .../java/cn/bunny/mapper/ProductMapper.java | 13 ++ .../bunny/service/CategoryBrandService.java | 6 + .../java/cn/bunny/service/ProductService.java | 12 ++ .../impl/CategoryBrandServiceImpl.java | 7 + .../service/impl/ProductServiceImpl.java | 26 ++++ .../src/main/resources/application.yml | 3 + .../mapper/brand/CategoryBrandMapper.xml | 10 ++ .../mapper/product/ProductMapper.xml | 44 +++++++ 19 files changed, 177 insertions(+), 166 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/uiDesigner.xml create mode 100644 spzx-manager/src/main/java/cn/bunny/controller/ProductController.java create mode 100644 spzx-manager/src/main/java/cn/bunny/mapper/ProductMapper.java create mode 100644 spzx-manager/src/main/java/cn/bunny/service/ProductService.java create mode 100644 spzx-manager/src/main/java/cn/bunny/service/impl/ProductServiceImpl.java create mode 100644 spzx-manager/src/main/resources/mapper/product/ProductMapper.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 5050234..0ab0f5a 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -1,7 +1,7 @@ - + mysql.8 true com.mysql.cj.jdbc.Driver diff --git a/.idea/encodings.xml b/.idea/encodings.xml index e91bfef..ad50fd9 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,23 +3,11 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index c7111bb..30e75dc 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,12 +1,6 @@ \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 1b1ae75..322c5da 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,17 +5,8 @@ - - - - + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 2b63946..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spzx-common/common-util/pom.xml b/spzx-common/common-util/pom.xml index d62427c..81aa3ae 100644 --- a/spzx-common/common-util/pom.xml +++ b/spzx-common/common-util/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 @@ -12,8 +12,8 @@ common-util - 21 - 21 + 17 + 17 UTF-8 @@ -39,7 +39,7 @@ org.springframework.boot spring-boot-starter-web - provided + provided \ No newline at end of file diff --git a/spzx-manager/src/main/java/cn/bunny/controller/CategoryBrandController.java b/spzx-manager/src/main/java/cn/bunny/controller/CategoryBrandController.java index 486055c..c02c1b5 100644 --- a/spzx-manager/src/main/java/cn/bunny/controller/CategoryBrandController.java +++ b/spzx-manager/src/main/java/cn/bunny/controller/CategoryBrandController.java @@ -2,6 +2,7 @@ package cn.bunny.controller; import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto; +import cn.bunny.common.spzx.model.entity.product.Brand; import cn.bunny.common.spzx.model.entity.product.CategoryBrand; import cn.bunny.common.spzx.model.vo.common.Result; import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum; @@ -12,6 +13,8 @@ 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("/admin/product/categoryBrand") @@ -19,6 +22,13 @@ public class CategoryBrandController { @Autowired private CategoryBrandService categoryBrandService; + @Operation(summary = "根据id查询对应商品数据",description = "根据id查询对应商品数据") + @GetMapping("/findBrandByCategoryId/{categoryId}") + public Result findBrandByCategoryId(@PathVariable Long categoryId) { + List brandList = categoryBrandService.findBrandByCategoryId(categoryId); + return Result.build(brandList, ResultCodeEnum.SUCCESS); + } + @Operation(summary = "删除分类品牌", description = "删除分类品牌") @DeleteMapping("/deleteById/{id}") diff --git a/spzx-manager/src/main/java/cn/bunny/controller/ProductController.java b/spzx-manager/src/main/java/cn/bunny/controller/ProductController.java new file mode 100644 index 0000000..8d48742 --- /dev/null +++ b/spzx-manager/src/main/java/cn/bunny/controller/ProductController.java @@ -0,0 +1,34 @@ +package cn.bunny.controller; + +import cn.bunny.common.spzx.model.dto.product.ProductDto; +import cn.bunny.common.spzx.model.entity.product.Product; +import cn.bunny.common.spzx.model.vo.common.Result; +import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum; +import cn.bunny.service.ProductService; +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.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Tag(name = "商品管理接口") +@RestController +@RequestMapping("/admin/product/product") +public class ProductController { + @Autowired + private ProductService productService; + + @Operation(summary = "商品管理查询分页", description = "商品管理查询分页") + @GetMapping("/{page}/{limit}") + public Result findByPage(@PathVariable("page") Integer page, + @PathVariable("limit") Integer limit, + ProductDto productDto) { + PageInfo productList = productService.findByPage(page, limit, productDto); + return Result.build(productList, ResultCodeEnum.SUCCESS); + } +} diff --git a/spzx-manager/src/main/java/cn/bunny/interceptor/LoginAuthInterceptor.java b/spzx-manager/src/main/java/cn/bunny/interceptor/LoginAuthInterceptor.java index 3e23aad..5d01e93 100644 --- a/spzx-manager/src/main/java/cn/bunny/interceptor/LoginAuthInterceptor.java +++ b/spzx-manager/src/main/java/cn/bunny/interceptor/LoginAuthInterceptor.java @@ -1,5 +1,6 @@ package cn.bunny.interceptor; + import cn.bunny.common.AuthContextUtil; import cn.bunny.common.spzx.model.entity.system.SysUser; import cn.bunny.common.spzx.model.vo.common.Result; diff --git a/spzx-manager/src/main/java/cn/bunny/mapper/CategoryBrandMapper.java b/spzx-manager/src/main/java/cn/bunny/mapper/CategoryBrandMapper.java index d2fecba..cdee69e 100644 --- a/spzx-manager/src/main/java/cn/bunny/mapper/CategoryBrandMapper.java +++ b/spzx-manager/src/main/java/cn/bunny/mapper/CategoryBrandMapper.java @@ -1,6 +1,7 @@ package cn.bunny.mapper; import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto; +import cn.bunny.common.spzx.model.entity.product.Brand; import cn.bunny.common.spzx.model.entity.product.CategoryBrand; import org.apache.ibatis.annotations.Mapper; @@ -19,4 +20,7 @@ public interface CategoryBrandMapper { // 删除分类品牌 void deleteById(Long id); + + // 根据id查询对应商品数据 + List findBrandByCategoryId(Long categoryId); } diff --git a/spzx-manager/src/main/java/cn/bunny/mapper/ProductMapper.java b/spzx-manager/src/main/java/cn/bunny/mapper/ProductMapper.java new file mode 100644 index 0000000..70e4750 --- /dev/null +++ b/spzx-manager/src/main/java/cn/bunny/mapper/ProductMapper.java @@ -0,0 +1,13 @@ +package cn.bunny.mapper; + +import cn.bunny.common.spzx.model.dto.product.ProductDto; +import cn.bunny.common.spzx.model.entity.product.Product; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface ProductMapper { + // 查询分页 + public List findByPage(ProductDto productDto); +} diff --git a/spzx-manager/src/main/java/cn/bunny/service/CategoryBrandService.java b/spzx-manager/src/main/java/cn/bunny/service/CategoryBrandService.java index bf26f5f..0f8b9ec 100644 --- a/spzx-manager/src/main/java/cn/bunny/service/CategoryBrandService.java +++ b/spzx-manager/src/main/java/cn/bunny/service/CategoryBrandService.java @@ -1,9 +1,12 @@ package cn.bunny.service; import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto; +import cn.bunny.common.spzx.model.entity.product.Brand; import cn.bunny.common.spzx.model.entity.product.CategoryBrand; import com.github.pagehelper.PageInfo; +import java.util.List; + public interface CategoryBrandService { // 分类品牌条件分页查询 PageInfo findByPage(Integer page, Integer limit, CategoryBrandDto categoryBrandDto); @@ -16,4 +19,7 @@ public interface CategoryBrandService { // 删除分类品牌 void deleteById(Long id); + + // 根据id查询对应商品数据 + List findBrandByCategoryId(Long categoryId); } diff --git a/spzx-manager/src/main/java/cn/bunny/service/ProductService.java b/spzx-manager/src/main/java/cn/bunny/service/ProductService.java new file mode 100644 index 0000000..a8bab09 --- /dev/null +++ b/spzx-manager/src/main/java/cn/bunny/service/ProductService.java @@ -0,0 +1,12 @@ +package cn.bunny.service; + +import cn.bunny.common.spzx.model.dto.product.ProductDto; +import cn.bunny.common.spzx.model.entity.product.Product; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface ProductService { + // 查询分页 + PageInfo findByPage(Integer page, Integer limit, ProductDto productDto); +} diff --git a/spzx-manager/src/main/java/cn/bunny/service/impl/CategoryBrandServiceImpl.java b/spzx-manager/src/main/java/cn/bunny/service/impl/CategoryBrandServiceImpl.java index 69d0e34..b5dbe0b 100644 --- a/spzx-manager/src/main/java/cn/bunny/service/impl/CategoryBrandServiceImpl.java +++ b/spzx-manager/src/main/java/cn/bunny/service/impl/CategoryBrandServiceImpl.java @@ -1,6 +1,7 @@ package cn.bunny.service.impl; import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto; +import cn.bunny.common.spzx.model.entity.product.Brand; import cn.bunny.common.spzx.model.entity.product.CategoryBrand; import cn.bunny.mapper.CategoryBrandMapper; import cn.bunny.service.CategoryBrandService; @@ -44,4 +45,10 @@ public class CategoryBrandServiceImpl implements CategoryBrandService { public void deleteById(Long id) { categoryBrandMapper.deleteById(id); } + + // 根据id查询对应商品数据 + @Override + public List findBrandByCategoryId(Long categoryId) { + return categoryBrandMapper.findBrandByCategoryId(categoryId); + } } diff --git a/spzx-manager/src/main/java/cn/bunny/service/impl/ProductServiceImpl.java b/spzx-manager/src/main/java/cn/bunny/service/impl/ProductServiceImpl.java new file mode 100644 index 0000000..fee4de7 --- /dev/null +++ b/spzx-manager/src/main/java/cn/bunny/service/impl/ProductServiceImpl.java @@ -0,0 +1,26 @@ +package cn.bunny.service.impl; + +import cn.bunny.common.spzx.model.dto.product.ProductDto; +import cn.bunny.common.spzx.model.entity.product.Product; +import cn.bunny.mapper.ProductMapper; +import cn.bunny.service.ProductService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +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 PageInfo findByPage(Integer page, Integer limit, ProductDto productDto) { + PageHelper.startPage(page, limit); + List productList = productMapper.findByPage(productDto); + return new PageInfo<>(productList); + } +} diff --git a/spzx-manager/src/main/resources/application.yml b/spzx-manager/src/main/resources/application.yml index fef4755..d32cbbf 100644 --- a/spzx-manager/src/main/resources/application.yml +++ b/spzx-manager/src/main/resources/application.yml @@ -16,8 +16,11 @@ spring: spzx: auth: noAuthUrls: + - /doc.*/** + - /doc.*/**/** - /admin/system/index/login - /admin/system/index/generateValidateCode + minio: endpointUrl: "http://129.211.31.58:9000" accessKey: "bunny" diff --git a/spzx-manager/src/main/resources/mapper/brand/CategoryBrandMapper.xml b/spzx-manager/src/main/resources/mapper/brand/CategoryBrandMapper.xml index 8fe1282..b82e498 100644 --- a/spzx-manager/src/main/resources/mapper/brand/CategoryBrandMapper.xml +++ b/spzx-manager/src/main/resources/mapper/brand/CategoryBrandMapper.xml @@ -50,4 +50,14 @@ order by cb.id desc + + + diff --git a/spzx-manager/src/main/resources/mapper/product/ProductMapper.xml b/spzx-manager/src/main/resources/mapper/product/ProductMapper.xml new file mode 100644 index 0000000..ff4e82a --- /dev/null +++ b/spzx-manager/src/main/resources/mapper/product/ProductMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + id,name,brand_id,category1_id,category2_id,category3_id,unit_name,slider_urls,spec_value,status,audit_status,audit_message,create_time,update_time,is_deleted + + + + + + and p.brand_id = #{brandId} + + + and p.category1_id = #{category1Id} + + + and p.category2_id = #{category2Id} + + + and p.category3_id = #{category3Id} + + and p.is_deleted = 0 + + + + + +