Browse Source

提交供应商

lipenghui 5 months ago
parent
commit
eeb60eb3b1
21 changed files with 959 additions and 2 deletions
  1. 3 1
      pom.xml
  2. 23 0
      yudao-module-supplier/pom.xml
  3. 25 0
      yudao-module-supplier/yudao-module-supplier-api/pom.xml
  4. 57 0
      yudao-module-supplier/yudao-module-supplier-biz/pom.xml
  5. 94 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/ProductCategoryController.java
  6. 95 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/ProductController.java
  7. 37 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductCategoryPageReqVO.java
  8. 43 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductCategoryRespVO.java
  9. 33 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductCategorySaveReqVO.java
  10. 40 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductPageReqVO.java
  11. 47 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductRespVO.java
  12. 34 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductSaveReqVO.java
  13. 51 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/dataobject/product/ProductCategoryDO.java
  14. 55 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/dataobject/product/ProductDO.java
  15. 29 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/mysql/product/ProductCategoryMapper.java
  16. 30 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/mysql/product/ProductMapper.java
  17. 56 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductCategoryService.java
  18. 71 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductCategoryServiceImpl.java
  19. 55 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductService.java
  20. 71 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductServiceImpl.java
  21. 10 1
      yudao-server/pom.xml

+ 3 - 1
pom.xml

@@ -21,7 +21,9 @@
 <!--        <module>yudao-module-mp</module>-->
 <!--        <module>yudao-module-pay</module>-->
 <!--        <module>yudao-module-mall</module>-->
-<!--        <module>yudao-module-crm</module>-->
+<!--        <module>module-supplier</module>-->
+        <module>yudao-module-supplier</module>
+        <!--        <module>yudao-module-crm</module>-->
 <!--        <module>yudao-module-erp</module>-->
 <!--        <module>yudao-module-iot</module>-->
         <!-- AI 大模型的开启,请参考 https://doc.iocoder.cn/ai/build/ 文档,对 JDK 版本要要求! -->

+ 23 - 0
yudao-module-supplier/pom.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>yudao</artifactId>
+        <groupId>cn.iocoder.boot</groupId>
+        <version>${revision}</version>
+    </parent>
+    <modules>
+        <module>yudao-module-supplier-api</module>
+        <module>yudao-module-supplier-biz</module>
+    </modules>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>yudao-module-supplier</artifactId>
+    <packaging>pom</packaging>
+
+    <name>${project.artifactId}</name>
+    <description>
+    </description>
+
+</project>

+ 25 - 0
yudao-module-supplier/yudao-module-supplier-api/pom.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>yudao-module-supplier</artifactId>
+        <groupId>cn.iocoder.boot</groupId>
+        <version>${revision}</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>yudao-module-supplier-api</artifactId>
+    <packaging>jar</packaging>
+
+    <name>${project.artifactId}</name>
+    <description>
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-common</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 57 - 0
yudao-module-supplier/yudao-module-supplier-biz/pom.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>yudao-module-supplier</artifactId>
+        <groupId>cn.iocoder.boot</groupId>
+        <version>${revision}</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+
+    <artifactId>yudao-module-supplier-biz</artifactId>
+
+    <name>${project.artifactId}</name>
+    <description>
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-module-supplier-api</artifactId>
+            <version>${revision}</version>
+        </dependency>
+
+        <!-- Web 相关 -->
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-spring-boot-starter-security</artifactId>
+        </dependency>
+
+        <!-- DB 相关 -->
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-spring-boot-starter-mybatis</artifactId>
+        </dependency>
+
+        <!-- Test 测试相关 -->
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-spring-boot-starter-test</artifactId>
+        </dependency>
+
+        <!-- 工具类相关 -->
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-spring-boot-starter-excel</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 94 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/ProductCategoryController.java

@@ -0,0 +1,94 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategoryPageReqVO;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategoryRespVO;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategorySaveReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductCategoryDO;
+import cn.iocoder.yudao.module.supplier.service.product.ProductCategoryService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+
+@Tag(name = "管理后台 - 商品分类")
+@RestController
+@RequestMapping("/supplier/product-category")
+@Validated
+public class ProductCategoryController {
+
+    @Resource
+    private ProductCategoryService productCategoryService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建商品分类")
+    @PreAuthorize("@ss.hasPermission('supplier:product-category:create')")
+    public CommonResult<Long> createProductCategory(@Valid @RequestBody ProductCategorySaveReqVO createReqVO) {
+        return success(productCategoryService.createProductCategory(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新商品分类")
+    @PreAuthorize("@ss.hasPermission('supplier:product-category:update')")
+    public CommonResult<Boolean> updateProductCategory(@Valid @RequestBody ProductCategorySaveReqVO updateReqVO) {
+        productCategoryService.updateProductCategory(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除商品分类")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('supplier:product-category:delete')")
+    public CommonResult<Boolean> deleteProductCategory(@RequestParam("id") Long id) {
+        productCategoryService.deleteProductCategory(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得商品分类")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('supplier:product-category:query')")
+    public CommonResult<ProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) {
+        ProductCategoryDO productCategory = productCategoryService.getProductCategory(id);
+        return success(BeanUtils.toBean(productCategory, ProductCategoryRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得商品分类分页")
+    @PreAuthorize("@ss.hasPermission('supplier:product-category:query')")
+    public CommonResult<PageResult<ProductCategoryRespVO>> getProductCategoryPage(@Valid ProductCategoryPageReqVO pageReqVO) {
+        PageResult<ProductCategoryDO> pageResult = productCategoryService.getProductCategoryPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, ProductCategoryRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出商品分类 Excel")
+    @PreAuthorize("@ss.hasPermission('supplier:product-category:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportProductCategoryExcel(@Valid ProductCategoryPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<ProductCategoryDO> list = productCategoryService.getProductCategoryPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "商品分类.xls", "数据", ProductCategoryRespVO.class,
+                        BeanUtils.toBean(list, ProductCategoryRespVO.class));
+    }
+
+}

+ 95 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/ProductController.java

@@ -0,0 +1,95 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+
+import javax.validation.constraints.*;
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+
+
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.*;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductDO;
+import cn.iocoder.yudao.module.supplier.service.product.ProductService;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+
+@Tag(name = "管理后台 - 供应商产品")
+@RestController
+@RequestMapping("/supplier/product")
+@Validated
+public class ProductController {
+
+    @Resource
+    private ProductService productService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建供应商产品")
+    @PreAuthorize("@ss.hasPermission('supplier:product:create')")
+    public CommonResult<Long> createProduct(@Valid @RequestBody ProductSaveReqVO createReqVO) {
+        return success(productService.createProduct(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新供应商产品")
+    @PreAuthorize("@ss.hasPermission('supplier:product:update')")
+    public CommonResult<Boolean> updateProduct(@Valid @RequestBody ProductSaveReqVO updateReqVO) {
+        productService.updateProduct(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除供应商产品")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('supplier:product:delete')")
+    public CommonResult<Boolean> deleteProduct(@RequestParam("id") Long id) {
+        productService.deleteProduct(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得供应商产品")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('supplier:product:query')")
+    public CommonResult<ProductRespVO> getProduct(@RequestParam("id") Long id) {
+        ProductDO product = productService.getProduct(id);
+        return success(BeanUtils.toBean(product, ProductRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得供应商产品分页")
+    @PreAuthorize("@ss.hasPermission('supplier:product:query')")
+    public CommonResult<PageResult<ProductRespVO>> getProductPage(@Valid ProductPageReqVO pageReqVO) {
+        PageResult<ProductDO> pageResult = productService.getProductPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, ProductRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出供应商产品 Excel")
+    @PreAuthorize("@ss.hasPermission('supplier:product:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportProductExcel(@Valid ProductPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<ProductDO> list = productService.getProductPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "供应商产品.xls", "数据", ProductRespVO.class,
+                        BeanUtils.toBean(list, ProductRespVO.class));
+    }
+
+}

+ 37 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductCategoryPageReqVO.java

@@ -0,0 +1,37 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 商品分类分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductCategoryPageReqVO extends PageParam {
+
+    @Schema(description = "父分类编号", example = "10481")
+    private Long parentId;
+
+    @Schema(description = "分类名称", example = "赵六")
+    private String name;
+
+    @Schema(description = "移动端分类图", example = "https://www.iocoder.cn")
+    private String picUrl;
+
+    @Schema(description = "分类排序")
+    private Integer sort;
+
+    @Schema(description = "开启状态", example = "2")
+    private Integer status;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 43 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductCategoryRespVO.java

@@ -0,0 +1,43 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 商品分类 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ProductCategoryRespVO {
+
+    @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31217")
+    @ExcelProperty("分类编号")
+    private Long id;
+
+    @Schema(description = "父分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10481")
+    @ExcelProperty("父分类编号")
+    private Long parentId;
+
+    @Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    @ExcelProperty("分类名称")
+    private String name;
+
+    @Schema(description = "移动端分类图", example = "https://www.iocoder.cn")
+    @ExcelProperty("移动端分类图")
+    private String picUrl;
+
+    @Schema(description = "分类排序")
+    @ExcelProperty("分类排序")
+    private Integer sort;
+
+    @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @ExcelProperty("开启状态")
+    private Integer status;
+
+    @Schema(description = "创建时间")
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 33 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductCategorySaveReqVO.java

@@ -0,0 +1,33 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+
+@Schema(description = "管理后台 - 商品分类新增/修改 Request VO")
+@Data
+public class ProductCategorySaveReqVO {
+
+    @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31217")
+    private Long id;
+
+    @Schema(description = "父分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10481")
+    @NotNull(message = "父分类编号不能为空")
+    private Long parentId;
+
+    @Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    @NotEmpty(message = "分类名称不能为空")
+    private String name;
+
+    @Schema(description = "移动端分类图", example = "https://www.iocoder.cn")
+    private String picUrl;
+
+    @Schema(description = "分类排序")
+    private Integer sort;
+
+    @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @NotNull(message = "开启状态不能为空")
+    private Integer status;
+
+}

+ 40 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductPageReqVO.java

@@ -0,0 +1,40 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 供应商产品分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductPageReqVO extends PageParam {
+
+    @Schema(description = "产品名称", example = "李四")
+    private String name;
+
+    @Schema(description = "产品编码 自动生成")
+    private String productCode;
+
+    @Schema(description = "产品简介")
+    private String introduction;
+
+    @Schema(description = "产品分类编号", example = "7230")
+    private Long categoryId;
+
+    @Schema(description = "排序字段")
+    private Integer sort;
+
+    @Schema(description = "产品状态: 1 (开启) 0 (禁用)", example = "1")
+    private Integer status;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 47 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductRespVO.java

@@ -0,0 +1,47 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 供应商产品 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ProductRespVO {
+
+    @Schema(description = "主键 产品 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "14625")
+    @ExcelProperty("主键 产品 编号")
+    private Long id;
+
+    @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
+    @ExcelProperty("产品名称")
+    private String name;
+
+    @Schema(description = "产品编码 自动生成")
+    @ExcelProperty("产品编码 自动生成")
+    private String productCode;
+
+    @Schema(description = "产品简介")
+    @ExcelProperty("产品简介")
+    private String introduction;
+
+    @Schema(description = "产品分类编号", example = "7230")
+    @ExcelProperty("产品分类编号")
+    private Long categoryId;
+
+    @Schema(description = "排序字段")
+    @ExcelProperty("排序字段")
+    private Integer sort;
+
+    @Schema(description = "产品状态: 1 (开启) 0 (禁用)", example = "1")
+    @ExcelProperty("产品状态: 1 (开启) 0 (禁用)")
+    private Integer status;
+
+    @Schema(description = "创建时间")
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 34 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/controller/admin/product/vo/ProductSaveReqVO.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.supplier.controller.admin.product.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+
+@Schema(description = "管理后台 - 供应商产品新增/修改 Request VO")
+@Data
+public class ProductSaveReqVO {
+
+    @Schema(description = "主键 产品 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "14625")
+    private Long id;
+
+    @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
+    @NotEmpty(message = "产品名称不能为空")
+    private String name;
+
+    @Schema(description = "产品编码 自动生成")
+    private String productCode;
+
+    @Schema(description = "产品简介")
+    private String introduction;
+
+    @Schema(description = "产品分类编号", example = "7230")
+    private Long categoryId;
+
+    @Schema(description = "排序字段")
+    private Integer sort;
+
+    @Schema(description = "产品状态: 1 (开启) 0 (禁用)", example = "1")
+    private Integer status;
+
+}

+ 51 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/dataobject/product/ProductCategoryDO.java

@@ -0,0 +1,51 @@
+package cn.iocoder.yudao.module.supplier.dal.dataobject.product;
+
+import lombok.*;
+import java.util.*;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 商品分类 DO
+ *
+ * @author 芋道源码
+ */
+@TableName("supplier_product_category")
+@KeySequence("supplier_product_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ProductCategoryDO extends BaseDO {
+
+    /**
+     * 分类编号
+     */
+    @TableId
+    private Long id;
+    /**
+     * 父分类编号
+     */
+    private Long parentId;
+    /**
+     * 分类名称
+     */
+    private String name;
+    /**
+     * 移动端分类图
+     */
+    private String picUrl;
+    /**
+     * 分类排序
+     */
+    private Integer sort;
+    /**
+     * 开启状态
+     */
+    private Integer status;
+
+}

+ 55 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/dataobject/product/ProductDO.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.supplier.dal.dataobject.product;
+
+import lombok.*;
+import java.util.*;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 供应商产品 DO
+ *
+ * @author 芋道源码
+ */
+@TableName("supplier_product")
+@KeySequence("supplier_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ProductDO extends BaseDO {
+
+    /**
+     * 主键 产品 编号
+     */
+    @TableId
+    private Long id;
+    /**
+     * 产品名称
+     */
+    private String name;
+    /**
+     * 产品编码 自动生成
+     */
+    private String productCode;
+    /**
+     * 产品简介
+     */
+    private String introduction;
+    /**
+     * 产品分类编号
+     */
+    private Long categoryId;
+    /**
+     * 排序字段
+     */
+    private Integer sort;
+    /**
+     * 产品状态: 1 (开启) 0 (禁用)
+     */
+    private Integer status;
+
+}

+ 29 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/mysql/product/ProductCategoryMapper.java

@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.supplier.dal.mysql.product;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategoryPageReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductCategoryDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 商品分类 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface ProductCategoryMapper extends BaseMapperX<ProductCategoryDO> {
+
+    default PageResult<ProductCategoryDO> selectPage(ProductCategoryPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<ProductCategoryDO>()
+                .eqIfPresent(ProductCategoryDO::getParentId, reqVO.getParentId())
+                .likeIfPresent(ProductCategoryDO::getName, reqVO.getName())
+                .eqIfPresent(ProductCategoryDO::getPicUrl, reqVO.getPicUrl())
+                .eqIfPresent(ProductCategoryDO::getSort, reqVO.getSort())
+                .eqIfPresent(ProductCategoryDO::getStatus, reqVO.getStatus())
+                .betweenIfPresent(ProductCategoryDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(ProductCategoryDO::getId));
+    }
+
+}

+ 30 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/mysql/product/ProductMapper.java

@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.supplier.dal.mysql.product;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductPageReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 供应商产品 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface ProductMapper extends BaseMapperX<ProductDO> {
+
+    default PageResult<ProductDO> selectPage(ProductPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<ProductDO>()
+                .likeIfPresent(ProductDO::getName, reqVO.getName())
+                .eqIfPresent(ProductDO::getProductCode, reqVO.getProductCode())
+                .eqIfPresent(ProductDO::getIntroduction, reqVO.getIntroduction())
+                .eqIfPresent(ProductDO::getCategoryId, reqVO.getCategoryId())
+                .eqIfPresent(ProductDO::getSort, reqVO.getSort())
+                .eqIfPresent(ProductDO::getStatus, reqVO.getStatus())
+                .betweenIfPresent(ProductDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(ProductDO::getId));
+    }
+
+}

+ 56 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductCategoryService.java

@@ -0,0 +1,56 @@
+package cn.iocoder.yudao.module.supplier.service.product;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategoryPageReqVO;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategorySaveReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductCategoryDO;
+
+/**
+ * 商品分类 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface ProductCategoryService {
+
+    /**
+     * 创建商品分类
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createProductCategory(@Valid ProductCategorySaveReqVO createReqVO);
+
+    /**
+     * 更新商品分类
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateProductCategory(@Valid ProductCategorySaveReqVO updateReqVO);
+
+    /**
+     * 删除商品分类
+     *
+     * @param id 编号
+     */
+    void deleteProductCategory(Long id);
+
+    /**
+     * 获得商品分类
+     *
+     * @param id 编号
+     * @return 商品分类
+     */
+    ProductCategoryDO getProductCategory(Long id);
+
+    /**
+     * 获得商品分类分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 商品分类分页
+     */
+    PageResult<ProductCategoryDO> getProductCategoryPage(ProductCategoryPageReqVO pageReqVO);
+
+}

+ 71 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductCategoryServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.iocoder.yudao.module.supplier.service.product;
+
+import cn.iocoder.yudao.framework.common.exception.ErrorCode;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategoryPageReqVO;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductCategorySaveReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductCategoryDO;
+import cn.iocoder.yudao.module.supplier.dal.mysql.product.ProductCategoryMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+
+/**
+ * 商品分类 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class ProductCategoryServiceImpl implements ProductCategoryService {
+
+    @Resource
+    private ProductCategoryMapper productCategoryMapper;
+
+    @Override
+    public Long createProductCategory(ProductCategorySaveReqVO createReqVO) {
+        // 插入
+        ProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, ProductCategoryDO.class);
+        productCategoryMapper.insert(productCategory);
+        // 返回
+        return productCategory.getId();
+    }
+
+    @Override
+    public void updateProductCategory(ProductCategorySaveReqVO updateReqVO) {
+        // 校验存在
+        validateProductCategoryExists(updateReqVO.getId());
+        // 更新
+        ProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, ProductCategoryDO.class);
+        productCategoryMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteProductCategory(Long id) {
+        // 校验存在
+        validateProductCategoryExists(id);
+        // 删除
+        productCategoryMapper.deleteById(id);
+    }
+
+    private void validateProductCategoryExists(Long id) {
+        if (productCategoryMapper.selectById(id) == null) {
+            throw exception(new ErrorCode(1_020_009_000, "产品分类不存在"));
+        }
+    }
+
+    @Override
+    public ProductCategoryDO getProductCategory(Long id) {
+        return productCategoryMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<ProductCategoryDO> getProductCategoryPage(ProductCategoryPageReqVO pageReqVO) {
+        return productCategoryMapper.selectPage(pageReqVO);
+    }
+
+}

+ 55 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductService.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.supplier.service.product;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductPageReqVO;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductSaveReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductDO;
+
+import javax.validation.Valid;
+
+/**
+ * 供应商产品 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface ProductService {
+
+    /**
+     * 创建供应商产品
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createProduct(@Valid ProductSaveReqVO createReqVO);
+
+    /**
+     * 更新供应商产品
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateProduct(@Valid ProductSaveReqVO updateReqVO);
+
+    /**
+     * 删除供应商产品
+     *
+     * @param id 编号
+     */
+    void deleteProduct(Long id);
+
+    /**
+     * 获得供应商产品
+     *
+     * @param id 编号
+     * @return 供应商产品
+     */
+    ProductDO getProduct(Long id);
+
+    /**
+     * 获得供应商产品分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 供应商产品分页
+     */
+    PageResult<ProductDO> getProductPage(ProductPageReqVO pageReqVO);
+
+}

+ 71 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/ProductServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.iocoder.yudao.module.supplier.service.product;
+
+import cn.iocoder.yudao.framework.common.exception.ErrorCode;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductPageReqVO;
+import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.ProductSaveReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.ProductDO;
+import cn.iocoder.yudao.module.supplier.dal.mysql.product.ProductMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+
+/**
+ * 供应商产品 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class ProductServiceImpl implements ProductService {
+
+    @Resource
+    private ProductMapper productMapper;
+
+    @Override
+    public Long createProduct(ProductSaveReqVO createReqVO) {
+        // 插入
+        ProductDO product = BeanUtils.toBean(createReqVO, ProductDO.class);
+        productMapper.insert(product);
+        // 返回
+        return product.getId();
+    }
+
+    @Override
+    public void updateProduct(ProductSaveReqVO updateReqVO) {
+        // 校验存在
+        validateProductExists(updateReqVO.getId());
+        // 更新
+        ProductDO updateObj = BeanUtils.toBean(updateReqVO, ProductDO.class);
+        productMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteProduct(Long id) {
+        // 校验存在
+        validateProductExists(id);
+        // 删除
+        productMapper.deleteById(id);
+    }
+
+    private void validateProductExists(Long id) {
+        if (productMapper.selectById(id) == null) {
+            throw exception(new ErrorCode(1_020_009_000, "产品分类不存在"));
+        }
+    }
+
+    @Override
+    public ProductDO getProduct(Long id) {
+        return productMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<ProductDO> getProductPage(ProductPageReqVO pageReqVO) {
+        return productMapper.selectPage(pageReqVO);
+    }
+
+}

+ 10 - 1
yudao-server/pom.xml

@@ -51,13 +51,22 @@
             <artifactId>yudao-module-bpm-biz</artifactId>
             <version>${revision}</version>
         </dependency>
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-module-supplier-biz</artifactId>
+            <version>${revision}</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-module-supplier-biz</artifactId>
+            <version>${revision}</version>
+        </dependency>
         <!-- 支付服务。默认注释,保证编译速度 -->
 <!--        <dependency>-->
 <!--            <groupId>cn.iocoder.boot</groupId>-->
 <!--            <artifactId>yudao-module-pay-biz</artifactId>-->
 <!--            <version>${revision}</version>-->
 <!--        </dependency>-->
-
         <!-- 微信公众号模块。默认注释,保证编译速度 -->
 <!--        <dependency>-->
 <!--            <groupId>cn.iocoder.boot</groupId>-->