lyh
2025-07-02 cd0b2641235cd0c7567bd7dffefd7fa360aac236
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductMix.java
@@ -2,46 +2,83 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Getter
@Data
@NoArgsConstructor
@TableName(value = "nc_product_mix")
public class ProductMix {
public class ProductMix implements Serializable {
    private static final long serialVersionUID = 1529244980533421687L;
    // id
    private long id;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    // 父级 id
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(value = "parent_id")
    private long parentId;
    private Long parentId;
    // 名称
    @TableField(value = "name")
    private String name;
    @TableField(value = "tree_name")
    private String treeName;
    // code
    @TableField(value = "code")
    private String code;
    @TableField(value = "tree_code")
    private String treeCode;
    // 类型
    @TableField(value = "type")
    private String type;
    @TableField(value = "tree_type")
    private Integer treeType;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @TableField(value = "create_time")
    private Date createTime;
    //展示名称
    private transient String label;
    //类型方便前端展示
    private transient Integer type;
    private transient List<ProductMix> children = new ArrayList<>();
    public ProductMix(long id, long parentId, String name, String code, String type) {
    public ProductMix(Long id, Long parentId, String treeName, String treeCode, Integer type, Date createTime) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
        this.code = code;
        this.treeName = treeName;
        this.treeCode = treeCode;
        this.type = type;
        this.treeType = type;
        this.children = new ArrayList<>();
        this.label="["+treeCode+"]"+treeName;
        this.createTime = createTime;
    }
    public void addChild(ProductMix child) {
        this.children.add(child);
    }
    public ProductMix(Date createTime) {
        this.createTime = createTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Override
    public String toString() {
        return "ProductMix{createTime=" + createTime + '}';
    }
}