初始化1
commit
c812b7db04
|
@ -0,0 +1,47 @@
|
|||
######################################################################
|
||||
# Build Tools
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/*
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
target/
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
*.xml.versionsBackup
|
||||
*.swp
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
|
@ -0,0 +1,37 @@
|
|||
<?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>bawei-mall-product</artifactId>
|
||||
<groupId>com.bawei</groupId>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bawei-mall-product-cache</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<!--
|
||||
隐藏维护缓存
|
||||
不隐藏维护缓存
|
||||
-->
|
||||
<dependencies>
|
||||
<!-- 系统微服务基准 -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-common-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 远程调用 -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-mall-product-remote</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,177 @@
|
|||
package com.bawei.mall.product.cache;
|
||||
|
||||
import com.bawei.cache.annotation.CacheRole;
|
||||
import com.bawei.cache.db.BaseDatabaseCache;
|
||||
import com.bawei.common.core.domain.R;
|
||||
import com.bawei.common.core.exception.ServiceException;
|
||||
import com.bawei.common.core.utils.SpringUtils;
|
||||
import com.bawei.common.core.utils.StringUtils;
|
||||
import com.bawei.common.core.utils.reflect.ReflectUtils;
|
||||
import com.bawei.common.redis.service.RedisService;
|
||||
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
|
||||
import com.bawei.mall.product.remote.RemoteProductInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品缓存
|
||||
* @Date 2022-10-19 上午 08:59
|
||||
*/
|
||||
@Component
|
||||
public class ProductInfoCache implements BaseDatabaseCache<Long, ProductDetailsResponse> {
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger log = LoggerFactory.getLogger(ProductInfoCache.class);
|
||||
|
||||
private static final String keyPre = "product:info:";
|
||||
|
||||
/**
|
||||
* 缓存判断是否在本服务的依据
|
||||
* 如果为null则表示不在本服务
|
||||
* 如果有值,则表示在本服务
|
||||
*/
|
||||
private static Class<?> clazz = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
clazz = Class.forName("com.bawei.mall.product.service.impl.MallProductInfoServiceImpl");
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.info("缓存启动,不是在本服务当中");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品的业务层
|
||||
*/
|
||||
private Object productInfoService;
|
||||
|
||||
private Object getProductInfoService(){
|
||||
if (productInfoService == null){
|
||||
productInfoService = SpringUtils.getBean(clazz);
|
||||
}
|
||||
return productInfoService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存对象
|
||||
*/
|
||||
private final RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private RemoteProductInfo remoteProductInfo;
|
||||
|
||||
public ProductInfoCache (RedisService redisService) {
|
||||
this.redisService = redisService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据ID拼接缓存key
|
||||
* @param key 数据Id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getKey (Long key) {
|
||||
if (key == null){
|
||||
throw new ServiceException("商品缓存key非法");
|
||||
}
|
||||
return keyPre + key.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储缓存
|
||||
* @param key 键
|
||||
* @param val 值
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@CacheRole(serverName = "mall-product")
|
||||
public boolean put (Long key, ProductDetailsResponse val) {
|
||||
try {
|
||||
redisService.setCacheObject(getKey(key), val);
|
||||
}catch (Exception e){
|
||||
log.error("商品缓存存储异常key:[{}],val:[{}]", key , val , e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@CacheRole(serverName = "mall-product")
|
||||
public boolean remove (Long key) {
|
||||
log.info("删除数据:[{}]", getKey(key));
|
||||
return redisService.deleteObject(getKey(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ProductDetailsResponse get (Long key) {
|
||||
ProductDetailsResponse productDetailsResponse = redisService.getCacheObject(getKey(key));
|
||||
// 如果为 空则需要去数据库去数据
|
||||
if (productDetailsResponse == null){
|
||||
productDetailsResponse = this.getData(key);
|
||||
// 防止击穿
|
||||
this.put(key,productDetailsResponse == null ?
|
||||
new ProductDetailsResponse() : productDetailsResponse);
|
||||
}
|
||||
return productDetailsResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作缓存 一定有两种情况 !!!
|
||||
* 缓存在本服务
|
||||
* 缓存在其他服务
|
||||
* @param key 数据ID
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@CacheRole(serverName = "mall-product")
|
||||
public ProductDetailsResponse getData (Long key) {
|
||||
// 如果clazz是空的话,表示我需要走的feign调用
|
||||
// 如果clazz不是空的话,我是不是需要走本服务
|
||||
if (clazz != null){
|
||||
Object productInfoService = getProductInfoService();
|
||||
if (productInfoService == null){
|
||||
log.error("商品缓存获取失败key:[{}]",key);
|
||||
throw new ServiceException(StringUtils.format("商品缓存获取失败key:[{}]",key));
|
||||
}
|
||||
ProductDetailsResponse productDetailsResponse = ReflectUtils.invokeMethodByName(productInfoService,
|
||||
"selectProductDetailsById",
|
||||
new Object[]{key});
|
||||
log.info("商品缓存,从数据库获取信息成功key:[{}],val:[{}]", key, productDetailsResponse);
|
||||
return productDetailsResponse;
|
||||
}else {
|
||||
R<ProductDetailsResponse> productResponse = remoteProductInfo.getProductResponse(key);
|
||||
if (productResponse.isError()){
|
||||
log.error("商品缓存,远程调用获取信息失败key:[{}],调用结果:[{}]", key, productResponse);
|
||||
return null;
|
||||
}
|
||||
log.info("商品缓存,远程调用获取信息成功key:[{}],val:[{}]", key, productResponse.getData());
|
||||
return productResponse.getData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新缓存
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@CacheRole(serverName = "mall-product")
|
||||
public boolean refreshData (Long key) {
|
||||
return this.put(key, this.getData(key));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?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>bawei-mall-product</artifactId>
|
||||
<groupId>com.bawei</groupId>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bawei-mall-product-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 项目公共核心依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,123 @@
|
|||
package com.bawei.mall.product.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品品牌对象 mall_product_brand_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-15
|
||||
*/
|
||||
public class MallProductBrandInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 品牌名称 */
|
||||
@Excel(name = "品牌名称")
|
||||
private String name;
|
||||
|
||||
/** 品牌描述 */
|
||||
@Excel(name = "品牌描述")
|
||||
private String productDesc;
|
||||
|
||||
/** 品牌介绍 */
|
||||
private String content;
|
||||
|
||||
/** 品牌logo */
|
||||
@Excel(name = "品牌logo")
|
||||
private String logo;
|
||||
|
||||
/** 品牌状态 */
|
||||
@Excel(name = "品牌状态")
|
||||
private String status;
|
||||
|
||||
/** 乐观锁 */
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setProductDesc(String productDesc)
|
||||
{
|
||||
this.productDesc = productDesc;
|
||||
}
|
||||
|
||||
public String getProductDesc()
|
||||
{
|
||||
return productDesc;
|
||||
}
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
public void setLogo(String logo)
|
||||
{
|
||||
this.logo = logo;
|
||||
}
|
||||
|
||||
public String getLogo()
|
||||
{
|
||||
return logo;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("productDesc", getProductDesc())
|
||||
.append("content", getContent())
|
||||
.append("logo", getLogo())
|
||||
.append("status", getStatus())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,239 @@
|
|||
package com.bawei.mall.product.domain;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品信息对象 mall_product_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
public class MallProductInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
@ApiParam("ID自增")
|
||||
private Long id;
|
||||
|
||||
/** 商品名称 */
|
||||
@Excel(name = "商品名称")
|
||||
@ApiParam("商品名称")
|
||||
private String name;
|
||||
|
||||
/** 商品描述 */
|
||||
@Excel(name = "商品描述")
|
||||
private String productDesc;
|
||||
|
||||
/** 商品类型 */
|
||||
@Excel(name = "商品类型")
|
||||
private String type;
|
||||
|
||||
/** 冗余字段 */
|
||||
@Excel(name = "冗余字段")
|
||||
private String typeIds;
|
||||
|
||||
/** 商品主图 */
|
||||
@Excel(name = "商品主图")
|
||||
private String img;
|
||||
|
||||
/** 商品轮播图 */
|
||||
@Excel(name = "商品轮播图")
|
||||
private String carouselImages;
|
||||
|
||||
/** 商品评论数 */
|
||||
@Excel(name = "商品评论数")
|
||||
private Long commentCount;
|
||||
|
||||
/** 商品收藏人气 */
|
||||
@Excel(name = "商品收藏人气")
|
||||
private Long collectCount;
|
||||
|
||||
/** 品牌信息 */
|
||||
@Excel(name = "品牌信息")
|
||||
private String brand;
|
||||
|
||||
/** 商品状态 */
|
||||
@Excel(name = "商品状态")
|
||||
private String status;
|
||||
|
||||
/** 单位 */
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
/** 搜索关键字 */
|
||||
@Excel(name = "搜索关键字")
|
||||
private String keywords;
|
||||
|
||||
/** 规格信息 */
|
||||
@Excel(name = "规格信息")
|
||||
private Long ruleId;
|
||||
|
||||
/** 乐观锁 */
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setProductDesc(String productDesc)
|
||||
{
|
||||
this.productDesc = productDesc;
|
||||
}
|
||||
|
||||
public String getProductDesc()
|
||||
{
|
||||
return productDesc;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setTypeIds(String typeIds)
|
||||
{
|
||||
this.typeIds = typeIds;
|
||||
}
|
||||
|
||||
public String getTypeIds()
|
||||
{
|
||||
return typeIds;
|
||||
}
|
||||
public void setImg(String img)
|
||||
{
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getImg()
|
||||
{
|
||||
return img;
|
||||
}
|
||||
public void setCarouselImages(String carouselImages)
|
||||
{
|
||||
this.carouselImages = carouselImages;
|
||||
}
|
||||
|
||||
public String getCarouselImages()
|
||||
{
|
||||
return carouselImages;
|
||||
}
|
||||
public void setCommentCount(Long commentCount)
|
||||
{
|
||||
this.commentCount = commentCount;
|
||||
}
|
||||
|
||||
public Long getCommentCount()
|
||||
{
|
||||
return commentCount;
|
||||
}
|
||||
public void setCollectCount(Long collectCount)
|
||||
{
|
||||
this.collectCount = collectCount;
|
||||
}
|
||||
|
||||
public Long getCollectCount()
|
||||
{
|
||||
return collectCount;
|
||||
}
|
||||
public void setBrand(String brand)
|
||||
{
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getBrand()
|
||||
{
|
||||
return brand;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setUnit(String unit)
|
||||
{
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getUnit()
|
||||
{
|
||||
return unit;
|
||||
}
|
||||
public void setKeywords(String keywords)
|
||||
{
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
public String getKeywords()
|
||||
{
|
||||
return keywords;
|
||||
}
|
||||
public void setRuleId(Long ruleId)
|
||||
{
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public Long getRuleId()
|
||||
{
|
||||
return ruleId;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("productDesc", getProductDesc())
|
||||
.append("type", getType())
|
||||
.append("typeIds", getTypeIds())
|
||||
.append("img", getImg())
|
||||
.append("carouselImages", getCarouselImages())
|
||||
.append("commentCount", getCommentCount())
|
||||
.append("collectCount", getCollectCount())
|
||||
.append("brand", getBrand())
|
||||
.append("status", getStatus())
|
||||
.append("unit", getUnit())
|
||||
.append("keywords", getKeywords())
|
||||
.append("ruleId", getRuleId())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
package com.bawei.mall.product.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品评价对象 mall_product_review_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-26
|
||||
*/
|
||||
public class MallProductReviewInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 商品名称 */
|
||||
@Excel(name = "商品名称")
|
||||
private Long productId;
|
||||
|
||||
/** 商品SKU */
|
||||
@Excel(name = "商品SKU")
|
||||
private Long productSkuId;
|
||||
|
||||
/** 商品评价图片 */
|
||||
@Excel(name = "商品评价图片")
|
||||
private String reviewImages;
|
||||
|
||||
/** 商品评价信息 */
|
||||
@Excel(name = "商品评价信息")
|
||||
private String content;
|
||||
|
||||
/** 评论分数 */
|
||||
@Excel(name = "评论分数")
|
||||
private BigDecimal start;
|
||||
|
||||
/** 是否隐藏 */
|
||||
@Excel(name = "是否隐藏")
|
||||
private String isDispaly;
|
||||
|
||||
/** 是否删除 */
|
||||
@Excel(name = "是否删除")
|
||||
private String isDel;
|
||||
|
||||
/** 乐观锁 */
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductSkuId(Long productSkuId)
|
||||
{
|
||||
this.productSkuId = productSkuId;
|
||||
}
|
||||
|
||||
public Long getProductSkuId()
|
||||
{
|
||||
return productSkuId;
|
||||
}
|
||||
public void setReviewImages(String reviewImages)
|
||||
{
|
||||
this.reviewImages = reviewImages;
|
||||
}
|
||||
|
||||
public String getReviewImages()
|
||||
{
|
||||
return reviewImages;
|
||||
}
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
public void setStart(BigDecimal start)
|
||||
{
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public BigDecimal getStart()
|
||||
{
|
||||
return start;
|
||||
}
|
||||
public void setIsDispaly(String isDispaly)
|
||||
{
|
||||
this.isDispaly = isDispaly;
|
||||
}
|
||||
|
||||
public String getIsDispaly()
|
||||
{
|
||||
return isDispaly;
|
||||
}
|
||||
public void setIsDel(String isDel)
|
||||
{
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public String getIsDel()
|
||||
{
|
||||
return isDel;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("productId", getProductId())
|
||||
.append("productSkuId", getProductSkuId())
|
||||
.append("reviewImages", getReviewImages())
|
||||
.append("content", getContent())
|
||||
.append("start", getStart())
|
||||
.append("isDispaly", getIsDispaly())
|
||||
.append("isDel", getIsDel())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.bawei.mall.product.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品规格详情对象 mall_product_rule_attr_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public class MallProductRuleAttrInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 规格 */
|
||||
@Excel(name = "规格")
|
||||
private Long ruleId;
|
||||
|
||||
/** 类目名称 */
|
||||
@Excel(name = "类目名称")
|
||||
private String name;
|
||||
|
||||
/** 规格值 */
|
||||
@Excel(name = "规格值")
|
||||
private String attrValue;
|
||||
|
||||
/** 乐观锁 */
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setRuleId(Long ruleId)
|
||||
{
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public Long getRuleId()
|
||||
{
|
||||
return ruleId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setAttrValue(String attrValue)
|
||||
{
|
||||
this.attrValue = attrValue;
|
||||
}
|
||||
|
||||
public String getAttrValue()
|
||||
{
|
||||
return attrValue;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("ruleId", getRuleId())
|
||||
.append("name", getName())
|
||||
.append("attrValue", getAttrValue())
|
||||
.append("revision", getRevision())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.bawei.mall.product.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品规格对象 mall_product_rule_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public class MallProductRuleInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 规格名称 */
|
||||
@Excel(name = "规格名称")
|
||||
private String name;
|
||||
|
||||
/** 规格详情 */
|
||||
@Excel(name = "规格详情")
|
||||
private String ruleAttr;
|
||||
|
||||
/** 规格状态 */
|
||||
@Excel(name = "规格状态")
|
||||
private String status;
|
||||
|
||||
/** 乐观锁 */
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setRuleAttr(String ruleAttr)
|
||||
{
|
||||
this.ruleAttr = ruleAttr;
|
||||
}
|
||||
|
||||
public String getRuleAttr()
|
||||
{
|
||||
return ruleAttr;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("ruleAttr", getRuleAttr())
|
||||
.append("status", getStatus())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package com.bawei.mall.product.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品SKU对象 mall_product_sku_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
public class MallProductSkuInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 商品信息 */
|
||||
@Excel(name = "商品信息")
|
||||
private Long productId;
|
||||
|
||||
/** 商品规格 */
|
||||
@Excel(name = "商品规格")
|
||||
private String sku;
|
||||
|
||||
/** 商品库存 */
|
||||
@Excel(name = "商品库存")
|
||||
private Long stock;
|
||||
|
||||
/** 商品价格 */
|
||||
@Excel(name = "商品价格")
|
||||
private BigDecimal price;
|
||||
|
||||
/** 商品进价 */
|
||||
@Excel(name = "商品进价")
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
/** 商品售价 */
|
||||
@Excel(name = "商品售价")
|
||||
private BigDecimal sellingPrice;
|
||||
|
||||
/** 规格图片 */
|
||||
@Excel(name = "规格图片")
|
||||
private String image;
|
||||
|
||||
/** 编号 */
|
||||
@Excel(name = "编号")
|
||||
private String number;
|
||||
|
||||
/** 重量 */
|
||||
@Excel(name = "重量")
|
||||
private BigDecimal weight;
|
||||
|
||||
/** 体积 */
|
||||
@Excel(name = "体积")
|
||||
private BigDecimal volume;
|
||||
|
||||
/** 乐观锁 */
|
||||
@Excel(name = "乐观锁")
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setSku(String sku)
|
||||
{
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getSku()
|
||||
{
|
||||
return sku;
|
||||
}
|
||||
public void setStock(Long stock)
|
||||
{
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
public Long getStock()
|
||||
{
|
||||
return stock;
|
||||
}
|
||||
public void setPrice(BigDecimal price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
public void setPurchasePrice(BigDecimal purchasePrice)
|
||||
{
|
||||
this.purchasePrice = purchasePrice;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchasePrice()
|
||||
{
|
||||
return purchasePrice;
|
||||
}
|
||||
public void setSellingPrice(BigDecimal sellingPrice)
|
||||
{
|
||||
this.sellingPrice = sellingPrice;
|
||||
}
|
||||
|
||||
public BigDecimal getSellingPrice()
|
||||
{
|
||||
return sellingPrice;
|
||||
}
|
||||
public void setImage(String image)
|
||||
{
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public String getImage()
|
||||
{
|
||||
return image;
|
||||
}
|
||||
public void setNumber(String number)
|
||||
{
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getNumber()
|
||||
{
|
||||
return number;
|
||||
}
|
||||
public void setWeight(BigDecimal weight)
|
||||
{
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight()
|
||||
{
|
||||
return weight;
|
||||
}
|
||||
public void setVolume(BigDecimal volume)
|
||||
{
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public BigDecimal getVolume()
|
||||
{
|
||||
return volume;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("productId", getProductId())
|
||||
.append("sku", getSku())
|
||||
.append("stock", getStock())
|
||||
.append("price", getPrice())
|
||||
.append("purchasePrice", getPurchasePrice())
|
||||
.append("sellingPrice", getSellingPrice())
|
||||
.append("image", getImage())
|
||||
.append("number", getNumber())
|
||||
.append("weight", getWeight())
|
||||
.append("volume", getVolume())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.bawei.mall.product.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.TreeEntity;
|
||||
|
||||
/**
|
||||
* 商品类型对象 mall_product_type_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public class MallProductTypeInfo extends TreeEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 类型名称 */
|
||||
@Excel(name = "类型名称")
|
||||
private String name;
|
||||
|
||||
/** 类型图片 */
|
||||
@Excel(name = "类型图片")
|
||||
private String image;
|
||||
|
||||
/** 类型状态 */
|
||||
@Excel(name = "类型状态")
|
||||
private String status;
|
||||
|
||||
/** 类型排序 */
|
||||
@Excel(name = "类型排序")
|
||||
private Long orderBy;
|
||||
|
||||
/** 乐观锁 */
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setImage(String image)
|
||||
{
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public String getImage()
|
||||
{
|
||||
return image;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setOrderBy(Long orderBy)
|
||||
{
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public Long getOrderBy()
|
||||
{
|
||||
return orderBy;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("image", getImage())
|
||||
.append("status", getStatus())
|
||||
.append("orderBy", getOrderBy())
|
||||
.append("parentId", getParentId())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
package com.bawei.mall.product.domain.model;
|
||||
|
||||
import com.bawei.common.core.annotation.Excel;
|
||||
import com.bawei.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品详情 - 基本信息
|
||||
* @Date 2022-10-18 下午 01:57
|
||||
*/
|
||||
public class ProductModel extends BaseEntity {
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 商品名称 */
|
||||
private String name;
|
||||
|
||||
/** 商品描述 */
|
||||
private String productDesc;
|
||||
|
||||
/** 商品类型 */
|
||||
private String type;
|
||||
private String typeName;
|
||||
|
||||
/** 冗余字段 */
|
||||
private String typeIds;
|
||||
|
||||
/** 商品主图 */
|
||||
private String img;
|
||||
|
||||
/** 商品轮播图 */
|
||||
private String carouselImages;
|
||||
|
||||
/** 商品评论数 */
|
||||
private Long commentCount;
|
||||
|
||||
/** 商品收藏人气 */
|
||||
private Long collectCount;
|
||||
|
||||
/** 品牌信息 */
|
||||
private String brand;
|
||||
private String brandName;
|
||||
|
||||
/** 商品状态 */
|
||||
private String status;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 搜索关键字 */
|
||||
private String keywords;
|
||||
|
||||
/** 规格信息 */
|
||||
private Long ruleId;
|
||||
|
||||
public Long getId () {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId (Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName () {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName (String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProductDesc () {
|
||||
return productDesc;
|
||||
}
|
||||
|
||||
public void setProductDesc (String productDesc) {
|
||||
this.productDesc = productDesc;
|
||||
}
|
||||
|
||||
public String getType () {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType (String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTypeName () {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName (String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public String getTypeIds () {
|
||||
return typeIds;
|
||||
}
|
||||
|
||||
public void setTypeIds (String typeIds) {
|
||||
this.typeIds = typeIds;
|
||||
}
|
||||
|
||||
public String getImg () {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg (String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getCarouselImages () {
|
||||
return carouselImages;
|
||||
}
|
||||
|
||||
public void setCarouselImages (String carouselImages) {
|
||||
this.carouselImages = carouselImages;
|
||||
}
|
||||
|
||||
public Long getCommentCount () {
|
||||
return commentCount;
|
||||
}
|
||||
|
||||
public void setCommentCount (Long commentCount) {
|
||||
this.commentCount = commentCount;
|
||||
}
|
||||
|
||||
public Long getCollectCount () {
|
||||
return collectCount;
|
||||
}
|
||||
|
||||
public void setCollectCount (Long collectCount) {
|
||||
this.collectCount = collectCount;
|
||||
}
|
||||
|
||||
public String getBrand () {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand (String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getBrandName () {
|
||||
return brandName;
|
||||
}
|
||||
|
||||
public void setBrandName (String brandName) {
|
||||
this.brandName = brandName;
|
||||
}
|
||||
|
||||
public String getStatus () {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus (String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getUnit () {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit (String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getKeywords () {
|
||||
return keywords;
|
||||
}
|
||||
|
||||
public void setKeywords (String keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
public Long getRuleId () {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId (Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.bawei.mall.product.domain.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格类型详情模型
|
||||
* @Date 2022-9-17 上午 09:28
|
||||
*/
|
||||
public class RuleAttrModel {
|
||||
|
||||
private String ruleType;
|
||||
|
||||
private List<String> ruleAttrList;
|
||||
|
||||
private String ruleAttrStr;
|
||||
|
||||
public String getRuleType () {
|
||||
return ruleType;
|
||||
}
|
||||
|
||||
public void setRuleType (String ruleType) {
|
||||
this.ruleType = ruleType;
|
||||
}
|
||||
|
||||
public List<String> getRuleAttrList () {
|
||||
return ruleAttrList;
|
||||
}
|
||||
|
||||
public void setRuleAttrList (List<String> ruleAttrList) {
|
||||
this.ruleAttrList = ruleAttrList;
|
||||
if (this.ruleAttrList != null){
|
||||
this.ruleAttrStr = this.ruleAttrList.stream().collect(Collectors.joining(","));
|
||||
}
|
||||
}
|
||||
|
||||
public String getRuleAttrStr () {
|
||||
return ruleAttrStr;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.bawei.mall.product.domain.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格模型
|
||||
* @Date 2022-9-17 上午 09:33
|
||||
*/
|
||||
public class RuleModel {
|
||||
|
||||
private Long ruleId;
|
||||
|
||||
private List<RuleAttrModel> ruleList;
|
||||
|
||||
public Long getRuleId () {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId (Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public List<RuleAttrModel> getRuleList () {
|
||||
return ruleList;
|
||||
}
|
||||
|
||||
public void setRuleList (List<RuleAttrModel> ruleList) {
|
||||
this.ruleList = ruleList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.bawei.mall.product.domain.model;
|
||||
|
||||
import com.bawei.common.core.exception.ServiceException;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 批量添加sku
|
||||
* @Date 2022-9-24 上午 10:23
|
||||
*/
|
||||
public class SkuModel {
|
||||
|
||||
private Long productId;
|
||||
|
||||
private List<MallProductSkuInfo> skuInfoList;
|
||||
|
||||
private SkuModel () {
|
||||
}
|
||||
|
||||
private SkuModel (Long productId, List<MallProductSkuInfo> skuInfoList) {
|
||||
this.productId = productId;
|
||||
this.skuInfoList = skuInfoList;
|
||||
}
|
||||
|
||||
public static SkuModel builderSkuModel(Long productId, List<MallProductSkuInfo> skuInfoList){
|
||||
if (productId == null){
|
||||
throw new ServiceException("商品ID不可为空");
|
||||
}
|
||||
|
||||
return new SkuModel(productId, skuInfoList);
|
||||
}
|
||||
|
||||
public Long getProductId () {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId (Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public List<MallProductSkuInfo> getSkuInfoList () {
|
||||
return skuInfoList;
|
||||
}
|
||||
|
||||
public void setSkuInfoList (List<MallProductSkuInfo> skuInfoList) {
|
||||
this.skuInfoList = skuInfoList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.bawei.mall.product.domain.reponse;
|
||||
|
||||
import com.bawei.mall.product.domain.MallProductRuleInfo;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
import com.bawei.mall.product.domain.model.ProductModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品详情
|
||||
* @Date 2022-10-18 下午 02:00
|
||||
*/
|
||||
public class ProductDetailsResponse {
|
||||
|
||||
/**
|
||||
* 商品基本信息
|
||||
*/
|
||||
private ProductModel product;
|
||||
|
||||
/**
|
||||
* 商品的sku信息
|
||||
*/
|
||||
private List<MallProductSkuInfo> skuList;
|
||||
|
||||
/**
|
||||
* 商品规格信息
|
||||
*/
|
||||
private MallProductRuleInfo productRule;
|
||||
|
||||
public ProductModel getProduct () {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct (ProductModel product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public List<MallProductSkuInfo> getSkuList () {
|
||||
return skuList;
|
||||
}
|
||||
|
||||
public void setSkuList (List<MallProductSkuInfo> skuList) {
|
||||
this.skuList = skuList;
|
||||
}
|
||||
|
||||
public MallProductRuleInfo getProductRule () {
|
||||
return productRule;
|
||||
}
|
||||
|
||||
public void setProductRule (MallProductRuleInfo productRule) {
|
||||
this.productRule = productRule;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.bawei.mall.product.domain.reponse;
|
||||
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description:
|
||||
* @Date 2022-9-24 上午 11:27
|
||||
*/
|
||||
public class ProductInfoResponse extends MallProductInfo {
|
||||
|
||||
private List<MallProductSkuInfo> skuInfoList;
|
||||
|
||||
public List<MallProductSkuInfo> getSkuInfoList () {
|
||||
return skuInfoList;
|
||||
}
|
||||
|
||||
public void setSkuInfoList (List<MallProductSkuInfo> skuInfoList) {
|
||||
this.skuInfoList = skuInfoList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.bawei.mall.product.domain.request;
|
||||
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品信息入参
|
||||
* @Date 2022-9-24 上午 10:34
|
||||
*/
|
||||
public class ProductInfoRequest extends MallProductInfo {
|
||||
|
||||
@ApiParam("sku集合")
|
||||
private List<MallProductSkuInfo> skuInfoList;
|
||||
|
||||
public List<MallProductSkuInfo> getSkuInfoList () {
|
||||
return skuInfoList;
|
||||
}
|
||||
|
||||
public void setSkuInfoList (List<MallProductSkuInfo> skuInfoList) {
|
||||
this.skuInfoList = skuInfoList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.bawei.mall.product.domain.request;
|
||||
|
||||
import com.bawei.mall.product.domain.MallProductRuleInfo;
|
||||
import com.bawei.mall.product.domain.model.RuleAttrModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格请求对象
|
||||
* @Date 2022-9-17 上午 09:29
|
||||
*/
|
||||
|
||||
public class RuleRequest extends MallProductRuleInfo {
|
||||
|
||||
private List<RuleAttrModel> ruleList;
|
||||
|
||||
public List<RuleAttrModel> getRuleList () {
|
||||
return ruleList;
|
||||
}
|
||||
|
||||
public void setRuleList (List<RuleAttrModel> ruleList) {
|
||||
this.ruleList = ruleList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?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>bawei-mall-product</artifactId>
|
||||
<groupId>com.bawei</groupId>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bawei-mall-product-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 商品服务公共依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,56 @@
|
|||
package com.bawei.mall.product.factory;
|
||||
|
||||
import com.bawei.common.core.domain.R;
|
||||
import com.bawei.common.core.utils.StringUtils;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
|
||||
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
|
||||
import com.bawei.mall.product.remote.RemoteProductInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 远程调用服务的熔断
|
||||
* @Date 2022-10-15 上午 08:42
|
||||
*/
|
||||
@Component
|
||||
public class RemoteProductInfoFallbackFactory implements FallbackFactory<RemoteProductInfo> {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(RemoteProductInfoFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteProductInfo create (Throwable cause) {
|
||||
log.error("商品服务 - 商品信息 - 远程调用异常", cause);
|
||||
return new RemoteProductInfo() {
|
||||
@Override
|
||||
public TableDataInfo syncList (int pageSize, int syncNum, MallProductInfo mallProductInfo) {
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setMsg(StringUtils.format("远程调用失败,错误信息:[{}]",cause.getMessage()));
|
||||
tableDataInfo.setCode(R.FAIL);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<ProductDetailsResponse> getProductResponse (Long id) {
|
||||
return R.fail(StringUtils.format(
|
||||
"获取商品信息[{}]异常:[{}]",id,cause.getMessage()
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R count (String getType, MallProductInfo mallProductInfo) {
|
||||
return R.fail(StringUtils.format("远程调用失败,错误信息:[{}]",cause.getMessage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<ProductInfoResponse> getResultInfo (Long id) {
|
||||
return R.fail(StringUtils.format("远程调用失败,错误信息:[{}]",cause.getMessage()));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.bawei.mall.product.remote;
|
||||
|
||||
import com.bawei.common.core.constant.ServiceNameConstants;
|
||||
import com.bawei.common.core.domain.R;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
|
||||
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
|
||||
import com.bawei.mall.product.factory.RemoteProductInfoFallbackFactory;
|
||||
import feign.Headers;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品远程调用
|
||||
* @Date 2022-10-15 上午 08:40
|
||||
*/
|
||||
@FeignClient(contextId = "remoteProductInfoService", value = ServiceNameConstants.PRODUCT_SERVICE,
|
||||
fallbackFactory = RemoteProductInfoFallbackFactory.class,
|
||||
path = "/info")
|
||||
public interface RemoteProductInfo {
|
||||
|
||||
/**
|
||||
* 查询商品信息列表
|
||||
*/
|
||||
@PostMapping("/syncList")
|
||||
public TableDataInfo syncList(@RequestParam("pageSize") int pageSize, @RequestParam("pageNum") int syncNum,
|
||||
MallProductInfo mallProductInfo);
|
||||
|
||||
@GetMapping("/details/{id}")
|
||||
public R<ProductDetailsResponse> getProductResponse(@PathVariable("id") Long id);
|
||||
|
||||
/**
|
||||
* 查询商品信息总条数
|
||||
*/
|
||||
@PostMapping("/count")
|
||||
public R<Long> count(@RequestHeader(name = "get-type",value = "get-type")String getType,
|
||||
@RequestBody MallProductInfo mallProductInfo);
|
||||
|
||||
/**
|
||||
* 获取商品信息详细信息
|
||||
*/
|
||||
@GetMapping(value = "/result/{id}")
|
||||
public R<ProductInfoResponse> getResultInfo(@PathVariable("id") Long id);
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.bawei.mall.product.factory.RemoteProductInfoFallbackFactory
|
|
@ -0,0 +1,107 @@
|
|||
<?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>bawei-mall-product</artifactId>
|
||||
<groupId>com.bawei</groupId>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bawei-mall-product-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<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>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- BaWei Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- BaWei Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- BaWei Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- BaWei Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bawei</groupId>
|
||||
<artifactId>bawei-mall-merchant-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,26 @@
|
|||
package com.bawei.mall.product;
|
||||
|
||||
import com.bawei.common.security.annotation.EnableCustomConfig;
|
||||
import com.bawei.common.security.annotation.EnableRyFeignClients;
|
||||
import com.bawei.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 商品模块
|
||||
*
|
||||
* @author DongZeLiang
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
public class BaWeiMallProductApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(BaWeiMallProductApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 商城 - 商家模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bawei.common.log.annotation.Log;
|
||||
import com.bawei.common.log.enums.BusinessType;
|
||||
import com.bawei.common.security.annotation.RequiresPermissions;
|
||||
import com.bawei.mall.product.domain.MallProductBrandInfo;
|
||||
import com.bawei.mall.product.service.IMallProductBrandInfoService;
|
||||
import com.bawei.common.core.web.controller.BaseController;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.utils.poi.ExcelUtil;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品品牌Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/brand")
|
||||
public class MallProductBrandInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMallProductBrandInfoService mallProductBrandInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品品牌列表
|
||||
*/
|
||||
@RequiresPermissions("product:brand:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MallProductBrandInfo mallProductBrandInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MallProductBrandInfo> list = mallProductBrandInfoService.selectMallProductBrandInfoList(mallProductBrandInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品品牌列表
|
||||
*/
|
||||
@RequiresPermissions("product:brand:export")
|
||||
@Log(title = "商品品牌", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductBrandInfo mallProductBrandInfo)
|
||||
{
|
||||
List<MallProductBrandInfo> list = mallProductBrandInfoService.selectMallProductBrandInfoList(mallProductBrandInfo);
|
||||
ExcelUtil<MallProductBrandInfo> util = new ExcelUtil<MallProductBrandInfo>(MallProductBrandInfo.class);
|
||||
util.exportExcel(response, list, "商品品牌数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品品牌详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:brand:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(mallProductBrandInfoService.selectMallProductBrandInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品品牌
|
||||
*/
|
||||
@RequiresPermissions("product:brand:add")
|
||||
@Log(title = "商品品牌", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MallProductBrandInfo mallProductBrandInfo)
|
||||
{
|
||||
return toAjax(mallProductBrandInfoService.insertMallProductBrandInfo(mallProductBrandInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品品牌
|
||||
*/
|
||||
@RequiresPermissions("product:brand:edit")
|
||||
@Log(title = "商品品牌", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MallProductBrandInfo mallProductBrandInfo)
|
||||
{
|
||||
return toAjax(mallProductBrandInfoService.updateMallProductBrandInfo(mallProductBrandInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品品牌
|
||||
*/
|
||||
@RequiresPermissions("product:brand:remove")
|
||||
@Log(title = "商品品牌", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductBrandInfoService.deleteMallProductBrandInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bawei.common.core.domain.R;
|
||||
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
|
||||
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
|
||||
import com.bawei.mall.product.domain.request.ProductInfoRequest;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.bawei.common.log.annotation.Log;
|
||||
import com.bawei.common.log.enums.BusinessType;
|
||||
import com.bawei.common.security.annotation.RequiresPermissions;
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.service.IMallProductInfoService;
|
||||
import com.bawei.common.core.web.controller.BaseController;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.utils.poi.ExcelUtil;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品信息Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/info")
|
||||
@Api("商品维护 - API")
|
||||
public class MallProductInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMallProductInfoService mallProductInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品信息列表
|
||||
*/
|
||||
@RequiresPermissions("product:info:list")
|
||||
@RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public TableDataInfo list(MallProductInfo mallProductInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MallProductInfo> list = mallProductInfoService.selectMallProductInfoList(mallProductInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/syncList")
|
||||
public TableDataInfo syncList(@RequestBody MallProductInfo mallProductInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MallProductInfo> list = mallProductInfoService.selectMallProductInfoList(mallProductInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 查询商品信息总条数
|
||||
*/
|
||||
@RequiresPermissions("product:info:list")
|
||||
@PostMapping("/count")
|
||||
public R<Long> count(@RequestBody MallProductInfo mallProductInfo)
|
||||
{
|
||||
return R.ok(mallProductInfoService.selectMallProductInfoCount(mallProductInfo));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出商品信息列表
|
||||
*/
|
||||
@RequiresPermissions("product:info:export")
|
||||
@Log(title = "商品信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductInfo mallProductInfo)
|
||||
{
|
||||
List<MallProductInfo> list = mallProductInfoService.selectMallProductInfoList(mallProductInfo);
|
||||
ExcelUtil<MallProductInfo> util = new ExcelUtil<MallProductInfo>(MallProductInfo.class);
|
||||
util.exportExcel(response, list, "商品信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(mallProductInfoService.selectMallProductInfoById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/result/{id}")
|
||||
public R<ProductInfoResponse> getResultInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return R.ok(mallProductInfoService.selectMallProductInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/details/{id}")
|
||||
public R<ProductDetailsResponse> getProductResponse(@PathVariable("id") Long id){
|
||||
return R.ok(mallProductInfoService.selectProductDetailsById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品信息
|
||||
*/
|
||||
@RequiresPermissions("product:info:add")
|
||||
@Log(title = "商品信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("商品添加")
|
||||
public AjaxResult add(@RequestBody @ApiParam("商品请求实体类") ProductInfoRequest productInfoRequest)
|
||||
{
|
||||
return toAjax(mallProductInfoService.insertMallProductInfo(productInfoRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品信息
|
||||
*/
|
||||
@RequiresPermissions("product:info:edit")
|
||||
@Log(title = "商品信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ProductInfoRequest productInfoRequest)
|
||||
{
|
||||
return toAjax(mallProductInfoService.updateMallProductInfo(productInfoRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品信息
|
||||
*/
|
||||
@RequiresPermissions("product:info:remove")
|
||||
@Log(title = "商品信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductInfoService.deleteMallProductInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bawei.common.log.annotation.Log;
|
||||
import com.bawei.common.log.enums.BusinessType;
|
||||
import com.bawei.common.security.annotation.RequiresPermissions;
|
||||
import com.bawei.mall.product.domain.MallProductReviewInfo;
|
||||
import com.bawei.mall.product.service.IMallProductReviewInfoService;
|
||||
import com.bawei.common.core.web.controller.BaseController;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.utils.poi.ExcelUtil;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品评价Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/review")
|
||||
public class MallProductReviewInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMallProductReviewInfoService mallProductReviewInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*/
|
||||
@RequiresPermissions("product:review:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MallProductReviewInfo> list = mallProductReviewInfoService.selectMallProductReviewInfoList(mallProductReviewInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品评价列表
|
||||
*/
|
||||
@RequiresPermissions("product:review:export")
|
||||
@Log(title = "商品评价", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
List<MallProductReviewInfo> list = mallProductReviewInfoService.selectMallProductReviewInfoList(mallProductReviewInfo);
|
||||
ExcelUtil<MallProductReviewInfo> util = new ExcelUtil<MallProductReviewInfo>(MallProductReviewInfo.class);
|
||||
util.exportExcel(response, list, "商品评价数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品评价详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:review:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(mallProductReviewInfoService.selectMallProductReviewInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*/
|
||||
@RequiresPermissions("product:review:add")
|
||||
@Log(title = "商品评价", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
return toAjax(mallProductReviewInfoService.insertMallProductReviewInfo(mallProductReviewInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*/
|
||||
@RequiresPermissions("product:review:edit")
|
||||
@Log(title = "商品评价", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
return toAjax(mallProductReviewInfoService.updateMallProductReviewInfo(mallProductReviewInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品评价
|
||||
*/
|
||||
@RequiresPermissions("product:review:remove")
|
||||
@Log(title = "商品评价", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductReviewInfoService.deleteMallProductReviewInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bawei.common.log.annotation.Log;
|
||||
import com.bawei.common.log.enums.BusinessType;
|
||||
import com.bawei.common.security.annotation.RequiresPermissions;
|
||||
import com.bawei.mall.product.domain.MallProductRuleAttrInfo;
|
||||
import com.bawei.mall.product.service.IMallProductRuleAttrInfoService;
|
||||
import com.bawei.common.core.web.controller.BaseController;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.utils.poi.ExcelUtil;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品规格详情Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attr")
|
||||
public class MallProductRuleAttrInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMallProductRuleAttrInfoService mallProductRuleAttrInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品规格详情列表
|
||||
*/
|
||||
@RequiresPermissions("product:attr:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MallProductRuleAttrInfo> list = mallProductRuleAttrInfoService.selectMallProductRuleAttrInfoList(mallProductRuleAttrInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品规格详情列表
|
||||
*/
|
||||
@RequiresPermissions("product:attr:export")
|
||||
@Log(title = "商品规格详情", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
||||
{
|
||||
List<MallProductRuleAttrInfo> list = mallProductRuleAttrInfoService.selectMallProductRuleAttrInfoList(mallProductRuleAttrInfo);
|
||||
ExcelUtil<MallProductRuleAttrInfo> util = new ExcelUtil<MallProductRuleAttrInfo>(MallProductRuleAttrInfo.class);
|
||||
util.exportExcel(response, list, "商品规格详情数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品规格详情详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:attr:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(mallProductRuleAttrInfoService.selectMallProductRuleAttrInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规格详情
|
||||
*/
|
||||
@RequiresPermissions("product:attr:add")
|
||||
@Log(title = "商品规格详情", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
||||
{
|
||||
return toAjax(mallProductRuleAttrInfoService.insertMallProductRuleAttrInfo(mallProductRuleAttrInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格详情
|
||||
*/
|
||||
@RequiresPermissions("product:attr:edit")
|
||||
@Log(title = "商品规格详情", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
||||
{
|
||||
return toAjax(mallProductRuleAttrInfoService.updateMallProductRuleAttrInfo(mallProductRuleAttrInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格详情
|
||||
*/
|
||||
@RequiresPermissions("product:attr:remove")
|
||||
@Log(title = "商品规格详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductRuleAttrInfoService.deleteMallProductRuleAttrInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bawei.common.core.domain.R;
|
||||
import com.bawei.mall.product.domain.request.RuleRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bawei.common.log.annotation.Log;
|
||||
import com.bawei.common.log.enums.BusinessType;
|
||||
import com.bawei.common.security.annotation.RequiresPermissions;
|
||||
import com.bawei.mall.product.domain.MallProductRuleInfo;
|
||||
import com.bawei.mall.product.service.IMallProductRuleInfoService;
|
||||
import com.bawei.common.core.web.controller.BaseController;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.utils.poi.ExcelUtil;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品规格Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
public class MallProductRuleInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMallProductRuleInfoService mallProductRuleInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*/
|
||||
@RequiresPermissions("product:rule:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MallProductRuleInfo> list = mallProductRuleInfoService.selectMallProductRuleInfoList(mallProductRuleInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@RequiresPermissions("product:rule:list")
|
||||
@GetMapping("/all")
|
||||
public R all()
|
||||
{
|
||||
List<MallProductRuleInfo> list = mallProductRuleInfoService.selectMallProductRuleInfoList(new MallProductRuleInfo());
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品规格列表
|
||||
*/
|
||||
@RequiresPermissions("product:rule:export")
|
||||
@Log(title = "商品规格", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
List<MallProductRuleInfo> list = mallProductRuleInfoService.selectMallProductRuleInfoList(mallProductRuleInfo);
|
||||
ExcelUtil<MallProductRuleInfo> util = new ExcelUtil<MallProductRuleInfo>(MallProductRuleInfo.class);
|
||||
util.exportExcel(response, list, "商品规格数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品规格详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:rule:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(mallProductRuleInfoService.selectMallProductRuleInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*/
|
||||
@RequiresPermissions("product:rule:add")
|
||||
@Log(title = "商品规格", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RuleRequest ruleRequest)
|
||||
{
|
||||
return toAjax(mallProductRuleInfoService.insertMallProductRuleInfo(ruleRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*/
|
||||
@RequiresPermissions("product:rule:edit")
|
||||
@Log(title = "商品规格", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RuleRequest ruleRequest)
|
||||
{
|
||||
return toAjax(mallProductRuleInfoService.updateMallProductRuleInfo(ruleRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格
|
||||
*/
|
||||
@RequiresPermissions("product:rule:remove")
|
||||
@Log(title = "商品规格", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductRuleInfoService.deleteMallProductRuleInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bawei.common.log.annotation.Log;
|
||||
import com.bawei.common.log.enums.BusinessType;
|
||||
import com.bawei.common.security.annotation.RequiresPermissions;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
import com.bawei.mall.product.service.IMallProductSkuInfoService;
|
||||
import com.bawei.common.core.web.controller.BaseController;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.utils.poi.ExcelUtil;
|
||||
import com.bawei.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品SKUController
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sku")
|
||||
public class MallProductSkuInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMallProductSkuInfoService mallProductSkuInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品SKU列表
|
||||
*/
|
||||
@RequiresPermissions("product:sku:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MallProductSkuInfo mallProductSkuInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MallProductSkuInfo> list = mallProductSkuInfoService.selectMallProductSkuInfoList(mallProductSkuInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品SKU列表
|
||||
*/
|
||||
@RequiresPermissions("product:sku:export")
|
||||
@Log(title = "商品SKU", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductSkuInfo mallProductSkuInfo)
|
||||
{
|
||||
List<MallProductSkuInfo> list = mallProductSkuInfoService.selectMallProductSkuInfoList(mallProductSkuInfo);
|
||||
ExcelUtil<MallProductSkuInfo> util = new ExcelUtil<MallProductSkuInfo>(MallProductSkuInfo.class);
|
||||
util.exportExcel(response, list, "商品SKU数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品SKU详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:sku:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(mallProductSkuInfoService.selectMallProductSkuInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品SKU
|
||||
*/
|
||||
@RequiresPermissions("product:sku:add")
|
||||
@Log(title = "商品SKU", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MallProductSkuInfo mallProductSkuInfo)
|
||||
{
|
||||
return toAjax(mallProductSkuInfoService.insertMallProductSkuInfo(mallProductSkuInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品SKU
|
||||
*/
|
||||
@RequiresPermissions("product:sku:edit")
|
||||
@Log(title = "商品SKU", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MallProductSkuInfo mallProductSkuInfo)
|
||||
{
|
||||
return toAjax(mallProductSkuInfoService.updateMallProductSkuInfo(mallProductSkuInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品SKU
|
||||
*/
|
||||
@RequiresPermissions("product:sku:remove")
|
||||
@Log(title = "商品SKU", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductSkuInfoService.deleteMallProductSkuInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bawei.common.log.annotation.Log;
|
||||
import com.bawei.common.log.enums.BusinessType;
|
||||
import com.bawei.common.security.annotation.RequiresPermissions;
|
||||
import com.bawei.mall.product.domain.MallProductTypeInfo;
|
||||
import com.bawei.mall.product.service.IMallProductTypeInfoService;
|
||||
import com.bawei.common.core.web.controller.BaseController;
|
||||
import com.bawei.common.core.web.domain.AjaxResult;
|
||||
import com.bawei.common.core.utils.poi.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 商品类型Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/type")
|
||||
public class MallProductTypeInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMallProductTypeInfoService mallProductTypeInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品类型列表
|
||||
*/
|
||||
@RequiresPermissions("product:type:list")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(MallProductTypeInfo mallProductTypeInfo)
|
||||
{
|
||||
List<MallProductTypeInfo> list = mallProductTypeInfoService.selectMallProductTypeInfoList(mallProductTypeInfo);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
@RequiresPermissions("product:type:list")
|
||||
@GetMapping("/tree")
|
||||
public AjaxResult tree()
|
||||
{
|
||||
MallProductTypeInfo mallProductTypeInfo = new MallProductTypeInfo();
|
||||
mallProductTypeInfo.setParentId(0L);
|
||||
List<MallProductTypeInfo> list = mallProductTypeInfoService.selectMallProductTypeInfoList(mallProductTypeInfo);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出商品类型列表
|
||||
*/
|
||||
@RequiresPermissions("product:type:export")
|
||||
@Log(title = "商品类型", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductTypeInfo mallProductTypeInfo)
|
||||
{
|
||||
List<MallProductTypeInfo> list = mallProductTypeInfoService.selectMallProductTypeInfoList(mallProductTypeInfo);
|
||||
ExcelUtil<MallProductTypeInfo> util = new ExcelUtil<MallProductTypeInfo>(MallProductTypeInfo.class);
|
||||
util.exportExcel(response, list, "商品类型数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品类型详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:type:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(mallProductTypeInfoService.selectMallProductTypeInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品类型
|
||||
*/
|
||||
@RequiresPermissions("product:type:add")
|
||||
@Log(title = "商品类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MallProductTypeInfo mallProductTypeInfo)
|
||||
{
|
||||
return toAjax(mallProductTypeInfoService.insertMallProductTypeInfo(mallProductTypeInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品类型
|
||||
*/
|
||||
@RequiresPermissions("product:type:edit")
|
||||
@Log(title = "商品类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MallProductTypeInfo mallProductTypeInfo)
|
||||
{
|
||||
return toAjax(mallProductTypeInfoService.updateMallProductTypeInfo(mallProductTypeInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品类型
|
||||
*/
|
||||
@RequiresPermissions("product:type:remove")
|
||||
@Log(title = "商品类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductTypeInfoService.deleteMallProductTypeInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.bawei.mall.product.controller;
|
||||
|
||||
import com.bawei.common.core.domain.R;
|
||||
import com.bawei.common.rabbit.domain.Message;
|
||||
import com.bawei.common.rabbit.enums.QueueEnum;
|
||||
import com.bawei.mall.product.cache.ProductInfoCache;
|
||||
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
|
||||
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
|
||||
import com.bawei.mall.product.service.IMallProductInfoService;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description:
|
||||
* @Date 2022-10-19 下午 02:46
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test")
|
||||
public class TestController {
|
||||
|
||||
@Autowired
|
||||
private ProductInfoCache productInfoCache;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private IMallProductInfoService productInfoService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public R get(@PathVariable Long id){
|
||||
ProductDetailsResponse productDetailsResponse = productInfoCache.get(id);
|
||||
return R.ok(productDetailsResponse);
|
||||
}
|
||||
|
||||
@GetMapping("/refreshData/{id}")
|
||||
private R refreshData(@PathVariable Long id){
|
||||
return R.ok(productInfoCache.refreshData(id));
|
||||
}
|
||||
|
||||
@PostMapping("/sendMsg/{msg}")
|
||||
public R sendMsg(@PathVariable("msg") String msg){
|
||||
|
||||
|
||||
// ProductInfoResponse productInfoResponse = productInfoService.selectMallProductInfoById(10L);
|
||||
rabbitTemplate.convertAndSend(QueueEnum.PRODUCT_ADD.queueName(),
|
||||
Message.builderMsg(11L));
|
||||
return R.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bawei.mall.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductBrandInfo;
|
||||
|
||||
/**
|
||||
* 商品品牌Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-15
|
||||
*/
|
||||
public interface MallProductBrandInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品品牌
|
||||
*
|
||||
* @param id 商品品牌主键
|
||||
* @return 商品品牌
|
||||
*/
|
||||
public MallProductBrandInfo selectMallProductBrandInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品品牌列表
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 商品品牌集合
|
||||
*/
|
||||
public List<MallProductBrandInfo> selectMallProductBrandInfoList(MallProductBrandInfo mallProductBrandInfo);
|
||||
|
||||
/**
|
||||
* 新增商品品牌
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
||||
|
||||
/**
|
||||
* 修改商品品牌
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
||||
|
||||
/**
|
||||
* 删除商品品牌
|
||||
*
|
||||
* @param id 商品品牌主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductBrandInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品品牌
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductBrandInfoByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.bawei.mall.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.domain.model.ProductModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 商品信息Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
public interface MallProductInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品信息
|
||||
*
|
||||
* @param id 商品信息主键
|
||||
* @return 商品信息
|
||||
*/
|
||||
public MallProductInfo selectMallProductInfoById(@Param("id")Long id);
|
||||
|
||||
public ProductModel selectProductModelById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 查询商品信息列表
|
||||
*
|
||||
* @param mallProductInfo 商品信息
|
||||
* @return 商品信息集合
|
||||
*/
|
||||
public List<MallProductInfo> selectMallProductInfoList(MallProductInfo mallProductInfo);
|
||||
|
||||
/**
|
||||
* 新增商品信息
|
||||
*
|
||||
* @param mallProductInfo 商品信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductInfo(MallProductInfo mallProductInfo);
|
||||
|
||||
/**
|
||||
* 修改商品信息
|
||||
*
|
||||
* @param mallProductInfo 商品信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductInfo(MallProductInfo mallProductInfo);
|
||||
|
||||
/**
|
||||
* 删除商品信息
|
||||
*
|
||||
* @param id 商品信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 商品总条数
|
||||
* @param mallProductInfo 商品查询条件
|
||||
* @return
|
||||
*/
|
||||
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bawei.mall.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductReviewInfo;
|
||||
|
||||
/**
|
||||
* 商品评价Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-26
|
||||
*/
|
||||
public interface MallProductReviewInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 商品评价
|
||||
*/
|
||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 商品评价集合
|
||||
*/
|
||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 删除商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品评价
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.bawei.mall.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductRuleAttrInfo;
|
||||
import com.bawei.mall.product.domain.model.RuleModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 商品规格详情Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public interface MallProductRuleAttrInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品规格详情
|
||||
*
|
||||
* @param id 商品规格详情主键
|
||||
* @return 商品规格详情
|
||||
*/
|
||||
public MallProductRuleAttrInfo selectMallProductRuleAttrInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品规格详情列表
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 商品规格详情集合
|
||||
*/
|
||||
public List<MallProductRuleAttrInfo> selectMallProductRuleAttrInfoList(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
||||
|
||||
/**
|
||||
* 新增商品规格详情
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
||||
|
||||
/**
|
||||
* 修改商品规格详情
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
||||
|
||||
/**
|
||||
* 删除商品规格详情
|
||||
*
|
||||
* @param id 商品规格详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleAttrInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品规格详情
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleAttrInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量添加
|
||||
* @param ruleModel
|
||||
* @return
|
||||
*/
|
||||
int bacthInsertRule (@Param("ruleModel") RuleModel ruleModel);
|
||||
|
||||
/**
|
||||
* 删除规格详情
|
||||
* @param ids 规格Ids
|
||||
* @return
|
||||
*/
|
||||
int deleteRuleAttrByRuleIds (Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bawei.mall.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductRuleInfo;
|
||||
|
||||
/**
|
||||
* 商品规格Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public interface MallProductRuleInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 商品规格
|
||||
*/
|
||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 商品规格集合
|
||||
*/
|
||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 删除商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品规格
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.bawei.mall.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
import com.bawei.mall.product.domain.model.SkuModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 商品SKUMapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
public interface MallProductSkuInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品SKU
|
||||
*
|
||||
* @param id 商品SKU主键
|
||||
* @return 商品SKU
|
||||
*/
|
||||
public MallProductSkuInfo selectMallProductSkuInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品SKU列表
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 商品SKU集合
|
||||
*/
|
||||
public List<MallProductSkuInfo> selectMallProductSkuInfoList(MallProductSkuInfo mallProductSkuInfo);
|
||||
|
||||
/**
|
||||
* 新增商品SKU
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
||||
|
||||
/**
|
||||
* 修改商品SKU
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
||||
|
||||
/**
|
||||
* 删除商品SKU
|
||||
*
|
||||
* @param id 商品SKU主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductSkuInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品SKU
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductSkuInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量添加
|
||||
* @param skuModel
|
||||
* @return
|
||||
*/
|
||||
int batchInsertProductSku (SkuModel skuModel);
|
||||
|
||||
/**
|
||||
* 删除商品下的SKU
|
||||
* @param productId
|
||||
*/
|
||||
void deleteMallProductSkuInfoByProductId (@Param("productId") Long productId);
|
||||
|
||||
/**
|
||||
* 通过商品信息的ids进行删除
|
||||
* @param ids
|
||||
*/
|
||||
void deleteMallProductSkuInfoByProductIds (Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bawei.mall.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductTypeInfo;
|
||||
|
||||
/**
|
||||
* 商品类型Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public interface MallProductTypeInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品类型
|
||||
*
|
||||
* @param id 商品类型主键
|
||||
* @return 商品类型
|
||||
*/
|
||||
public MallProductTypeInfo selectMallProductTypeInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品类型列表
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 商品类型集合
|
||||
*/
|
||||
public List<MallProductTypeInfo> selectMallProductTypeInfoList(MallProductTypeInfo mallProductTypeInfo);
|
||||
|
||||
/**
|
||||
* 新增商品类型
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
||||
|
||||
/**
|
||||
* 修改商品类型
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
||||
|
||||
/**
|
||||
* 删除商品类型
|
||||
*
|
||||
* @param id 商品类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductTypeInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品类型
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductTypeInfoByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bawei.mall.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductBrandInfo;
|
||||
|
||||
/**
|
||||
* 商品品牌Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-15
|
||||
*/
|
||||
public interface IMallProductBrandInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品品牌
|
||||
*
|
||||
* @param id 商品品牌主键
|
||||
* @return 商品品牌
|
||||
*/
|
||||
public MallProductBrandInfo selectMallProductBrandInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品品牌列表
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 商品品牌集合
|
||||
*/
|
||||
public List<MallProductBrandInfo> selectMallProductBrandInfoList(MallProductBrandInfo mallProductBrandInfo);
|
||||
|
||||
/**
|
||||
* 新增商品品牌
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
||||
|
||||
/**
|
||||
* 修改商品品牌
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
||||
|
||||
/**
|
||||
* 批量删除商品品牌
|
||||
*
|
||||
* @param ids 需要删除的商品品牌主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductBrandInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品品牌信息
|
||||
*
|
||||
* @param id 商品品牌主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductBrandInfoById(Long id);
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.bawei.mall.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
|
||||
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
|
||||
import com.bawei.mall.product.domain.request.ProductInfoRequest;
|
||||
|
||||
/**
|
||||
* 商品信息Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
public interface IMallProductInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品信息
|
||||
*
|
||||
* @param id 商品信息主键
|
||||
* @return 商品信息
|
||||
*/
|
||||
public ProductInfoResponse selectMallProductInfoById(Long id);
|
||||
public ProductDetailsResponse selectProductDetailsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品信息列表
|
||||
*
|
||||
* @param mallProductInfo 商品信息
|
||||
* @return 商品信息集合
|
||||
*/
|
||||
public List<MallProductInfo> selectMallProductInfoList(MallProductInfo mallProductInfo);
|
||||
|
||||
/**
|
||||
* 新增商品信息
|
||||
*
|
||||
* @param productInfoRequest 商品信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductInfo(ProductInfoRequest productInfoRequest);
|
||||
|
||||
/**
|
||||
* 修改商品信息
|
||||
*
|
||||
* @param productInfoRequest 商品信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductInfo(ProductInfoRequest productInfoRequest);
|
||||
|
||||
/**
|
||||
* 批量删除商品信息
|
||||
*
|
||||
* @param ids 需要删除的商品信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品信息信息
|
||||
*
|
||||
* @param id 商品信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品总条数
|
||||
* @param mallProductInfo 商品查询
|
||||
* @return
|
||||
*/
|
||||
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bawei.mall.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductReviewInfo;
|
||||
|
||||
/**
|
||||
* 商品评价Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-26
|
||||
*/
|
||||
public interface IMallProductReviewInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 商品评价
|
||||
*/
|
||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 商品评价集合
|
||||
*/
|
||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 批量删除商品评价
|
||||
*
|
||||
* @param ids 需要删除的商品评价主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品评价信息
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoById(Long id);
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.bawei.mall.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductRuleAttrInfo;
|
||||
import com.bawei.mall.product.domain.model.RuleAttrModel;
|
||||
import com.bawei.mall.product.domain.model.RuleModel;
|
||||
|
||||
/**
|
||||
* 商品规格详情Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public interface IMallProductRuleAttrInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品规格详情
|
||||
*
|
||||
* @param id 商品规格详情主键
|
||||
* @return 商品规格详情
|
||||
*/
|
||||
public MallProductRuleAttrInfo selectMallProductRuleAttrInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品规格详情列表
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 商品规格详情集合
|
||||
*/
|
||||
public List<MallProductRuleAttrInfo> selectMallProductRuleAttrInfoList(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
||||
|
||||
/**
|
||||
* 新增商品规格详情
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
||||
|
||||
/**
|
||||
* 新增商品规格详情
|
||||
*
|
||||
* @param ruleModel 商品规格详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRuleModel(RuleModel ruleModel);
|
||||
default int insertRuleModel (Long id, List<RuleAttrModel> ruleList){
|
||||
return this.insertRuleModel(new RuleModel(){{
|
||||
setRuleId(id);
|
||||
setRuleList(ruleList);
|
||||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格详情
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
||||
|
||||
/**
|
||||
* 批量删除商品规格详情
|
||||
*
|
||||
* @param ids 需要删除的商品规格详情主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleAttrInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品规格详情信息
|
||||
*
|
||||
* @param id 商品规格详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleAttrInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 删除商品规格详情信息
|
||||
* @param ids 规格Ids
|
||||
* @return
|
||||
*/
|
||||
public int deleteRuleAttrByRuleIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品规格详情
|
||||
* @param id 规格ID
|
||||
*/
|
||||
default int deleteRuleAttrByRuleId (Long id){
|
||||
return this.deleteRuleAttrByRuleIds(new Long[]{id});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.bawei.mall.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductRuleInfo;
|
||||
import com.bawei.mall.product.domain.request.RuleRequest;
|
||||
|
||||
/**
|
||||
* 商品规格Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public interface IMallProductRuleInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 商品规格
|
||||
*/
|
||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 商品规格集合
|
||||
*/
|
||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*
|
||||
* @param ruleRequest 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductRuleInfo(RuleRequest ruleRequest);
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*
|
||||
* @param ruleRequest 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductRuleInfo(RuleRequest ruleRequest);
|
||||
|
||||
/**
|
||||
* 批量删除商品规格
|
||||
*
|
||||
* @param ids 需要删除的商品规格主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品规格信息
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoById(Long id);
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package com.bawei.mall.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
import com.bawei.mall.product.domain.model.SkuModel;
|
||||
|
||||
/**
|
||||
* 商品SKUService接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
public interface IMallProductSkuInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品SKU
|
||||
*
|
||||
* @param id 商品SKU主键
|
||||
* @return 商品SKU
|
||||
*/
|
||||
public MallProductSkuInfo selectMallProductSkuInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品SKU列表
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 商品SKU集合
|
||||
*/
|
||||
public List<MallProductSkuInfo> selectMallProductSkuInfoList(MallProductSkuInfo mallProductSkuInfo);
|
||||
/**
|
||||
* 通过商品Id查询商品SKU列表
|
||||
*
|
||||
* @param productId 商品Id
|
||||
* @return 商品SKU集合
|
||||
*/
|
||||
public default List<MallProductSkuInfo> selectMallProductSkuInfoList(Long productId){
|
||||
return this.selectMallProductSkuInfoList(new MallProductSkuInfo(){{
|
||||
setProductId(productId);
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增商品SKU
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
||||
public int batchInsertProductSku(SkuModel skuModel);
|
||||
|
||||
/**
|
||||
* 修改商品SKU
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
||||
|
||||
/**
|
||||
* 批量删除商品SKU
|
||||
*
|
||||
* @param ids 需要删除的商品SKU主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductSkuInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品SKU信息
|
||||
*
|
||||
* @param id 商品SKU主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductSkuInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 删除商品的sku
|
||||
* @param productId
|
||||
*/
|
||||
void deleteMallProductSkuInfoByProductId (Long productId);
|
||||
|
||||
/**
|
||||
* 通过商品信息的Ids进行删除
|
||||
* @param ids
|
||||
*/
|
||||
void deleteMallProductSkuInfoByProductIds (Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bawei.mall.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.mall.product.domain.MallProductTypeInfo;
|
||||
|
||||
/**
|
||||
* 商品类型Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
public interface IMallProductTypeInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品类型
|
||||
*
|
||||
* @param id 商品类型主键
|
||||
* @return 商品类型
|
||||
*/
|
||||
public MallProductTypeInfo selectMallProductTypeInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品类型列表
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 商品类型集合
|
||||
*/
|
||||
public List<MallProductTypeInfo> selectMallProductTypeInfoList(MallProductTypeInfo mallProductTypeInfo);
|
||||
|
||||
/**
|
||||
* 新增商品类型
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
||||
|
||||
/**
|
||||
* 修改商品类型
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
||||
|
||||
/**
|
||||
* 批量删除商品类型
|
||||
*
|
||||
* @param ids 需要删除的商品类型主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductTypeInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品类型信息
|
||||
*
|
||||
* @param id 商品类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductTypeInfoById(Long id);
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.bawei.mall.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.bawei.common.core.utils.DateUtils;
|
||||
import com.bawei.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bawei.mall.product.mapper.MallProductBrandInfoMapper;
|
||||
import com.bawei.mall.product.domain.MallProductBrandInfo;
|
||||
import com.bawei.mall.product.service.IMallProductBrandInfoService;
|
||||
|
||||
/**
|
||||
* 商品品牌Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-15
|
||||
*/
|
||||
@Service
|
||||
public class MallProductBrandInfoServiceImpl implements IMallProductBrandInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductBrandInfoMapper mallProductBrandInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询商品品牌
|
||||
*
|
||||
* @param id 商品品牌主键
|
||||
* @return 商品品牌
|
||||
*/
|
||||
@Override
|
||||
public MallProductBrandInfo selectMallProductBrandInfoById(Long id)
|
||||
{
|
||||
return mallProductBrandInfoMapper.selectMallProductBrandInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品品牌列表
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 商品品牌
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductBrandInfo> selectMallProductBrandInfoList(MallProductBrandInfo mallProductBrandInfo)
|
||||
{
|
||||
return mallProductBrandInfoMapper.selectMallProductBrandInfoList(mallProductBrandInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品品牌
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo)
|
||||
{
|
||||
mallProductBrandInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
mallProductBrandInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return mallProductBrandInfoMapper.insertMallProductBrandInfo(mallProductBrandInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品品牌
|
||||
*
|
||||
* @param mallProductBrandInfo 商品品牌
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo)
|
||||
{
|
||||
mallProductBrandInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return mallProductBrandInfoMapper.updateMallProductBrandInfo(mallProductBrandInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品品牌
|
||||
*
|
||||
* @param ids 需要删除的商品品牌主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductBrandInfoByIds(Long[] ids)
|
||||
{
|
||||
return mallProductBrandInfoMapper.deleteMallProductBrandInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品品牌信息
|
||||
*
|
||||
* @param id 商品品牌主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductBrandInfoById(Long id)
|
||||
{
|
||||
return mallProductBrandInfoMapper.deleteMallProductBrandInfoById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
package com.bawei.mall.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bawei.common.core.exception.ServiceException;
|
||||
import com.bawei.common.core.utils.DateUtils;
|
||||
import com.bawei.common.core.utils.bean.BeanUtils;
|
||||
import com.bawei.common.core.utils.thread.ThreadPool;
|
||||
import com.bawei.common.rabbit.domain.Message;
|
||||
import com.bawei.common.rabbit.enums.QueueEnum;
|
||||
import com.bawei.common.security.utils.SecurityUtils;
|
||||
import com.bawei.mall.product.cache.ProductInfoCache;
|
||||
import com.bawei.mall.product.domain.MallProductRuleInfo;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
import com.bawei.mall.product.domain.model.ProductModel;
|
||||
import com.bawei.mall.product.domain.model.SkuModel;
|
||||
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
|
||||
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
|
||||
import com.bawei.mall.product.domain.request.ProductInfoRequest;
|
||||
import com.bawei.mall.product.service.IMallProductRuleInfoService;
|
||||
import com.bawei.mall.product.service.IMallProductSkuInfoService;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bawei.mall.product.mapper.MallProductInfoMapper;
|
||||
import com.bawei.mall.product.domain.MallProductInfo;
|
||||
import com.bawei.mall.product.service.IMallProductInfoService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 商品信息Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
@Service
|
||||
public class MallProductInfoServiceImpl implements IMallProductInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductInfoMapper mallProductInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private IMallProductSkuInfoService skuInfoService;
|
||||
|
||||
@Autowired
|
||||
private IMallProductRuleInfoService ruleInfoService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProductInfoCache productInfoCache;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
* 查询商品信息
|
||||
*
|
||||
* @param id 商品信息主键
|
||||
* @return 商品信息
|
||||
*/
|
||||
@Override
|
||||
public ProductInfoResponse selectMallProductInfoById(Long id)
|
||||
{
|
||||
MallProductInfo mallProductInfo = mallProductInfoMapper.selectMallProductInfoById(id);
|
||||
ProductInfoResponse productInfoResponse = new ProductInfoResponse();
|
||||
BeanUtils.copyBeanProp(productInfoResponse, mallProductInfo);
|
||||
productInfoResponse.setSkuInfoList(
|
||||
skuInfoService.selectMallProductSkuInfoList(new MallProductSkuInfo(){{
|
||||
setProductId(id);
|
||||
}})
|
||||
);
|
||||
return productInfoResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductDetailsResponse selectProductDetailsById (Long productId) {
|
||||
if (productId == null || productId == 0){
|
||||
throw new ServiceException("查询商品信息,依据不合法!");
|
||||
}
|
||||
ProductDetailsResponse productDetailsResponse = new ProductDetailsResponse();
|
||||
ProductModel productModel = mallProductInfoMapper.selectProductModelById(productId);
|
||||
if (productModel == null){
|
||||
throw new ServiceException("查询商品信息,商品数据为空");
|
||||
}
|
||||
productDetailsResponse.setProduct(productModel);
|
||||
List<MallProductSkuInfo> mallProductSkuInfos = skuInfoService.selectMallProductSkuInfoList(productId);
|
||||
if (mallProductSkuInfos == null || mallProductSkuInfos.size() == 0){
|
||||
throw new ServiceException("查询商品信息,SKU数据为空");
|
||||
}
|
||||
productDetailsResponse.setSkuList(mallProductSkuInfos);
|
||||
MallProductRuleInfo ruleInfo = ruleInfoService.selectMallProductRuleInfoById(productModel.getRuleId());
|
||||
if (ruleInfo == null){
|
||||
throw new ServiceException("查询商品信息,规格数据为空");
|
||||
}
|
||||
productDetailsResponse.setProductRule(ruleInfo);
|
||||
return productDetailsResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品信息列表
|
||||
*
|
||||
* @param mallProductInfo 商品信息
|
||||
* @return 商品信息
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductInfo> selectMallProductInfoList(MallProductInfo mallProductInfo)
|
||||
{
|
||||
return mallProductInfoMapper.selectMallProductInfoList(mallProductInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品信息
|
||||
*
|
||||
* @param productInfoRequest 商品信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertMallProductInfo(ProductInfoRequest productInfoRequest)
|
||||
{
|
||||
productInfoRequest.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
productInfoRequest.setCreateTime(DateUtils.getNowDate());
|
||||
int i = mallProductInfoMapper.insertMallProductInfo(productInfoRequest);
|
||||
if (i == 0){
|
||||
return i;
|
||||
}
|
||||
|
||||
skuInfoService.batchInsertProductSku(
|
||||
SkuModel.builderSkuModel(productInfoRequest.getId(), productInfoRequest.getSkuInfoList())
|
||||
);
|
||||
|
||||
// 给搜索系统发送消息需要进行搜索更新
|
||||
rabbitTemplate.convertAndSend(QueueEnum.PRODUCT_ADD.queueName(),
|
||||
Message.builderMsg(productInfoRequest.getId()));
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品信息
|
||||
*
|
||||
* @param productInfoRequest 商品信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateMallProductInfo(ProductInfoRequest productInfoRequest)
|
||||
{
|
||||
productInfoRequest.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
productInfoRequest.setUpdateTime(DateUtils.getNowDate());
|
||||
int i = mallProductInfoMapper.updateMallProductInfo(productInfoRequest);
|
||||
if (i == 0){
|
||||
return i;
|
||||
}
|
||||
skuInfoService.deleteMallProductSkuInfoByProductId(productInfoRequest.getId());
|
||||
skuInfoService.batchInsertProductSku(
|
||||
SkuModel.builderSkuModel(productInfoRequest.getId(), productInfoRequest.getSkuInfoList())
|
||||
);
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品信息
|
||||
*
|
||||
* @param ids 需要删除的商品信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductInfoByIds(Long[] ids)
|
||||
{
|
||||
skuInfoService.deleteMallProductSkuInfoByProductIds(ids);
|
||||
for (Long id : ids) {
|
||||
// 延迟执行
|
||||
productInfoCache.delayRemove(id);
|
||||
}
|
||||
return mallProductInfoMapper.deleteMallProductInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品信息信息
|
||||
*
|
||||
* @param id 商品信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductInfoById(Long id)
|
||||
{
|
||||
return mallProductInfoMapper.deleteMallProductInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品总条数
|
||||
* @param mallProductInfo 商品查询
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long selectMallProductInfoCount (MallProductInfo mallProductInfo) {
|
||||
return mallProductInfoMapper.selectMallProductInfoCount(mallProductInfo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.bawei.mall.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bawei.common.core.utils.DateUtils;
|
||||
import com.bawei.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bawei.mall.product.mapper.MallProductReviewInfoMapper;
|
||||
import com.bawei.mall.product.domain.MallProductReviewInfo;
|
||||
import com.bawei.mall.product.service.IMallProductReviewInfoService;
|
||||
|
||||
/**
|
||||
* 商品评价Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-26
|
||||
*/
|
||||
@Service
|
||||
public class MallProductReviewInfoServiceImpl implements IMallProductReviewInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductReviewInfoMapper mallProductReviewInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 商品评价
|
||||
*/
|
||||
@Override
|
||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id)
|
||||
{
|
||||
return mallProductReviewInfoMapper.selectMallProductReviewInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 商品评价
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
return mallProductReviewInfoMapper.selectMallProductReviewInfoList(mallProductReviewInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
mallProductReviewInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
mallProductReviewInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return mallProductReviewInfoMapper.insertMallProductReviewInfo(mallProductReviewInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
mallProductReviewInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
mallProductReviewInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return mallProductReviewInfoMapper.updateMallProductReviewInfo(mallProductReviewInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品评价
|
||||
*
|
||||
* @param ids 需要删除的商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductReviewInfoByIds(Long[] ids)
|
||||
{
|
||||
return mallProductReviewInfoMapper.deleteMallProductReviewInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品评价信息
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductReviewInfoById(Long id)
|
||||
{
|
||||
return mallProductReviewInfoMapper.deleteMallProductReviewInfoById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.bawei.mall.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bawei.mall.product.domain.model.RuleAttrModel;
|
||||
import com.bawei.mall.product.domain.model.RuleModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bawei.mall.product.mapper.MallProductRuleAttrInfoMapper;
|
||||
import com.bawei.mall.product.domain.MallProductRuleAttrInfo;
|
||||
import com.bawei.mall.product.service.IMallProductRuleAttrInfoService;
|
||||
|
||||
/**
|
||||
* 商品规格详情Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@Service
|
||||
public class MallProductRuleAttrInfoServiceImpl implements IMallProductRuleAttrInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductRuleAttrInfoMapper mallProductRuleAttrInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询商品规格详情
|
||||
*
|
||||
* @param id 商品规格详情主键
|
||||
* @return 商品规格详情
|
||||
*/
|
||||
@Override
|
||||
public MallProductRuleAttrInfo selectMallProductRuleAttrInfoById(Long id)
|
||||
{
|
||||
return mallProductRuleAttrInfoMapper.selectMallProductRuleAttrInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品规格详情列表
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 商品规格详情
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductRuleAttrInfo> selectMallProductRuleAttrInfoList(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
||||
{
|
||||
return mallProductRuleAttrInfoMapper.selectMallProductRuleAttrInfoList(mallProductRuleAttrInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规格详情
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
||||
{
|
||||
return mallProductRuleAttrInfoMapper.insertMallProductRuleAttrInfo(mallProductRuleAttrInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertRuleModel (RuleModel ruleModel) {
|
||||
|
||||
return mallProductRuleAttrInfoMapper.bacthInsertRule(ruleModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格详情
|
||||
*
|
||||
* @param mallProductRuleAttrInfo 商品规格详情
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
||||
{
|
||||
return mallProductRuleAttrInfoMapper.updateMallProductRuleAttrInfo(mallProductRuleAttrInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品规格详情
|
||||
*
|
||||
* @param ids 需要删除的商品规格详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductRuleAttrInfoByIds(Long[] ids)
|
||||
{
|
||||
return mallProductRuleAttrInfoMapper.deleteMallProductRuleAttrInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格详情信息
|
||||
*
|
||||
* @param id 商品规格详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductRuleAttrInfoById(Long id)
|
||||
{
|
||||
return mallProductRuleAttrInfoMapper.deleteMallProductRuleAttrInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格详情
|
||||
* @param ids 规格Ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int deleteRuleAttrByRuleIds (Long[] ids) {
|
||||
return mallProductRuleAttrInfoMapper.deleteRuleAttrByRuleIds(ids);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package com.bawei.mall.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bawei.common.core.utils.DateUtils;
|
||||
import com.bawei.common.security.utils.SecurityUtils;
|
||||
import com.bawei.mall.product.domain.model.RuleModel;
|
||||
import com.bawei.mall.product.domain.request.RuleRequest;
|
||||
import com.bawei.mall.product.service.IMallProductRuleAttrInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bawei.mall.product.mapper.MallProductRuleInfoMapper;
|
||||
import com.bawei.mall.product.domain.MallProductRuleInfo;
|
||||
import com.bawei.mall.product.service.IMallProductRuleInfoService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 商品规格Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@Service
|
||||
public class MallProductRuleInfoServiceImpl implements IMallProductRuleInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductRuleInfoMapper mallProductRuleInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private IMallProductRuleAttrInfoService ruleAttrInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 商品规格
|
||||
*/
|
||||
@Override
|
||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id)
|
||||
{
|
||||
return mallProductRuleInfoMapper.selectMallProductRuleInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 商品规格
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
return mallProductRuleInfoMapper.selectMallProductRuleInfoList(mallProductRuleInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*
|
||||
* @param ruleRequest 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertMallProductRuleInfo(RuleRequest ruleRequest)
|
||||
{
|
||||
ruleRequest.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
ruleRequest.setCreateTime(DateUtils.getNowDate());
|
||||
int i = mallProductRuleInfoMapper.insertMallProductRuleInfo(ruleRequest);
|
||||
if (i == 0){
|
||||
return i;
|
||||
}
|
||||
// 组装了一个Model 用来添加规格属性
|
||||
RuleModel ruleModel = new RuleModel();
|
||||
ruleModel.setRuleId(ruleRequest.getId());
|
||||
ruleModel.setRuleList(ruleRequest.getRuleList());
|
||||
ruleAttrInfoService.insertRuleModel(ruleModel);
|
||||
return i;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*
|
||||
* @param ruleRequest 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductRuleInfo(RuleRequest ruleRequest)
|
||||
{
|
||||
ruleRequest.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
ruleRequest.setUpdateTime(DateUtils.getNowDate());
|
||||
int i = mallProductRuleInfoMapper.updateMallProductRuleInfo(ruleRequest);
|
||||
if (i == 0){
|
||||
return i;
|
||||
}
|
||||
ruleAttrInfoService.deleteRuleAttrByRuleId(ruleRequest.getId());
|
||||
ruleAttrInfoService.insertRuleModel(ruleRequest.getId(), ruleRequest.getRuleList());
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品规格
|
||||
*
|
||||
* @param ids 需要删除的商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteMallProductRuleInfoByIds(Long[] ids)
|
||||
{
|
||||
ruleAttrInfoService.deleteRuleAttrByRuleIds(ids);
|
||||
return mallProductRuleInfoMapper.deleteMallProductRuleInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格信息
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductRuleInfoById(Long id)
|
||||
{
|
||||
return mallProductRuleInfoMapper.deleteMallProductRuleInfoById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package com.bawei.mall.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bawei.common.core.utils.DateUtils;
|
||||
import com.bawei.common.core.utils.uuid.IdUtils;
|
||||
import com.bawei.common.security.utils.SecurityUtils;
|
||||
import com.bawei.mall.product.domain.model.SkuModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bawei.mall.product.mapper.MallProductSkuInfoMapper;
|
||||
import com.bawei.mall.product.domain.MallProductSkuInfo;
|
||||
import com.bawei.mall.product.service.IMallProductSkuInfoService;
|
||||
|
||||
/**
|
||||
* 商品SKUService业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-19
|
||||
*/
|
||||
@Service
|
||||
public class MallProductSkuInfoServiceImpl implements IMallProductSkuInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductSkuInfoMapper mallProductSkuInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询商品SKU
|
||||
*
|
||||
* @param id 商品SKU主键
|
||||
* @return 商品SKU
|
||||
*/
|
||||
@Override
|
||||
public MallProductSkuInfo selectMallProductSkuInfoById(Long id)
|
||||
{
|
||||
return mallProductSkuInfoMapper.selectMallProductSkuInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品SKU列表
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 商品SKU
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductSkuInfo> selectMallProductSkuInfoList(MallProductSkuInfo mallProductSkuInfo)
|
||||
{
|
||||
return mallProductSkuInfoMapper.selectMallProductSkuInfoList(mallProductSkuInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品SKU
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo)
|
||||
{
|
||||
mallProductSkuInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
mallProductSkuInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return mallProductSkuInfoMapper.insertMallProductSkuInfo(mallProductSkuInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsertProductSku (SkuModel skuModel) {
|
||||
skuModel.getSkuInfoList().forEach(skuInfo -> {
|
||||
skuInfo.setNumber(IdUtils.fastSimpleUUID());
|
||||
});
|
||||
return mallProductSkuInfoMapper.batchInsertProductSku(skuModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品SKU
|
||||
*
|
||||
* @param mallProductSkuInfo 商品SKU
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo)
|
||||
{
|
||||
mallProductSkuInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
mallProductSkuInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return mallProductSkuInfoMapper.updateMallProductSkuInfo(mallProductSkuInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品SKU
|
||||
*
|
||||
* @param ids 需要删除的商品SKU主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductSkuInfoByIds(Long[] ids)
|
||||
{
|
||||
return mallProductSkuInfoMapper.deleteMallProductSkuInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品SKU信息
|
||||
*
|
||||
* @param id 商品SKU主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductSkuInfoById(Long id)
|
||||
{
|
||||
return mallProductSkuInfoMapper.deleteMallProductSkuInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMallProductSkuInfoByProductId (Long productId) {
|
||||
mallProductSkuInfoMapper.deleteMallProductSkuInfoByProductId(productId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMallProductSkuInfoByProductIds (Long[] ids) {
|
||||
mallProductSkuInfoMapper.deleteMallProductSkuInfoByProductIds(ids);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.bawei.mall.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bawei.common.core.utils.DateUtils;
|
||||
import com.bawei.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bawei.mall.product.mapper.MallProductTypeInfoMapper;
|
||||
import com.bawei.mall.product.domain.MallProductTypeInfo;
|
||||
import com.bawei.mall.product.service.IMallProductTypeInfoService;
|
||||
|
||||
/**
|
||||
* 商品类型Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@Service
|
||||
public class MallProductTypeInfoServiceImpl implements IMallProductTypeInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductTypeInfoMapper mallProductTypeInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询商品类型
|
||||
*
|
||||
* @param id 商品类型主键
|
||||
* @return 商品类型
|
||||
*/
|
||||
@Override
|
||||
public MallProductTypeInfo selectMallProductTypeInfoById(Long id)
|
||||
{
|
||||
return mallProductTypeInfoMapper.selectMallProductTypeInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品类型列表
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 商品类型
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductTypeInfo> selectMallProductTypeInfoList(MallProductTypeInfo mallProductTypeInfo)
|
||||
{
|
||||
List<MallProductTypeInfo> mallProductTypeInfos = mallProductTypeInfoMapper.selectMallProductTypeInfoList(mallProductTypeInfo);
|
||||
if (mallProductTypeInfos == null || mallProductTypeInfos.size() == 0){
|
||||
return null;
|
||||
}
|
||||
for (MallProductTypeInfo productTypeInfo : mallProductTypeInfos) {
|
||||
MallProductTypeInfo mallProductTypeParam = new MallProductTypeInfo();
|
||||
mallProductTypeParam.setParentId(productTypeInfo.getId());
|
||||
productTypeInfo.setChildren(this.selectMallProductTypeInfoList(mallProductTypeParam));
|
||||
}
|
||||
return mallProductTypeInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品类型
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo)
|
||||
{
|
||||
mallProductTypeInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
mallProductTypeInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return mallProductTypeInfoMapper.insertMallProductTypeInfo(mallProductTypeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品类型
|
||||
*
|
||||
* @param mallProductTypeInfo 商品类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo)
|
||||
{
|
||||
mallProductTypeInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
mallProductTypeInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return mallProductTypeInfoMapper.updateMallProductTypeInfo(mallProductTypeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品类型
|
||||
*
|
||||
* @param ids 需要删除的商品类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductTypeInfoByIds(Long[] ids)
|
||||
{
|
||||
return mallProductTypeInfoMapper.deleteMallProductTypeInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品类型信息
|
||||
*
|
||||
* @param id 商品类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductTypeInfoById(Long id)
|
||||
{
|
||||
return mallProductTypeInfoMapper.deleteMallProductTypeInfoById(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,27 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9309
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: mall-product
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.69.116:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.69.116:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
rabbitmq:
|
||||
host: 101.34.69.116
|
|
@ -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/mall-merchant" />
|
||||
<!-- 日志输出格式 -->
|
||||
<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.bawei" 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,93 @@
|
|||
<?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.bawei.mall.product.mapper.MallProductBrandInfoMapper">
|
||||
|
||||
<resultMap type="MallProductBrandInfo" id="MallProductBrandInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="productDesc" column="product_desc" />
|
||||
<result property="content" column="content" />
|
||||
<result property="logo" column="logo" />
|
||||
<result property="status" column="status" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductBrandInfoVo">
|
||||
select id, name, product_desc, content, logo, status, revision, create_by, create_time, update_by, update_time from mall_product_brand_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductBrandInfoList" parameterType="MallProductBrandInfo" resultMap="MallProductBrandInfoResult">
|
||||
<include refid="selectMallProductBrandInfoVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductBrandInfoById" parameterType="Long" resultMap="MallProductBrandInfoResult">
|
||||
<include refid="selectMallProductBrandInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductBrandInfo" parameterType="MallProductBrandInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_brand_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="productDesc != null">product_desc,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="logo != null">logo,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="productDesc != null">#{productDesc},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="logo != null">#{logo},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductBrandInfo" parameterType="MallProductBrandInfo">
|
||||
update mall_product_brand_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="productDesc != null">product_desc = #{productDesc},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="logo != null">logo = #{logo},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductBrandInfoById" parameterType="Long">
|
||||
delete from mall_product_brand_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductBrandInfoByIds" parameterType="String">
|
||||
delete from mall_product_brand_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,191 @@
|
|||
<?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.bawei.mall.product.mapper.MallProductInfoMapper">
|
||||
|
||||
<resultMap type="MallProductInfo" id="MallProductInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="productDesc" column="product_desc" />
|
||||
<result property="type" column="type" />
|
||||
<result property="typeIds" column="type_ids" />
|
||||
<result property="img" column="img" />
|
||||
<result property="carouselImages" column="carousel_images" />
|
||||
<result property="commentCount" column="comment_count" />
|
||||
<result property="collectCount" column="collect_count" />
|
||||
<result property="brand" column="brand" />
|
||||
<result property="status" column="status" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="keywords" column="keywords" />
|
||||
<result property="ruleId" column="rule_id" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ProductModel" id="productModelResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="productDesc" column="product_desc" />
|
||||
<result property="type" column="type" />
|
||||
<result property="typeName" column="type_name" />
|
||||
<result property="typeIds" column="type_ids" />
|
||||
<result property="img" column="img" />
|
||||
<result property="carouselImages" column="carousel_images" />
|
||||
<result property="commentCount" column="comment_count" />
|
||||
<result property="collectCount" column="collect_count" />
|
||||
<result property="brand" column="brand" />
|
||||
<result property="brandName" column="brand_name" />
|
||||
<result property="status" column="status" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="keywords" column="keywords" />
|
||||
<result property="ruleId" column="rule_id" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductInfoVo">
|
||||
select id, name, product_desc, type, type_ids, img, carousel_images, comment_count, collect_count, brand, status, unit, keywords, rule_id, revision, create_by, create_time, update_by, update_time from mall_product_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductInfoList" parameterType="MallProductInfo" resultMap="MallProductInfoResult">
|
||||
<include refid="selectMallProductInfoVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="keywords != null and keywords != ''"> and keywords like concat('%', #{keywords}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductInfoById" parameterType="Long" resultMap="MallProductInfoResult">
|
||||
<include refid="selectMallProductInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectMallProductInfoCount" resultType="java.lang.Long">
|
||||
select count(id) from mall_product_info
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="keywords != null and keywords != ''"> and keywords like concat('%', #{keywords}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectProductModelById" resultMap="productModelResult">
|
||||
SELECT
|
||||
productInfo.id,
|
||||
productInfo.`name`,
|
||||
productInfo.product_desc,
|
||||
productInfo.type,
|
||||
typeInfo.`name` type_name,
|
||||
productInfo.type_ids,
|
||||
productInfo.img,
|
||||
productInfo.carousel_images,
|
||||
productInfo.comment_count,
|
||||
productInfo.collect_count,
|
||||
productInfo.brand,
|
||||
brandInfo.`name` brand_name,
|
||||
productInfo.`status`,
|
||||
productInfo.unit,
|
||||
productInfo.keywords,
|
||||
productInfo.rule_id,
|
||||
productInfo.revision,
|
||||
productInfo.create_by,
|
||||
productInfo.create_time,
|
||||
productInfo.update_by,
|
||||
productInfo.update_time
|
||||
FROM
|
||||
mall_product_info productInfo
|
||||
LEFT JOIN mall_product_brand_info brandInfo ON productInfo.brand = brandInfo.id
|
||||
LEFT JOIN mall_product_type_info typeInfo ON productInfo.type = typeInfo.id
|
||||
WHERE productInfo.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductInfo" parameterType="MallProductInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="productDesc != null and productDesc != ''">product_desc,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="typeIds != null">type_ids,</if>
|
||||
<if test="img != null and img != ''">img,</if>
|
||||
<if test="carouselImages != null and carouselImages != ''">carousel_images,</if>
|
||||
<if test="commentCount != null">comment_count,</if>
|
||||
<if test="collectCount != null">collect_count,</if>
|
||||
<if test="brand != null and brand != ''">brand,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="unit != null and unit != ''">unit,</if>
|
||||
<if test="keywords != null and keywords != ''">keywords,</if>
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="productDesc != null and productDesc != ''">#{productDesc},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="typeIds != null">#{typeIds},</if>
|
||||
<if test="img != null and img != ''">#{img},</if>
|
||||
<if test="carouselImages != null and carouselImages != ''">#{carouselImages},</if>
|
||||
<if test="commentCount != null">#{commentCount},</if>
|
||||
<if test="collectCount != null">#{collectCount},</if>
|
||||
<if test="brand != null and brand != ''">#{brand},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="unit != null and unit != ''">#{unit},</if>
|
||||
<if test="keywords != null and keywords != ''">#{keywords},</if>
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductInfo" parameterType="MallProductInfo">
|
||||
update mall_product_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="productDesc != null and productDesc != ''">product_desc = #{productDesc},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="typeIds != null">type_ids = #{typeIds},</if>
|
||||
<if test="img != null and img != ''">img = #{img},</if>
|
||||
<if test="carouselImages != null and carouselImages != ''">carousel_images = #{carouselImages},</if>
|
||||
<if test="commentCount != null">comment_count = #{commentCount},</if>
|
||||
<if test="collectCount != null">collect_count = #{collectCount},</if>
|
||||
<if test="brand != null and brand != ''">brand = #{brand},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="unit != null and unit != ''">unit = #{unit},</if>
|
||||
<if test="keywords != null and keywords != ''">keywords = #{keywords},</if>
|
||||
<if test="ruleId != null">rule_id = #{ruleId},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductInfoById" parameterType="Long">
|
||||
delete from mall_product_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductInfoByIds" parameterType="String">
|
||||
delete from mall_product_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,103 @@
|
|||
<?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.bawei.mall.product.mapper.MallProductReviewInfoMapper">
|
||||
|
||||
<resultMap type="MallProductReviewInfo" id="MallProductReviewInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productSkuId" column="product_sku_id" />
|
||||
<result property="reviewImages" column="review_images" />
|
||||
<result property="content" column="content" />
|
||||
<result property="start" column="start" />
|
||||
<result property="isDispaly" column="is_dispaly" />
|
||||
<result property="isDel" column="is_del" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductReviewInfoVo">
|
||||
select id, product_id, product_sku_id, review_images, content, start, is_dispaly, is_del, revision, create_by, create_time, update_by, update_time from mall_product_review_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductReviewInfoList" parameterType="MallProductReviewInfo" resultMap="MallProductReviewInfoResult">
|
||||
<include refid="selectMallProductReviewInfoVo"/>
|
||||
<where>
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
<if test="productSkuId != null "> and product_sku_id = #{productSkuId}</if>
|
||||
<if test="start != null "> and start = #{start}</if>
|
||||
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductReviewInfoById" parameterType="Long" resultMap="MallProductReviewInfoResult">
|
||||
<include refid="selectMallProductReviewInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductReviewInfo" parameterType="MallProductReviewInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_review_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">product_id,</if>
|
||||
<if test="productSkuId != null">product_sku_id,</if>
|
||||
<if test="reviewImages != null">review_images,</if>
|
||||
<if test="content != null and content != ''">content,</if>
|
||||
<if test="start != null">start,</if>
|
||||
<if test="isDispaly != null and isDispaly != ''">is_dispaly,</if>
|
||||
<if test="isDel != null and isDel != ''">is_del,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">#{productId},</if>
|
||||
<if test="productSkuId != null">#{productSkuId},</if>
|
||||
<if test="reviewImages != null">#{reviewImages},</if>
|
||||
<if test="content != null and content != ''">#{content},</if>
|
||||
<if test="start != null">#{start},</if>
|
||||
<if test="isDispaly != null and isDispaly != ''">#{isDispaly},</if>
|
||||
<if test="isDel != null and isDel != ''">#{isDel},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductReviewInfo" parameterType="MallProductReviewInfo">
|
||||
update mall_product_review_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productId != null">product_id = #{productId},</if>
|
||||
<if test="productSkuId != null">product_sku_id = #{productSkuId},</if>
|
||||
<if test="reviewImages != null">review_images = #{reviewImages},</if>
|
||||
<if test="content != null and content != ''">content = #{content},</if>
|
||||
<if test="start != null">start = #{start},</if>
|
||||
<if test="isDispaly != null and isDispaly != ''">is_dispaly = #{isDispaly},</if>
|
||||
<if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductReviewInfoById" parameterType="Long">
|
||||
update mall_product_review_info set is_del = 'Y' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductReviewInfoByIds" parameterType="String">
|
||||
update mall_product_review_info set is_del = 'Y' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,80 @@
|
|||
<?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.bawei.mall.product.mapper.MallProductRuleAttrInfoMapper">
|
||||
|
||||
<resultMap type="MallProductRuleAttrInfo" id="MallProductRuleAttrInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ruleId" column="rule_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="attrValue" column="attr_value" />
|
||||
<result property="revision" column="revision" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductRuleAttrInfoVo">
|
||||
select id, rule_id, name, attr_value, revision from mall_product_rule_attr_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductRuleAttrInfoList" parameterType="MallProductRuleAttrInfo" resultMap="MallProductRuleAttrInfoResult">
|
||||
<include refid="selectMallProductRuleAttrInfoVo"/>
|
||||
<where>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductRuleAttrInfoById" parameterType="Long" resultMap="MallProductRuleAttrInfoResult">
|
||||
<include refid="selectMallProductRuleAttrInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductRuleAttrInfo" parameterType="MallProductRuleAttrInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_rule_attr_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="attrValue != null">attr_value,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="attrValue != null">#{attrValue},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="bacthInsertRule" parameterType="RuleModel">
|
||||
insert into mall_product_rule_attr_info(rule_id, name, attr_value)
|
||||
values
|
||||
<foreach collection="ruleModel.ruleList" index="index" item="ruleAttr" separator=",">
|
||||
(#{ruleModel.ruleId}, #{ruleAttr.ruleType}, #{ruleAttr.ruleAttrStr})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductRuleAttrInfo" parameterType="MallProductRuleAttrInfo">
|
||||
update mall_product_rule_attr_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ruleId != null">rule_id = #{ruleId},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="attrValue != null">attr_value = #{attrValue},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductRuleAttrInfoById" parameterType="Long">
|
||||
delete from mall_product_rule_attr_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductRuleAttrInfoByIds" parameterType="String">
|
||||
delete from mall_product_rule_attr_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteRuleAttrByRuleIds">
|
||||
delete from mall_product_rule_attr_info where rule_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,86 @@
|
|||
<?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.bawei.mall.product.mapper.MallProductRuleInfoMapper">
|
||||
|
||||
<resultMap type="MallProductRuleInfo" id="MallProductRuleInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="ruleAttr" column="rule_attr" />
|
||||
<result property="status" column="status" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductRuleInfoVo">
|
||||
select id, name, rule_attr, status, revision, create_by, create_time, update_by, update_time from mall_product_rule_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductRuleInfoList" parameterType="MallProductRuleInfo" resultMap="MallProductRuleInfoResult">
|
||||
<include refid="selectMallProductRuleInfoVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''"> and rule_attr like concat('%', #{ruleAttr}, '%')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductRuleInfoById" parameterType="Long" resultMap="MallProductRuleInfoResult">
|
||||
<include refid="selectMallProductRuleInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductRuleInfo" parameterType="MallProductRuleInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_rule_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''">rule_attr,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''">#{ruleAttr},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductRuleInfo" parameterType="MallProductRuleInfo">
|
||||
update mall_product_rule_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''">rule_attr = #{ruleAttr},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductRuleInfoById" parameterType="Long">
|
||||
delete from mall_product_rule_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductRuleInfoByIds" parameterType="String">
|
||||
delete from mall_product_rule_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,126 @@
|
|||
<?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.bawei.mall.product.mapper.MallProductSkuInfoMapper">
|
||||
|
||||
<resultMap type="MallProductSkuInfo" id="MallProductSkuInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="sku" column="sku" />
|
||||
<result property="stock" column="stock" />
|
||||
<result property="price" column="price" />
|
||||
<result property="purchasePrice" column="purchase_price" />
|
||||
<result property="sellingPrice" column="selling_price" />
|
||||
<result property="image" column="image" />
|
||||
<result property="number" column="number" />
|
||||
<result property="weight" column="weight" />
|
||||
<result property="volume" column="volume" />
|
||||
<result property="revision" column="revision" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductSkuInfoVo">
|
||||
select id, product_id, sku, stock, price, purchase_price, selling_price, image, number, weight, volume, revision from mall_product_sku_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductSkuInfoList" parameterType="MallProductSkuInfo" resultMap="MallProductSkuInfoResult">
|
||||
<include refid="selectMallProductSkuInfoVo"/>
|
||||
<where>
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
<if test="sku != null and sku != ''"> and sku = #{sku}</if>
|
||||
<if test="stock != null "> and stock = #{stock}</if>
|
||||
<if test="price != null "> and price = #{price}</if>
|
||||
<if test="purchasePrice != null "> and purchase_price = #{purchasePrice}</if>
|
||||
<if test="sellingPrice != null "> and selling_price = #{sellingPrice}</if>
|
||||
<if test="image != null and image != ''"> and image = #{image}</if>
|
||||
<if test="number != null and number != ''"> and number = #{number}</if>
|
||||
<if test="weight != null "> and weight = #{weight}</if>
|
||||
<if test="volume != null "> and volume = #{volume}</if>
|
||||
<if test="revision != null "> and revision = #{revision}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductSkuInfoById" parameterType="Long" resultMap="MallProductSkuInfoResult">
|
||||
<include refid="selectMallProductSkuInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductSkuInfo" parameterType="MallProductSkuInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_sku_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">product_id,</if>
|
||||
<if test="sku != null and sku != ''">sku,</if>
|
||||
<if test="stock != null">stock,</if>
|
||||
<if test="price != null">price,</if>
|
||||
<if test="purchasePrice != null">purchase_price,</if>
|
||||
<if test="sellingPrice != null">selling_price,</if>
|
||||
<if test="image != null and image != ''">image,</if>
|
||||
<if test="number != null and number != ''">number,</if>
|
||||
<if test="weight != null">weight,</if>
|
||||
<if test="volume != null">volume,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">#{productId},</if>
|
||||
<if test="sku != null and sku != ''">#{sku},</if>
|
||||
<if test="stock != null">#{stock},</if>
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="purchasePrice != null">#{purchasePrice},</if>
|
||||
<if test="sellingPrice != null">#{sellingPrice},</if>
|
||||
<if test="image != null and image != ''">#{image},</if>
|
||||
<if test="number != null and number != ''">#{number},</if>
|
||||
<if test="weight != null">#{weight},</if>
|
||||
<if test="volume != null">#{volume},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="batchInsertProductSku">
|
||||
INSERT INTO mall_product_sku_info
|
||||
( `product_id`, `sku`, `stock`, `price`, `purchase_price`,
|
||||
`selling_price`, `image`, `number`, `weight`, `volume`)
|
||||
VALUES
|
||||
<foreach collection="skuInfoList" item="sku" index="index" separator=",">
|
||||
( #{productId}, #{sku.sku}, #{sku.stock}, #{sku.price}, #{sku.purchasePrice},
|
||||
#{sku.sellingPrice}, #{sku.image}, #{sku.number}, #{sku.weight}, #{sku.volume}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductSkuInfo" parameterType="MallProductSkuInfo">
|
||||
update mall_product_sku_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productId != null">product_id = #{productId},</if>
|
||||
<if test="sku != null and sku != ''">sku = #{sku},</if>
|
||||
<if test="stock != null">stock = #{stock},</if>
|
||||
<if test="price != null">price = #{price},</if>
|
||||
<if test="purchasePrice != null">purchase_price = #{purchasePrice},</if>
|
||||
<if test="sellingPrice != null">selling_price = #{sellingPrice},</if>
|
||||
<if test="image != null and image != ''">image = #{image},</if>
|
||||
<if test="number != null and number != ''">number = #{number},</if>
|
||||
<if test="weight != null">weight = #{weight},</if>
|
||||
<if test="volume != null">volume = #{volume},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductSkuInfoById" parameterType="Long">
|
||||
delete from mall_product_sku_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductSkuInfoByIds" parameterType="String">
|
||||
delete from mall_product_sku_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteMallProductSkuInfoByProductId">
|
||||
delete from mall_product_sku_info where product_id = #{productId}
|
||||
</delete>
|
||||
<delete id="deleteMallProductSkuInfoByProductIds">
|
||||
delete from mall_product_sku_info where product_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,94 @@
|
|||
<?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.bawei.mall.product.mapper.MallProductTypeInfoMapper">
|
||||
|
||||
<resultMap type="MallProductTypeInfo" id="MallProductTypeInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="image" column="image" />
|
||||
<result property="status" column="status" />
|
||||
<result property="orderBy" column="order_by" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductTypeInfoVo">
|
||||
select id, name, image, status, order_by, parent_id, revision, create_by, create_time, update_by, update_time from mall_product_type_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductTypeInfoList" parameterType="MallProductTypeInfo" resultMap="MallProductTypeInfoResult">
|
||||
<include refid="selectMallProductTypeInfoVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="parentId != null"> and parent_id = #{parentId}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductTypeInfoById" parameterType="Long" resultMap="MallProductTypeInfoResult">
|
||||
<include refid="selectMallProductTypeInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductTypeInfo" parameterType="MallProductTypeInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_type_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="image != null and image != ''">image,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="orderBy != null">order_by,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="image != null and image != ''">#{image},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="orderBy != null">#{orderBy},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductTypeInfo" parameterType="MallProductTypeInfo">
|
||||
update mall_product_type_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="image != null and image != ''">image = #{image},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="orderBy != null">order_by = #{orderBy},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductTypeInfoById" parameterType="Long">
|
||||
delete from mall_product_type_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductTypeInfoByIds" parameterType="String">
|
||||
delete from mall_product_type_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,27 @@
|
|||
<?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>bawei-mall</artifactId>
|
||||
<groupId>com.bawei</groupId>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bawei-mall-product</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>bawei-mall-product-common</module>
|
||||
<module>bawei-mall-product-remote</module>
|
||||
<module>bawei-mall-product-server</module>
|
||||
<module>bawei-mall-product-cache</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue