商品模块代码提交
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
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.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -14,15 +21,20 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
public class ShopProdCategoryDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
@Null(message = "ID必须为空", groups = InsertGroup.class)
|
||||
@NotNull(message = "ID不能为空", groups = UpdateGroup.class)
|
||||
private Long id;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@NotBlank(message = "分类名称不能为空", groups = DefaultGroup.class)
|
||||
private String name;
|
||||
/**
|
||||
* 简称
|
||||
@@ -31,7 +43,7 @@ public class ShopProdCategoryDTO implements Serializable {
|
||||
/**
|
||||
* 上级分类id-为0则表示是顶级
|
||||
*/
|
||||
private String pid;
|
||||
private Long pid;
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@@ -39,11 +51,7 @@ public class ShopProdCategoryDTO implements Serializable {
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private String shopId;
|
||||
/**
|
||||
* 是否显示:1显示 0不显示
|
||||
*/
|
||||
private Integer isShow;
|
||||
private Long shopId;
|
||||
/**
|
||||
* 分类描述
|
||||
*/
|
||||
@@ -51,13 +59,24 @@ public class ShopProdCategoryDTO implements Serializable {
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序值不能为空", groups = DefaultGroup.class)
|
||||
private Integer sort;
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ShopProdUnitDTO implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Null(message = "ID必须为空}", groups = InsertGroup.class)
|
||||
@Null(message = "ID必须为空", groups = InsertGroup.class)
|
||||
@NotNull(message = "ID不能为空", groups = UpdateGroup.class)
|
||||
private Long id;
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.czg.product.dto;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.czg.utils.TreeNode;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ShopProductSpecDTO extends TreeNode<ShopProductSpecDTO> implements Serializable {
|
||||
|
||||
@Serial
|
||||
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;
|
||||
/**
|
||||
* 规格级别
|
||||
*/
|
||||
@NotNull(message = "规格级别不能为空", groups = DefaultGroup.class)
|
||||
@Min(value = 1, message = "排序值不能小于1", groups = DefaultGroup.class)
|
||||
@Max(value = 3, message = "排序值不能大于3", groups = DefaultGroup.class)
|
||||
private Integer level;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序值不能为空", groups = DefaultGroup.class)
|
||||
@Min(value = 0, message = "排序值不能小于0", groups = DefaultGroup.class)
|
||||
private Integer sort;
|
||||
/**
|
||||
* 上级id
|
||||
*/
|
||||
@NotNull(message = "请选择上级规格", groups = DefaultGroup.class)
|
||||
private Long pid;
|
||||
/**
|
||||
* 店铺 id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.czg.product.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.mybatisflex.core.keygen.KeyGenerators;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
@@ -23,9 +25,9 @@ public class ShopProdCategory implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
@Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
|
||||
private Long id;
|
||||
/**
|
||||
* 分类名称
|
||||
@@ -38,7 +40,7 @@ public class ShopProdCategory implements Serializable {
|
||||
/**
|
||||
* 上级分类id-为0则表示是顶级
|
||||
*/
|
||||
private String pid;
|
||||
private Long pid;
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@@ -48,10 +50,6 @@ public class ShopProdCategory implements Serializable {
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 是否显示:1显示 0不显示
|
||||
*/
|
||||
private Integer isShow;
|
||||
/**
|
||||
* 分类描述
|
||||
*/
|
||||
private String detail;
|
||||
@@ -63,12 +61,18 @@ public class ShopProdCategory implements Serializable {
|
||||
* 关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 修改时间
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.czg.product.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.mybatisflex.core.keygen.KeyGenerators;
|
||||
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-13
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_shop_product_spec")
|
||||
public class ShopProductSpec implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
|
||||
private Long id;
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 规格级别
|
||||
*/
|
||||
private Integer level;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 上级 id
|
||||
*/
|
||||
private Long pid;
|
||||
/**
|
||||
* 店铺 id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.czg.product.service;
|
||||
|
||||
import com.czg.product.dto.ShopProdCategoryDTO;
|
||||
import com.czg.product.entity.ShopProdCategory;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺商品分类
|
||||
*
|
||||
@@ -11,4 +15,20 @@ import com.mybatisflex.core.service.IService;
|
||||
*/
|
||||
public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
||||
|
||||
Page<ShopProdCategoryDTO> page(ShopProdCategoryDTO param);
|
||||
|
||||
List<ShopProdCategoryDTO> list(ShopProdCategoryDTO param);
|
||||
|
||||
ShopProdCategoryDTO get(Long id);
|
||||
|
||||
boolean save(ShopProdCategoryDTO dto);
|
||||
|
||||
boolean update(ShopProdCategoryDTO dto);
|
||||
|
||||
boolean delete(Long id);
|
||||
|
||||
boolean disable(Long id);
|
||||
|
||||
boolean enable(Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.czg.product.service;
|
||||
|
||||
import com.czg.product.dto.ShopProductSpecDTO;
|
||||
import com.czg.product.entity.ShopProductSpec;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-13
|
||||
*/
|
||||
public interface ShopProductSpecService extends IService<ShopProductSpec> {
|
||||
Page<ShopProductSpecDTO> page(ShopProductSpecDTO param);
|
||||
|
||||
List<ShopProductSpecDTO> list(ShopProductSpecDTO param);
|
||||
|
||||
ShopProductSpecDTO get(Long id);
|
||||
|
||||
boolean save(ShopProductSpecDTO dto);
|
||||
|
||||
boolean delete(Long id);
|
||||
|
||||
boolean update(ShopProductSpecDTO dto);
|
||||
|
||||
boolean disable(Long id);
|
||||
|
||||
boolean enable(Long id);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user