master
parent
735273d69f
commit
f34e555bf6
|
@ -0,0 +1,33 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
|
@ -0,0 +1,123 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-product</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>ruoyi-product</name>
|
||||
<description>ruoyi-product商品管理模块</description>
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- RuoYi Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.ruoyi.product.RuoyiProductApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,160 @@
|
|||
package com.ruoyi.product;
|
||||
|
||||
import com.ruoyi.common.core.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.exception.DemoModeException;
|
||||
import com.ruoyi.common.core.exception.InnerAuthException;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.exception.auth.NotPermissionException;
|
||||
import com.ruoyi.common.core.exception.auth.NotRoleException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.MissingPathVariableException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
/**
|
||||
* 权限码异常
|
||||
*/
|
||||
@ExceptionHandler(NotPermissionException.class)
|
||||
public AjaxResult handleNotPermissionException(NotPermissionException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',权限码校验失败'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.FORBIDDEN, "没有访问权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色权限异常
|
||||
*/
|
||||
@ExceptionHandler(NotRoleException.class)
|
||||
public AjaxResult handleNotRoleException(NotRoleException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',角色权限校验失败'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.FORBIDDEN, "没有访问权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求方式不支持
|
||||
*/
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod());
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
@ExceptionHandler(ServiceException.class)
|
||||
public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
Integer code = e.getCode();
|
||||
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求路径中缺少必需的路径变量
|
||||
*/
|
||||
@ExceptionHandler(MissingPathVariableException.class)
|
||||
public AjaxResult handleMissingPathVariableException(MissingPathVariableException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求路径中缺少必需的路径变量'{}',发生系统异常.", requestURI, e);
|
||||
return AjaxResult.error(String.format("请求路径中缺少必需的路径变量[%s]", e.getVariableName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求参数类型不匹配
|
||||
*/
|
||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||
public AjaxResult handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求参数类型不匹配'{}',发生系统异常.", requestURI, e);
|
||||
return AjaxResult.error(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), e.getRequiredType().getName(), e.getValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拦截未知的运行时异常
|
||||
*/
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统异常
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public AjaxResult handleException(Exception e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生系统异常.", requestURI, e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义验证异常
|
||||
*/
|
||||
@ExceptionHandler(BindException.class)
|
||||
public AjaxResult handleBindException(BindException e)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
String message = e.getAllErrors().get(0).getDefaultMessage();
|
||||
return AjaxResult.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义验证异常
|
||||
*/
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
String message = e.getBindingResult().getFieldError().getDefaultMessage();
|
||||
return AjaxResult.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部认证异常
|
||||
*/
|
||||
@ExceptionHandler(InnerAuthException.class)
|
||||
public AjaxResult handleInnerAuthException(InnerAuthException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示模式异常
|
||||
*/
|
||||
@ExceptionHandler(DemoModeException.class)
|
||||
public AjaxResult handleDemoModeException(DemoModeException e)
|
||||
{
|
||||
return AjaxResult.error("演示模式,不允许操作");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.ruoyi.product;
|
||||
|
||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
public class RuoyiProductApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RuoyiProductApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.product.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.product.domain.req.BrandReq;
|
||||
import com.ruoyi.product.service.BrandService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ClassName BrandController
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 20:55
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/brand")
|
||||
@Api(tags = "品牌信息")
|
||||
public class BrandController {
|
||||
|
||||
@Autowired
|
||||
private BrandService brandService;
|
||||
|
||||
|
||||
@PostMapping("/brandInsert")
|
||||
public R<BrandReq>brandInsert(@RequestBody BrandReq brandReq){
|
||||
brandService.brandInsert(brandReq);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.product.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.product.domain.req.ProductClassifyReq;
|
||||
import com.ruoyi.product.service.ProductClassFyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ClassName ProductClassiFy
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/27 20:37
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/productClassFy")
|
||||
@Api(tags = "商品分类")
|
||||
public class ProductClassFyController {
|
||||
|
||||
@Autowired
|
||||
private ProductClassFyService productClassFyService;
|
||||
|
||||
|
||||
@PostMapping("/productClassFyInsert")
|
||||
@ApiOperation("添加商品分类")
|
||||
public R productClassFyInsert(@RequestBody ProductClassifyReq productClassifyReq){
|
||||
productClassFyService.productClassFyInsert(productClassifyReq);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.ruoyi.product.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.product.domain.req.ProductReq;
|
||||
import com.ruoyi.product.service.ProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.math3.stat.descriptive.summary.Product;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ClassName ProductController
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 19:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/product")
|
||||
@Api(tags = "商品管理")
|
||||
public class ProductController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("商品信息添加")
|
||||
public R save(@RequestBody ProductReq productReq){
|
||||
productService.save(productReq);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.ruoyi.product.domain.favorable;
|
||||
|
||||
public enum PreferentialType {
|
||||
|
||||
NO_PROMOTION(0,"无优惠"),
|
||||
|
||||
USE_PROMOTION_PRICE(1, "使用促销价"),
|
||||
|
||||
USE_MEMBER_PRICE(2,"会员价"),
|
||||
|
||||
USE_STEP_PRICE(3,"阶梯价格"),
|
||||
|
||||
USE_DISCOUNT_PRICE(4,"满减价格");
|
||||
|
||||
|
||||
private Integer code;
|
||||
|
||||
|
||||
private String description;
|
||||
|
||||
|
||||
PreferentialType(Integer code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public static PreferentialType valueOf(Integer code){
|
||||
for (PreferentialType type : values()) {
|
||||
if (type.code == code) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid PreferentialType code: " + code);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName BrandReq
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 21:01
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "品牌信息实体类")
|
||||
public class BrandReq {
|
||||
|
||||
@ApiModelProperty(value = "品牌id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "品牌名称")
|
||||
private String brandName;
|
||||
|
||||
@ApiModelProperty(value = "品牌首字母")
|
||||
private String brandFirstLetter;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private int sort;
|
||||
|
||||
@ApiModelProperty(value = "品牌制造商 0-是 1-否")
|
||||
private int brandManufacturer;
|
||||
|
||||
@ApiModelProperty(value = "品牌故事")
|
||||
private String brandStory;
|
||||
|
||||
@ApiModelProperty(value = "品牌logo")
|
||||
private String brandLogo;
|
||||
|
||||
@ApiModelProperty(value = "品牌专区大图")
|
||||
private String brandSpecialArea;
|
||||
|
||||
@ApiModelProperty(value = "是否显示 0-显示 1-不显示")
|
||||
private int isShow;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName FullSubtractionReq
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:14
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "满减价格实体类")
|
||||
public class FullSubtractionReq {
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "满多少钱")
|
||||
private double fullPrice;
|
||||
|
||||
@ApiModelProperty(value = "立减多少钱")
|
||||
private double subtractionPrice;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private int shopId;
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName MemberReq
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:23
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "会员类型实体类")
|
||||
public class MemberReq{
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "会员类型名称")
|
||||
private String memberName;
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName ProductBrandReq
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:26
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "商品品牌实体类")
|
||||
public class ProductBrandReq{
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "品牌名称")
|
||||
private String brandName;
|
||||
|
||||
@ApiModelProperty(value = "品牌首字母")
|
||||
private String brandFirstLetter;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private int sort;
|
||||
|
||||
@ApiModelProperty(value = "品牌制造商 0-是 1-否")
|
||||
private int brandManufacturer;
|
||||
|
||||
@ApiModelProperty(value = "品牌故事")
|
||||
private String brandStory;
|
||||
|
||||
@ApiModelProperty(value = "品牌logo")
|
||||
private String brandLogo;
|
||||
|
||||
@ApiModelProperty(value = "品牌专区大图")
|
||||
private String brandSpecialArea;
|
||||
|
||||
@ApiModelProperty(value = "是否显示 0-显示 1-不显示")
|
||||
private int isShow;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName ProductClassifyReq
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:28
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "商品分类表")
|
||||
public class ProductClassifyReq {
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String classifyName;
|
||||
|
||||
@ApiModelProperty(value = "分类级别")
|
||||
private String classifyLevel;
|
||||
|
||||
@ApiModelProperty(value = "数量单位")
|
||||
private String classifyUnit;
|
||||
|
||||
@ApiModelProperty(value = "导航栏 0-显示 1-不显示")
|
||||
private String classifyNavigation;
|
||||
|
||||
@ApiModelProperty(value = "是否显示 0-显示 1-不显示")
|
||||
private String isShow;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private String sort;
|
||||
|
||||
@ApiModelProperty(value = "父级ID")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty(value = "分类图标")
|
||||
private String classifyIco;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName ProductGuaranteeLink
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:35
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "商品服务保证关联实体类")
|
||||
public class ProductGuaranteeLinkReq {
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private int productId;
|
||||
|
||||
@ApiModelProperty(value = "服务保证ID")
|
||||
private int serviceGuarantee;
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName ProductImg
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:39
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "商品图片表")
|
||||
public class ProductImg {
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Integer productId;
|
||||
|
||||
@ApiModelProperty(value = "商品图片")
|
||||
private String imgUrl;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "商品表")
|
||||
public class ProductReq{
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "商品类型ID")
|
||||
@NotNull(message = "商品类型不能为空")
|
||||
private Integer productClassifyId;
|
||||
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
@NotBlank(message = "商品名称不能为空")
|
||||
private String productName;
|
||||
|
||||
@ApiModelProperty(value = "副标题")
|
||||
@NotBlank(message = "商品副标题不能为空")
|
||||
private String productSubhead;
|
||||
|
||||
@ApiModelProperty(value = "商品品牌ID")
|
||||
private Integer productBrandId;
|
||||
|
||||
@ApiModelProperty(value = "商品介绍")
|
||||
private String productIntroduce;
|
||||
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
@NotNull(message = "商品货号不能为空")
|
||||
private Long productNo;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String productUnit;
|
||||
|
||||
@ApiModelProperty(value = "商品重量")
|
||||
private Double productWeight;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer productSort;
|
||||
|
||||
@ApiModelProperty(value = "赠送积分")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@ApiModelProperty(value = "赠送成长值")
|
||||
private Integer bonusGrowth;
|
||||
|
||||
@ApiModelProperty(value = "积分购买限制")
|
||||
private Integer pointsPurchase;
|
||||
|
||||
@ApiModelProperty(value = "预告商品 0-是 1-否")
|
||||
private Integer isAdvance;
|
||||
|
||||
@ApiModelProperty(value = "是否上架 0-是 1-否")
|
||||
private Integer isPutaway;
|
||||
|
||||
@ApiModelProperty(value = "是否新品 0-是 1-否")
|
||||
private Integer isNew;
|
||||
|
||||
@ApiModelProperty(value = "是否推荐 0-是 1-否")
|
||||
private Integer isRecommend;
|
||||
|
||||
@ApiModelProperty(value = "详细页标题")
|
||||
@NotBlank(message = "详细页标题不能为空")
|
||||
private String detailTitle;
|
||||
|
||||
@ApiModelProperty(value = "详细页描述")
|
||||
@NotBlank(message = "描述不能为空")
|
||||
private String detailDescribe;
|
||||
|
||||
@ApiModelProperty(value = "商品关键字")
|
||||
private String detailKey;
|
||||
|
||||
@ApiModelProperty(value = "商品备注")
|
||||
private String detailRemark;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "优惠方式类型,0,1,2,3")
|
||||
private Integer offersType;
|
||||
|
||||
@ApiModelProperty(value = "会员价格,当offersType为xxx时传")
|
||||
private ShopMemberReq shopMemberReq;
|
||||
|
||||
@ApiModelProperty(value = "满减价格,当offersType为xxx时传")
|
||||
private FullSubtractionReq fullSubtractionReq;
|
||||
|
||||
@ApiModelProperty(value = "阶梯价格,当offersType为xxx时传")
|
||||
private ShopLadderReq shopLadderReq;
|
||||
|
||||
@ApiModelProperty(value = "特惠促销,当offersType为xxx时传")
|
||||
private SpecialOffersReq specialOffersReq;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "优惠ID")
|
||||
private Integer offersId;
|
||||
|
||||
@ApiModelProperty(value = "商品分类ID")
|
||||
private Integer productTypeId;
|
||||
|
||||
@ApiModelProperty(value = "商品详情PC端")
|
||||
private String pcProductDetail;
|
||||
|
||||
@ApiModelProperty(value = "商品详情移动端")
|
||||
private String mobileProductDetail;
|
||||
|
||||
@ApiModelProperty(value = "服务保证")
|
||||
private List<Integer>serviceGuaranteeList;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "商品相册")
|
||||
@NotEmpty(message = "商品相册不能为空")
|
||||
private List<String>productImg;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName ShopLadderReq
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:09
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "阶梯价格实体类")
|
||||
public class ShopLadderReq {
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "阶梯数量")
|
||||
private int ladderNum;
|
||||
|
||||
@ApiModelProperty(value = "阶梯折扣")
|
||||
private int ladderDiscount;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private int shopId;
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @ClassName ShopMember
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:12
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "会员价格表")
|
||||
public class ShopMemberReq {
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "会员类型ID")
|
||||
private Integer memberTypeId;
|
||||
|
||||
@ApiModelProperty(value = "优惠价格")
|
||||
private BigDecimal offersPrice;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Integer shopId;
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.product.domain.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.ProductMetadata;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialOffers
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 15:07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "特惠促销实体类")
|
||||
public class SpecialOffersReq{
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
@ApiModelProperty(value = "优惠价格")
|
||||
private double offersPrice;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.product.domain.req.BrandReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName BrandMapper
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 21:06
|
||||
*/
|
||||
@Mapper
|
||||
public interface BrandMapper {
|
||||
void brandInsert(BrandReq brandReq);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.product.domain.req.ProductClassifyReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName ProductClassFyMapper
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/27 20:38
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductClassFyMapper {
|
||||
void productClassFyInsert(ProductClassifyReq productClassifyReq);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.ruoyi.product.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @ClassName ProductMapper
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 19:07
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductMapper {
|
||||
|
||||
Integer selectClassById(@Param("classifyId") Integer classifyId);
|
||||
|
||||
String selectByProductName(@Param("productName") String productName);
|
||||
|
||||
String selectDetailDescribe(@Param("detailDescribe") String detailDescribe);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.product.domain.req.ProductReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName SaveMapper
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 20:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface SaveMapper {
|
||||
void save(ProductReq productReq);
|
||||
|
||||
void bachProduct(ProductReq productReq1);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.product.domain.req.BrandReq;
|
||||
|
||||
/**
|
||||
* @ClassName BrandService
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 20:56
|
||||
*/
|
||||
public interface BrandService {
|
||||
void brandInsert(BrandReq brandReq);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.product.domain.req.ProductClassifyReq;
|
||||
|
||||
/**
|
||||
* @ClassName ProductClassFyService
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/27 20:38
|
||||
*/
|
||||
public interface ProductClassFyService {
|
||||
void productClassFyInsert(ProductClassifyReq productClassifyReq);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.product.domain.req.ProductReq;
|
||||
|
||||
/**
|
||||
* @ClassName ProductService
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 19:07
|
||||
*/
|
||||
public interface ProductService {
|
||||
void save(ProductReq productReq);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import com.ruoyi.product.domain.req.BrandReq;
|
||||
import com.ruoyi.product.mapper.BrandMapper;
|
||||
import com.ruoyi.product.service.BrandService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ClassName BrandServiceImpl
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 20:56
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BrandServiceImpl implements BrandService {
|
||||
|
||||
@Autowired
|
||||
private BrandMapper brandMapper;
|
||||
@Override
|
||||
public void brandInsert(BrandReq brandReq) {
|
||||
|
||||
brandMapper.brandInsert(brandReq);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import com.ruoyi.product.domain.req.ProductClassifyReq;
|
||||
import com.ruoyi.product.mapper.ProductClassFyMapper;
|
||||
import com.ruoyi.product.service.ProductClassFyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ClassName ProductClassFyServiceImpl
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/27 20:38
|
||||
*/
|
||||
@Service
|
||||
public class ProductClassFyServiceImpl implements ProductClassFyService {
|
||||
|
||||
@Autowired
|
||||
private ProductClassFyMapper productClassFyMapper;
|
||||
@Override
|
||||
public void productClassFyInsert(ProductClassifyReq productClassifyReq) {
|
||||
|
||||
productClassFyMapper.productClassFyInsert(productClassifyReq);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.product.domain.favorable.PreferentialType;
|
||||
import com.ruoyi.product.domain.req.ProductReq;
|
||||
import com.ruoyi.product.domain.req.SpecialOffersReq;
|
||||
import com.ruoyi.product.mapper.ProductMapper;
|
||||
import com.ruoyi.product.mapper.SaveMapper;
|
||||
import com.ruoyi.product.service.ProductService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ProductServiceImpl
|
||||
* @Description 描述
|
||||
* @Author YunXiang.Li
|
||||
* @Date 2024/3/26 19:08
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProductServiceImpl implements ProductService {
|
||||
@Autowired
|
||||
private ProductMapper productMapper;
|
||||
|
||||
@Autowired
|
||||
private SaveMapper saveMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ProductReq productReq) {
|
||||
|
||||
//参数校验
|
||||
ParameterCheck(productReq);
|
||||
|
||||
saveMapper.save(productReq);
|
||||
|
||||
|
||||
ArrayList<ProductReq> reqs = new ArrayList<>();
|
||||
|
||||
reqs.forEach(productReq1 -> {
|
||||
productReq1.setProductName(productReq.getProductName());
|
||||
productReq1.setProductClassifyId(productReq.getProductClassifyId());
|
||||
productReq1.setProductSubhead(productReq.getProductSubhead());
|
||||
|
||||
saveMapper.bachProduct(productReq1);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ParameterCheck(ProductReq productReq) {
|
||||
|
||||
//校验类型是否存在
|
||||
Integer classifyId = productReq.getProductClassifyId();
|
||||
//去数据库搜索商品类型id是否存在
|
||||
Integer count=productMapper.selectClassById(classifyId);
|
||||
if(count==0){
|
||||
log.info("id不存在:{}",classifyId);
|
||||
throw new ServiceException("商品类型id不存在");
|
||||
}
|
||||
|
||||
//校验商品名称是否存在
|
||||
String productName = productReq.getProductName();
|
||||
//数据库查询商品名称
|
||||
String name=productMapper.selectByProductName(productName);
|
||||
if(name==null){
|
||||
log.info("商品名称不存在:{}",productName);
|
||||
}
|
||||
|
||||
//校验详细页标题
|
||||
String detailDescribe = productReq.getDetailDescribe();
|
||||
//查询详细页标题是否存在
|
||||
String describe=productMapper.selectDetailDescribe(detailDescribe);
|
||||
if(describe==null){
|
||||
log.info("详细页标题不存在:{}",detailDescribe);
|
||||
}
|
||||
|
||||
//校验商品副标题
|
||||
String productSubhead = productReq.getProductSubhead();
|
||||
if(productSubhead!=null||"".equals(productSubhead)){
|
||||
log.info("商品副标题:{}",productSubhead+"不能为空");
|
||||
}
|
||||
|
||||
//校验商品货号
|
||||
Long productNo = productReq.getProductNo();
|
||||
|
||||
if(productNo==null){
|
||||
log.info("商品货号:{}",productNo+"不能为空");
|
||||
}
|
||||
|
||||
//校验商品相册
|
||||
List<String> productImg = productReq.getProductImg();
|
||||
//查询相册是否存在
|
||||
if(productImg==null){
|
||||
log.info("相册不存在:{}",productImg);
|
||||
}
|
||||
|
||||
if(PreferentialType.NO_PROMOTION.getCode()==productReq.getOffersType()){
|
||||
|
||||
SpecialOffersReq specialOffersReq = productReq.getSpecialOffersReq();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
_ _
|
||||
(_) | |
|
||||
_ __ _ _ ___ _ _ _ ______ ___ _ _ ___ | |_ ___ _ __ ___
|
||||
| '__|| | | | / _ \ | | | || ||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \
|
||||
| | | |_| || (_) || |_| || | \__ \| |_| |\__ \| |_ | __/| | | | | |
|
||||
|_| \__,_| \___/ \__, ||_| |___/ \__, ||___/ \__| \___||_| |_| |_|
|
||||
__/ | __/ |
|
||||
|___/ |___/
|
|
@ -0,0 +1,28 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9203
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
application:
|
||||
# 应用名称
|
||||
name: ruoyi-product
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 122.51.27.196:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 122.51.27.196:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/ruoyi-system" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.BrandMapper">
|
||||
|
||||
<insert id="brandInsert">
|
||||
INSERT INTO `commodity_management`.`t_product_brand`
|
||||
(`brand_name`, `brand_first_letter`, `sort`, `brand_manufacturer`, `brand_story`,
|
||||
`brand_logo`,
|
||||
`brand_special_area`, `is_show`)
|
||||
VALUES
|
||||
( #{brandName}, #{brandFirstLetter}, 0, #{brandManufacturer}, #{brandStory},
|
||||
#{brandLogo}, #{brandSpecialArea}, 0)
|
||||
|
||||
</insert>
|
||||
</mapper>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.ProductClassFyMapper">
|
||||
|
||||
<insert id="productClassFyInsert">
|
||||
INSERT INTO `commodity_management`.`t_product_classify`
|
||||
( `classify_name`, `classify_level`, `classify_unit`, `classify_navigation`,
|
||||
`is_show`, `sort`, `parent_id`, `classify_ico`)
|
||||
VALUES ( #{classifyName}, #{classifyLevel}, #{classifyUnit}, 0, #{isShow}, #{sort}, #{parentId}, #{classifyIco})
|
||||
|
||||
</insert>
|
||||
</mapper>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.ProductMapper">
|
||||
|
||||
|
||||
<select id="selectClassById" resultType="java.lang.Integer">
|
||||
select product_classify_id from t_product where product_classify_id=#{classifyId}
|
||||
</select>
|
||||
|
||||
<select id="selectByProductName" resultType="java.lang.String">
|
||||
select product_name from t_product where product_name=#{productName}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectDetailDescribe" resultType="java.lang.String">
|
||||
select detail_describe from t_product where detail_describe=#{detailDescribe}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.SaveMapper">
|
||||
<insert id="save">
|
||||
INSERT INTO `commodity_management`.`t_product`
|
||||
(`product_classify_id`, `product_name`, `product_subhead`,
|
||||
`product_brand_id`, `product_introduce`, `product_no`,
|
||||
`product_unit`, `product_weight`, `product_sort`,
|
||||
`bonus_points`, `bonus_growth`, `points_purchase`,
|
||||
`is_advance`, `is_putaway`, `is_new`, `is_recommend`,
|
||||
`detail_title`, `detail_describe`, `detail_key`,
|
||||
`detail_remark`, `offers_type`, `offers_id`, `create_time`,
|
||||
`update_time`, `is_delete`, `create_by`, `product_type_id`,
|
||||
`pc_product_detail`, `mobile_product_detail`, `product_img`)
|
||||
VALUES
|
||||
( #{productClassifyId}, #{productName}, #{productSubhead},
|
||||
#{productBrandId}, #{productIntroduce}, #{productNo},
|
||||
#{productUnit}, #{productWeight}, 0,
|
||||
0, 0, 0,
|
||||
#{isAdvance}, #{isPutaway}, #{isNew},
|
||||
#{isRecommend}, #{detailTitle}, #{detailDescribe},
|
||||
#{detailKey}, #{detailRemark}, #{offersType},
|
||||
#{offersId}, now(), now(),
|
||||
0, 1, #{productTypeId},
|
||||
#{pcProductDetail}, #{mobileProductDetail}, #{productImg})
|
||||
|
||||
</insert>
|
||||
<insert id="bachProduct" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO `commodity_management`.`t_product`
|
||||
(`product_classify_id`, `product_name`, `product_subhead`,
|
||||
`product_brand_id`, `product_introduce`, `product_no`,
|
||||
`product_unit`, `product_weight`, `product_sort`,
|
||||
`bonus_points`, `bonus_growth`, `points_purchase`,
|
||||
`is_advance`, `is_putaway`, `is_new`, `is_recommend`,
|
||||
`detail_title`, `detail_describe`, `detail_key`,
|
||||
`detail_remark`, `offers_type`, `offers_id`, `create_time`,
|
||||
`update_time`, `is_delete`, `create_by`, `product_type_id`,
|
||||
`pc_product_detail`, `mobile_product_detail`, `product_img`)
|
||||
VALUES
|
||||
<foreach collection="product" item="product" separator=",">
|
||||
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
|
@ -8,76 +8,81 @@
|
|||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<artifactId>ruoyi-modules-system</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-modules-system系统模块
|
||||
</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- RuoYi Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- RuoYi Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- RuoYi Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -96,5 +101,5 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -3,7 +3,7 @@ server:
|
|||
port: 9201
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: ruoyi-system
|
||||
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 122.51.27.196:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 122.51.27.196:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue