初始化1

master
ZhangXushuo 2023-10-17 09:15:53 +08:00
commit c812b7db04
65 changed files with 5591 additions and 0 deletions

47
.gitignore vendored 100644
View File

@ -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

View File

@ -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>

View File

@ -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;
}
/**
* IDkey
* @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));
}
}

View File

@ -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>

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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>

View File

@ -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()));
}
};
}
}

View File

@ -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);
}

View File

@ -0,0 +1 @@
com.bawei.mall.product.factory.RemoteProductInfoFallbackFactory

View File

@ -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>

View File

@ -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("(♥◠‿◠)ノ゙ 商城 - 商家模块启动成功 ლ(´ڡ`ლ)゙ ");
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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});
}
}

View File

@ -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);
}

View File

@ -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);
/**
* IdSKU
*
* @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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

27
pom.xml 100644
View File

@ -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>