dev798
parent
db90cee6ce
commit
29fd6aaf4c
|
@ -109,4 +109,5 @@ public class Result<T> implements Serializable {
|
|||
return Result.SUCCESS == ret.getCode();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @author A3385
|
||||
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "Price", description = "价格信息")
|
||||
public class Price extends BaseEntity {
|
||||
|
||||
@ApiModelProperty(value = "价格ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "价格最大值")
|
||||
private Double priceMax;
|
||||
|
||||
@ApiModelProperty(value = "价格减免")
|
||||
private Double priceReduction;
|
||||
}
|
|
@ -1,71 +1,108 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.math.BigDecimal;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品对象 t_product
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/26 14:39
|
||||
* @author A3385
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_product")
|
||||
@ApiModel(value = "product", description = "商品对象")
|
||||
public class Product extends HashMap {
|
||||
@ApiModel(description = "产品实体类")
|
||||
public class Product extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(name = "商品类型ID",value = "商品类型ID")
|
||||
@Excel(name = "商品类型ID")
|
||||
private Long productClassifyId;
|
||||
|
||||
@ApiModelProperty(name = "商品名称",value = "商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
@NotBlank(message = "商品名称不能为空")
|
||||
@ApiModelProperty(value = "名称")
|
||||
@NotEmpty(message = "名称不能为空")
|
||||
private String productName;
|
||||
|
||||
@ApiModelProperty(name = "副标题",value = "副标题")
|
||||
@Excel(name = "副标题")
|
||||
private String productSubhead;
|
||||
@ApiModelProperty(value = "货号")
|
||||
@NotNull(message = "货号不能为空")
|
||||
private Integer productNumber;
|
||||
|
||||
@ApiModelProperty(name = "商品品牌ID",value = "商品品牌ID")
|
||||
@Excel(name = "商品品牌ID")
|
||||
private Long productBrandId;
|
||||
@ApiModelProperty(value = "审核状态 (1:通过, 2:驳回)")
|
||||
private Integer productExamine;
|
||||
|
||||
@ApiModelProperty(name = "商品介绍",value = "商品介绍")
|
||||
@Excel(name = "商品介绍")
|
||||
private String productIntroduce;
|
||||
@ApiModelProperty(value = "品牌")
|
||||
@NotNull(message = "品牌不能不选择")
|
||||
private Integer brandId;
|
||||
|
||||
@ApiModelProperty(name = "商品货号",value = "商品货号")
|
||||
@Excel(name = "商品货号")
|
||||
private Long productNo;
|
||||
@ApiModelProperty(value = "商品类型")
|
||||
@NotNull(message = "商品类型不能不选择")
|
||||
private Integer typeId;
|
||||
|
||||
@ApiModelProperty(name = "计量单位",value = "计量单位")
|
||||
@Excel(name = "计量单位")
|
||||
@ApiModelProperty(value = "副标题")
|
||||
private String productSubheading;
|
||||
|
||||
@ApiModelProperty(value = "商品介绍")
|
||||
private String productInformation;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String productUnit;
|
||||
|
||||
@ApiModelProperty(name = "商品重量",value = "商品重量")
|
||||
@Excel(name = "商品重量")
|
||||
private BigDecimal productWeight;
|
||||
@ApiModelProperty(value = "重量")
|
||||
private Double productWeight;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private String productSort;
|
||||
|
||||
@ApiModelProperty(value = "促销表id")
|
||||
private Integer promotionId;
|
||||
|
||||
@ApiModelProperty(value = "积分")
|
||||
private Integer productPoints;
|
||||
|
||||
@ApiModelProperty(value = "成长值")
|
||||
private Integer productGrowth;
|
||||
|
||||
@ApiModelProperty(value = "最大积分值")
|
||||
private Integer productMaxPoints;
|
||||
|
||||
@ApiModelProperty(value = "预告商品 (1:是, 2:否)")
|
||||
private Integer productForeknow;
|
||||
|
||||
@ApiModelProperty(value = "上下架状态 (1:上架, 2:下架)")
|
||||
private Integer productStatus;
|
||||
|
||||
@ApiModelProperty(value = "新品 (1:是, 2:否)")
|
||||
private Integer productNew;
|
||||
|
||||
@ApiModelProperty(value = "推荐 (1:是, 2:否)")
|
||||
private Integer productRecommended;
|
||||
|
||||
@ApiModelProperty(value = "详情标题")
|
||||
private String detailsTitle;
|
||||
|
||||
@ApiModelProperty(value = "详情描述")
|
||||
private String detailsInformation;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String detailsKeyWord;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String detailsRemark;
|
||||
|
||||
@ApiModelProperty(value = "优惠方法")
|
||||
@NotNull(message = "优惠方式不能不选择")
|
||||
private Integer methodType;
|
||||
|
||||
@ApiModelProperty(value = "优惠Id")
|
||||
private Integer methodId;
|
||||
|
||||
@ApiModelProperty(value = "移动端信息")
|
||||
private String moveInformation;
|
||||
|
||||
@ApiModelProperty(value = "PC端信息")
|
||||
private String pcInformation;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
|
||||
import com.muyu.product.domain.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author A3385
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel(value = "ProductReq", description = "商品添加接收信息")
|
||||
public class ProductReq extends HashMap {
|
||||
|
||||
@ApiModelProperty(value = "商品")
|
||||
@Valid
|
||||
private Product product;
|
||||
@ApiModelProperty(value = "商品图片列表")
|
||||
private List<String> productImages;
|
||||
|
||||
@ApiModelProperty(value = "商品Sku集合")
|
||||
private List<ProductSku> productSkus;
|
||||
|
||||
@ApiModelProperty(value = "服务id")
|
||||
private List<Integer> serviceIds;
|
||||
|
||||
@ApiModelProperty(value = "阶梯优惠")
|
||||
@Valid
|
||||
private Ladder ladder;
|
||||
|
||||
@ApiModelProperty(value = "会员信息")
|
||||
@Valid
|
||||
private Member member;
|
||||
|
||||
@ApiModelProperty(value = "优惠信息")
|
||||
@Valid
|
||||
private Preference preference;
|
||||
|
||||
@ApiModelProperty(value = "价格信息")
|
||||
@Valid
|
||||
private Price price;
|
||||
|
||||
@ApiModelProperty(value = "分页参数")
|
||||
private Integer pageNum = 1;
|
||||
|
||||
@ApiModelProperty(value = "分页参数")
|
||||
private Integer pageSize = 10;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package com.muyu.product.domain.util;
|
||||
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 响应信息主体
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class R<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 成功 */
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
|
||||
/** 失败 */
|
||||
public static final int FAIL = Constants.FAIL;
|
||||
|
||||
private int code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
|
||||
public static <T> R<T> ok()
|
||||
{
|
||||
return restResult(null, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data)
|
||||
{
|
||||
return restResult(data, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data, String msg)
|
||||
{
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail()
|
||||
{
|
||||
return restResult(null, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(String msg)
|
||||
{
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data)
|
||||
{
|
||||
return restResult(data, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data, String msg)
|
||||
{
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(int code, String msg)
|
||||
{
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> R<T> restResult(T data, int code, String msg)
|
||||
{
|
||||
R<T> apiResult = new R<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> Boolean isError(R<T> ret)
|
||||
{
|
||||
return !isSuccess(ret);
|
||||
}
|
||||
|
||||
public static <T> Boolean isSuccess(R<T> ret)
|
||||
{
|
||||
return R.SUCCESS == ret.getCode();
|
||||
}
|
||||
}
|
|
@ -1,17 +1,15 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.product.domain.Product;
|
||||
import com.muyu.product.domain.req.ProductReq;
|
||||
import com.muyu.product.domain.util.R;
|
||||
import com.muyu.product.service.ProductService;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 商品Controller
|
||||
|
@ -26,4 +24,17 @@ public class ProductController {
|
|||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
|
||||
/**
|
||||
* 商品基本信息插入
|
||||
*/
|
||||
@ApiOperation("添加商品")
|
||||
@PostMapping("/productInsert")
|
||||
public R<Product> productInsert(@Valid @RequestBody ProductReq productReq){
|
||||
productService.productInsert(productReq);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.product.domain.ProductSku;
|
||||
import com.muyu.product.service.ProductSkuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
@ -15,5 +20,4 @@ public class ProductSkuAttrController {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/27 19:47
|
||||
*/
|
||||
public class ProductSkuController {
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.product.handel;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/27 20:08
|
||||
*/
|
||||
public class ValidationResult {
|
||||
|
||||
private boolean isValid;
|
||||
private String errorMessage;
|
||||
|
||||
public ValidationResult(boolean isValid, String errorMessage) {
|
||||
this.isValid = isValid;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,8 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.product.domain.Product;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/26 19:49
|
||||
|
@ -15,4 +12,7 @@ import java.util.List;
|
|||
public interface ProductMapper {
|
||||
|
||||
|
||||
Integer findProductNumber(Product product);
|
||||
|
||||
void insertProcuduct(Product product);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import com.muyu.product.domain.ProductSku;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/27 19:48
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductSkuMapper {
|
||||
|
||||
|
||||
Integer findSkuId(List<ProductSku> productSkus);
|
||||
}
|
|
@ -1,18 +1,16 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.product.domain.Product;
|
||||
import com.muyu.product.mapper.ProductMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.product.domain.req.ProductReq;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/26 19:49
|
||||
*/
|
||||
|
||||
public interface ProductService {
|
||||
|
||||
|
||||
|
||||
void productInsert(ProductReq productReq);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/27 19:47
|
||||
*/
|
||||
public interface ProductSkuService {
|
||||
}
|
|
@ -1,26 +1,120 @@
|
|||
package com.muyu.product.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.product.domain.Product;
|
||||
import com.muyu.product.domain.req.ProductReq;
|
||||
import com.muyu.product.handel.ValidationResult;
|
||||
import com.muyu.product.mapper.ProductMapper;
|
||||
import com.muyu.product.mapper.ProductSkuMapper;
|
||||
import com.muyu.product.service.ProductService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/26 19:49
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class ProductServiceImpl implements ProductService {
|
||||
|
||||
private final Integer min = 0 ;
|
||||
|
||||
private final Integer max = 5 ;
|
||||
|
||||
@Autowired
|
||||
private ProductMapper productMapper;
|
||||
|
||||
@Autowired
|
||||
private ProductSkuMapper productSkuMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void checkProductParams(ProductReq productReq) {
|
||||
CompletableFuture<ValidationResult>methodTypeFuture =
|
||||
CompletableFuture.supplyAsync(() -> checkMethodType(productReq));
|
||||
CompletableFuture<ValidationResult> skuIdFuture =
|
||||
CompletableFuture.supplyAsync(() -> findSkuId(productReq));
|
||||
CompletableFuture<ValidationResult> productNumberFuture =
|
||||
CompletableFuture.supplyAsync(() -> checkProductNumber(productReq));
|
||||
CompletableFuture<String> allValidFuture =
|
||||
methodTypeFuture.thenCombine(skuIdFuture,
|
||||
(methodTypeResult, skuIdResult) ->
|
||||
methodTypeResult.isValid() && skuIdResult.isValid())
|
||||
.thenCombine(productNumberFuture, (previousResult, productNumberResult)
|
||||
-> previousResult && productNumberResult.isValid())
|
||||
.thenApply(allValid -> allValid ? "所有检查通过" : "存在检查未通过")
|
||||
.exceptionally(throwable -> "校验过程发生异常: " + throwable.getMessage());
|
||||
|
||||
allValidFuture.thenAccept(System.out::println);
|
||||
}
|
||||
|
||||
private ValidationResult checkProductNumber(ProductReq productReq) {
|
||||
Integer productNumber = productMapper.findProductNumber(productReq.getProduct());
|
||||
if(productNumber==null){
|
||||
return new ValidationResult(false, "产品编号不存在");
|
||||
}
|
||||
return new ValidationResult(true,"通过");
|
||||
}
|
||||
|
||||
private ValidationResult findSkuId(ProductReq productReq) {
|
||||
Integer skuId= productSkuMapper.findSkuId(productReq.getProductSkus());
|
||||
if(skuId>=Integer.valueOf(String.valueOf(skuId>0))){
|
||||
return new ValidationResult(false,"skuID不能重复");
|
||||
}
|
||||
return new ValidationResult(true,"通过");
|
||||
}
|
||||
|
||||
private ValidationResult checkMethodType(ProductReq productReq) {
|
||||
if(productReq.getProduct().getMethodType()==null){
|
||||
return new ValidationResult(false, "不能为空");
|
||||
}
|
||||
return new ValidationResult(true,"通过");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void productInsert(ProductReq productReq) {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
//异步推送审核字段是否合格
|
||||
checkProductParams(productReq);
|
||||
//添加商品
|
||||
insertProduct(productReq.getProduct());
|
||||
//添加服务中间表
|
||||
insertProductService(productReq);
|
||||
//添加优惠
|
||||
insertProductPromotion(productReq);
|
||||
//保存sku
|
||||
//TODO
|
||||
insertProductSku(productReq);
|
||||
//计算优惠值
|
||||
//TODO
|
||||
//calculateProductPrice(productReq);
|
||||
log.info("耗时:{}",(System.currentTimeMillis()-start));
|
||||
|
||||
}
|
||||
|
||||
private void insertProductSku(ProductReq productReq) {
|
||||
|
||||
}
|
||||
|
||||
private void insertProductPromotion(ProductReq productReq) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void insertProductService(ProductReq productReq) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void insertProduct(Product product) {
|
||||
productMapper.insertProcuduct(product);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.product.service.impl;
|
||||
|
||||
import com.muyu.product.service.ProductSkuService;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/3/27 19:47
|
||||
*/
|
||||
@Service
|
||||
public class ProductSkuServiceImpl implements ProductSkuService {
|
||||
}
|
|
@ -1,27 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.product.mapper.ProductMapper">
|
||||
|
||||
<resultMap type="com.muyu.product.domain.Product" id="ProductResult">
|
||||
<resultMap type="com.muyu.product.domain.Product" id="ProductResultMap">
|
||||
<id property="id" column="id" />
|
||||
<result property="productClassifyId" column="product_classify_id" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="productSubhead" column="product_subhead" />
|
||||
<result property="productBrandId" column="product_brand_id" />
|
||||
<result property="productIntroduce" column="product_introduce" />
|
||||
<result property="productNo" column="product_no" />
|
||||
<result property="productNumber" column="product_number" />
|
||||
<result property="productExamine" column="product_examine" />
|
||||
<result property="brandId" column="brand_id" />
|
||||
<result property="typeId" column="type_id" />
|
||||
<result property="productSubheading" column="product_subheading" />
|
||||
<result property="productInformation" column="product_information" />
|
||||
<result property="productUnit" column="product_unit" />
|
||||
<result property="productWeight" column="product_weight" />
|
||||
<result property="productSort" column="product_sort" />
|
||||
<result property="promotionId" column="promotion_id" />
|
||||
<result property="productPoints" column="product_points" />
|
||||
<result property="productGrowth" column="product_growth" />
|
||||
<result property="productMaxPoints" column="product_max_points" />
|
||||
<result property="productForeknow" column="product_foreknow" />
|
||||
<result property="productStatus" column="product_status" />
|
||||
<result property="productNew" column="product_new" />
|
||||
<result property="productRecommended" column="product_recommended" />
|
||||
<result property="detailsTitle" column="details_title" />
|
||||
<result property="detailsInformation" column="details_information" />
|
||||
<result property="detailsKeyWord" column="details_key_word" />
|
||||
<result property="detailsRemark" column="details_remark" />
|
||||
<result property="methodType" column="method_type" />
|
||||
<result property="methodId" column="method_id" />
|
||||
<result property="moveInformation" column="move_information" />
|
||||
<result property="pcInformation" column="pc_information" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertProcuduct">
|
||||
|
||||
</insert>
|
||||
|
||||
<select id="selectProductById" resultMap="ProductResultMap">
|
||||
SELECT id, product_name, product_number, product_examine, brand_id, type_id, product_subheading,
|
||||
product_information, product_unit, product_weight, product_sort, promotion_id, product_points,
|
||||
product_growth, product_max_points, product_foreknow, product_status, product_new, product_recommended,
|
||||
details_title, details_information, details_key_word, details_remark, method_type, method_id,
|
||||
move_information, pc_information
|
||||
FROM product_table
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
<select id="findProductNumber" resultType="java.lang.Integer">
|
||||
|
||||
<select id="selectProduct" resultType="com.muyu.product.domain.Product">
|
||||
select id, product_classify_id, product_name, product_subhead, product_brand_id, product_introduce, product_no, product_unit, product_weight from t_product
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 添加其他操作方法如插入、更新、删除等 -->
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?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.muyu.product.mapper.ProductSkuMapper">
|
||||
|
||||
<resultMap type="com.muyu.product.domain.ProductSku" id="ProductSkuResult" extends="com.muyu.common.core.web.domain.BaseEntity">
|
||||
<id property="id" column="id" />
|
||||
<result property="salePrice" column="sale_price" />
|
||||
<result property="promotionPrice" column="promotion_price" />
|
||||
<result property="stock" column="stock" />
|
||||
<result property="stockAlert" column="stock_alert" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="bgImg" column="bg_img" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertProductSku" parameterType="com.muyu.product.domain.ProductSku" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO t_product_sku (sale_price, promotion_price, stock, stock_alert, product_id, bg_img, is_delete)
|
||||
VALUES (#{salePrice}, #{promotionPrice}, #{stock}, #{stockAlert}, #{productId}, #{bgImg}, #{isDelete})
|
||||
</insert>
|
||||
|
||||
<update id="updateProductSku" parameterType="com.muyu.product.domain.ProductSku">
|
||||
UPDATE t_product_sku
|
||||
<set>
|
||||
<if test="salePrice != null">sale_price = #{salePrice},</if>
|
||||
<if test="promotionPrice != null">promotion_price = #{promotionPrice},</if>
|
||||
<if test="stock != null">stock = #{stock},</if>
|
||||
<if test="stockAlert != null">stock_alert = #{stockAlert},</if>
|
||||
<if test="productId != null">product_id = #{productId},</if>
|
||||
<if test="bgImg != null">bg_img = #{bgImg},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteProductSkuById">
|
||||
DELETE FROM t_product_sku WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectProductSkuById" resultType="com.muyu.product.domain.ProductSku">
|
||||
SELECT id, sale_price, promotion_price, stock, stock_alert, product_id, bg_img, is_delete FROM t_product_sku WHERE id = #{id}
|
||||
</select>
|
||||
<select id="findSkuId" resultType="java.lang.Integer">
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue