商品模块代码提交
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
package com.czg.product.dto;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
@Data
|
||||
public class ProductDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
private String categoryId;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private Integer specId;
|
||||
/**
|
||||
* 单位Id
|
||||
*/
|
||||
private Integer unitId;
|
||||
private String shopId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 短标题--促销语
|
||||
*/
|
||||
private String shortTitle;
|
||||
/**
|
||||
* 单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 0 固定套餐 1可选套餐
|
||||
*/
|
||||
private Integer groupType;
|
||||
/**
|
||||
* 包装费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
private String coverImg;
|
||||
/**
|
||||
* 商品图片(第一张为缩略图,其他为详情)
|
||||
*/
|
||||
private String images;
|
||||
/**
|
||||
* 套餐内容
|
||||
*/
|
||||
private String groupSnap;
|
||||
/**
|
||||
* 库存警戒线
|
||||
*/
|
||||
private Integer warnLine;
|
||||
/**
|
||||
* 称重 价格/千克
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 是否允许临时改价
|
||||
*/
|
||||
private Integer isTempPrice;
|
||||
/**
|
||||
* 周 数组 'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday'
|
||||
*/
|
||||
private String days;
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
private Object startTime;
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
private Object endTime;
|
||||
/**
|
||||
* 规格详情
|
||||
*/
|
||||
private String specInfo;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 是否热销
|
||||
*/
|
||||
private Integer isHot;
|
||||
/**
|
||||
* 是否开启库存
|
||||
*/
|
||||
private Integer isStock;
|
||||
/**
|
||||
* 是否售罄
|
||||
*/
|
||||
private Integer isSoldStock;
|
||||
/**
|
||||
* 团购卷分类,可有多个分类
|
||||
*/
|
||||
private String groupCategoryId;
|
||||
/**
|
||||
* 商品级库存数量
|
||||
*/
|
||||
private Integer stockNumber;
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
private Integer isSale;
|
||||
/**
|
||||
* 退款是否退回库存
|
||||
*/
|
||||
private Integer isRefundStock;
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 逻辑删除
|
||||
*/
|
||||
private Integer isDel;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.czg.product.dto;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 店铺商品分类
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
@Data
|
||||
public class ShopProdCategoryDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
private String shortName;
|
||||
/**
|
||||
* 上级分类id-为0则表示是顶级
|
||||
*/
|
||||
private String pid;
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String pic;
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private String shopId;
|
||||
/**
|
||||
* 是否显示:1显示 0不显示
|
||||
*/
|
||||
private Integer isShow;
|
||||
/**
|
||||
* 分类描述
|
||||
*/
|
||||
private String detail;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.czg.product.dto;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Null;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品单位
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
@Data
|
||||
public class ShopProdUnitDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Null(message = "ID必须为空}", groups = InsertGroup.class)
|
||||
@NotNull(message = "ID不能为空", groups = UpdateGroup.class)
|
||||
private Long id;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@NotBlank(message = "单位名称不能为空", groups = DefaultGroup.class)
|
||||
private String name;
|
||||
/**
|
||||
* 单位类型 number-计数 weight-记重
|
||||
*/
|
||||
private String unitType;
|
||||
/**
|
||||
* 单位来源 1-系统预设 0-商家创建
|
||||
*/
|
||||
private Integer isSystem;
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private String shopId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.czg.product.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_product")
|
||||
public class Product implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
private String categoryId;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private Long specId;
|
||||
/**
|
||||
* 单位Id
|
||||
*/
|
||||
private Long unitId;
|
||||
private Long shopId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 短标题--促销语
|
||||
*/
|
||||
private String shortTitle;
|
||||
/**
|
||||
* 单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 0 固定套餐 1可选套餐
|
||||
*/
|
||||
private Integer groupType;
|
||||
/**
|
||||
* 包装费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
private String coverImg;
|
||||
/**
|
||||
* 商品图片(第一张为缩略图,其他为详情)
|
||||
*/
|
||||
private String images;
|
||||
/**
|
||||
* 套餐内容
|
||||
*/
|
||||
private String groupSnap;
|
||||
/**
|
||||
* 库存警戒线
|
||||
*/
|
||||
private Integer warnLine;
|
||||
/**
|
||||
* 称重 价格/千克
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 是否允许临时改价
|
||||
*/
|
||||
private Integer isTempPrice;
|
||||
/**
|
||||
* 周 数组 'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday'
|
||||
*/
|
||||
private String days;
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
private Object startTime;
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
private Object endTime;
|
||||
/**
|
||||
* 规格详情
|
||||
*/
|
||||
private String specInfo;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 是否热销
|
||||
*/
|
||||
private Integer isHot;
|
||||
/**
|
||||
* 是否开启库存
|
||||
*/
|
||||
private Integer isStock;
|
||||
/**
|
||||
* 是否售罄
|
||||
*/
|
||||
private Integer isSoldStock;
|
||||
/**
|
||||
* 团购卷分类,可有多个分类
|
||||
*/
|
||||
private String groupCategoryId;
|
||||
/**
|
||||
* 商品级库存数量
|
||||
*/
|
||||
private Integer stockNumber;
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
private Integer isSale;
|
||||
/**
|
||||
* 退款是否退回库存
|
||||
*/
|
||||
private Integer isRefundStock;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 逻辑删除
|
||||
*/
|
||||
private Integer isDel;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.czg.product.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 店铺商品分类
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_shop_prod_category")
|
||||
public class ShopProdCategory implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
private String shortName;
|
||||
/**
|
||||
* 上级分类id-为0则表示是顶级
|
||||
*/
|
||||
private String pid;
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String pic;
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 是否显示:1显示 0不显示
|
||||
*/
|
||||
private Integer isShow;
|
||||
/**
|
||||
* 分类描述
|
||||
*/
|
||||
private String detail;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.czg.product.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品单位
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_shop_prod_unit")
|
||||
public class ShopProdUnit implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 单位类型 number-计数 weight-记重
|
||||
*/
|
||||
private String unitType;
|
||||
/**
|
||||
* 单位来源 1-系统预设 0-商家创建
|
||||
*/
|
||||
private Integer isSystem;
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.czg.product.enums;
|
||||
|
||||
/**
|
||||
* 单位类型
|
||||
* @author tankaikai
|
||||
* @since 2025-02-11 14:49
|
||||
*/
|
||||
public enum UnitTypeEnum {
|
||||
/**
|
||||
* 计数
|
||||
*/
|
||||
NUMBER("number"),
|
||||
/**
|
||||
* 记重
|
||||
*/
|
||||
WEIGHT("weight");
|
||||
|
||||
private String value;
|
||||
|
||||
UnitTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.czg.product.service;
|
||||
|
||||
|
||||
import com.czg.core.service.IBaseService;
|
||||
import com.czg.product.entity.Product;
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
public interface ProductService extends IBaseService<Product> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.product.service;
|
||||
|
||||
import com.czg.core.service.IBaseService;
|
||||
import com.czg.product.entity.ShopProdCategory;
|
||||
|
||||
/**
|
||||
* 店铺商品分类
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
public interface ShopProdCategoryService extends IBaseService<ShopProdCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.czg.product.service;
|
||||
|
||||
import com.czg.core.service.IBaseService;
|
||||
import com.czg.product.dto.ShopProdUnitDTO;
|
||||
import com.czg.product.entity.ShopProdUnit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品单位Service接口
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-10
|
||||
*/
|
||||
public interface ShopProdUnitService extends IBaseService<ShopProdUnit> {
|
||||
|
||||
Page<ShopProdUnitDTO> page(Map<String, Object> params);
|
||||
|
||||
List<ShopProdUnitDTO> list(Map<String, Object> params);
|
||||
|
||||
ShopProdUnitDTO get(Long id);
|
||||
|
||||
boolean save(ShopProdUnitDTO dto);
|
||||
|
||||
boolean update(ShopProdUnitDTO dto);
|
||||
|
||||
boolean disable(Long id);
|
||||
|
||||
boolean enable(Long id);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user