package com.corewing.app.entity;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.corewing.app.common.base.CommonEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

@EqualsAndHashCode(callSuper = true)
@Data
@TableName("biz_product")
public class BizProduct extends CommonEntity {

    @TableId
    private String id;

    private String title;

    private String description;

    private String thumbnail;

    private String hotStatus;

    private String showType;

    private String content;

    private String tag;

    private String detailUrl;

    private BigDecimal amount;

    private String status;

    private int sortCode;

    private String remark;

    private String extJson;

    @TableField(exist = false)
    private String categoryId;

    @TableField(exist = false)
    private String[] features;

    public String[] getFeatures() {
        if(StrUtil.isNotBlank(tag)) {
            return tag.split(",");
        }
        return null;
    }
}
