/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package cn.ysk.cashier.pojo.product;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-01-08
**/
@Entity
@Data
@Table(name="tb_shop_category")
public class TbShopCategory implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "自增id")
    private Integer id;

    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "分类名称")
    private String name;

    @Column(name = "`short_name`")
    @ApiModelProperty(value = "简称")
    private String shortName;

    @Column(name = "`tree`")
    @ApiModelProperty(value = "分类层级")
    private Integer tree;

    @Column(name = "`pid`")
    @ApiModelProperty(value = "上级分类id-为0则表示是顶级")
    private String pid;

    @Column(name = "`pic`")
    @ApiModelProperty(value = "图标")
    private String pic;

    @Column(name = "`merchant_id`")
    @ApiModelProperty(value = "商户Id")
    private String merchantId;

    @Column(name = "`shop_id`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "店铺Id")
    private String shopId;

    @Column(name = "`style`")
    @ApiModelProperty(value = "颜色格式标识")
    private String style;

    @Column(name = "`is_show`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否显示：1显示 0不显示")
    private Integer isShow;

    @Column(name = "`detail`")
    @ApiModelProperty(value = "分类描述")
    private String detail;

    @Column(name = "`sort`")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Column(name = "`key_word`")
    @ApiModelProperty(value = "关键词")
    private String keyWord;

    @Column(name = "`created_at`")
    @ApiModelProperty(value = "createdAt")
    private Long createdAt;

    @Column(name = "`updated_at`")
    @ApiModelProperty(value = "updatedAt")
    private Long updatedAt;

    public void copy(TbShopCategory source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
