package com.xinelu.manage.domain.goodsCategory;

import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 商品分类信息对象 goods_category
 *
 * @author xinyilu
 * @date 2022-10-17
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "商品分类信息对象", description = "goods_category")
public class GoodsCategory extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 7045958639272964488L;
    /**
     * 主键id
     */
    @NotNull(message = "商品分类id不能为空", groups = {Update.class})
    private Long id;

    /**
     * 父级分类id
     */
    private Long parentId;

    /**
     * 商品分类名称
     */
    @NotBlank(message = "商品分类名称不能为空", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "商品分类名称")
    @Excel(name = "商品分类名称")
    @Length(max = 10, message = "商品分类名称不能超过10个字符", groups = {Insert.class, Update.class})
    private String goodsCategoryName;

    /**
     * 商品分类编码
     */
    @ApiModelProperty(value = "商品分类编码")
    @Excel(name = "商品分类编码")
    private String goodsCategoryCode;

    /**
     * 商品分类图片地址
     */
    @ApiModelProperty(value = "商品分类图片地址")
    @Excel(name = "商品分类图片地址")
    private String goodsCategoryPicture;

    /**
     * 分类概述
     */
    @ApiModelProperty(value = "分类概述")
    @Excel(name = "分类概述")
    private String categoryRemark;

    /**
     * 分类级别，0：代码根节点，1：代表一级节点，依次递增
     */
    private Integer categoryLevel;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    @Excel(name = "显示顺序")
    private Integer sort;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("goodsCategoryName", getGoodsCategoryName())
                .append("goodsCategoryCode", getGoodsCategoryCode())
                .append("goodsCategoryPicture", getGoodsCategoryPicture())
                .append("categoryRemark", getCategoryRemark())
                .append("sort", getSort())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
