package cn.stylefeng.team.view.api.entity;

import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseBusinessEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.team.view.api.pojo.ViewConfig;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

@TableName(value = "devops_view", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
public class View extends BaseBusinessEntity {

    @TableId(value = "view_id", type = IdType.ASSIGN_ID)
    @ChineseDescription("模型id")
    private Long viewId;

    @TableField("business_category_id")
    @ChineseDescription("所属业务分类id")
    private Long businessCategoryId;

    @TableField("business_id")
    @ChineseDescription("所属业务id")
    private Long businessId;

    @TableField("view_name")
    @ChineseDescription("视图名称")
    private String viewName;

    @TableField("view_code")
    @ChineseDescription("视图编码")
    private String viewCode;

    @TableField("system_code")
    @ChineseDescription("系统编码，这里用十进制存储")
    private Integer systemCode;

    @TableField("system_code_show")
    @ChineseDescription("系统编码，用于展示")
    private String systemCodeShow;

    @TableField("description")
    @ChineseDescription("项目描述")
    private String description;

    @TableField("view_type")
    @ChineseDescription("视图类型：1-列表视图，2-其他视图")
    private Integer viewType;

    @TableField("fld_sort")
    @ChineseDescription("排序")
    private BigDecimal fldSort;

    @TableField(value = "view_config", typeHandler = JacksonTypeHandler.class)
    @ChineseDescription("视图配置")
    private ViewConfig viewConfig;

    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    @ChineseDescription("租户id")
    private Long tenantId;

}
