package com.xinelu.manage.domain.goodsAttribute;

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 java.io.Serializable;

/**
 * 商品属性对象 goods_attribute
 *
 * @author xinyilu
 * @date 2022-10-17
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "商品属性对象", description = "goods_attribute")
public class GoodsAttribute extends BaseDomain implements Serializable {
    private static final long serialVersionUID = -1783047698554409597L;
    /**
     * 主键id
     */
    private Long id;

    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品id")
    @Excel(name = "商品id")
    private Long goodsId;

    /**
     * 商品属性名称
     */
    @ApiModelProperty(value = "商品属性名称")
    @Excel(name = "商品属性名称")
    @NotBlank(message = "商品属性名称不能为空", groups = {Insert.class, Update.class})
    @Length(max = 50, message = "商品属性名称不能超过50位", groups = {Insert.class, Update.class})
    private String attributeName;

    /**
     * 商品属性编码
     */
    @ApiModelProperty(value = "商品属性编码")
    @Excel(name = "商品属性编码")
    private String attributeCode;

    /**
     * 商品属性概述
     */
    @ApiModelProperty(value = "商品属性概述")
    @Excel(name = "商品属性概述")
    private String attributeRemark;

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


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("goodsId", getGoodsId())
                .append("attributeName", getAttributeName())
                .append("attributeCode", getAttributeCode())
                .append("attributeRemark", getAttributeRemark())
                .append("sort", getSort())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
