package cn.stylefeng.team.meta.modular.entity;

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

import java.math.BigDecimal;
import java.util.Map;

@TableName(value = "devops_business_diagram", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
public class BusinessDiagram extends BaseEntity {

    @TableId(value = "diagram_id", type = IdType.ASSIGN_ID)
    @ChineseDescription("业务流程图id")
    private Long diagramId;

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

    @TableField("diagram_name")
    @ChineseDescription("图纸名称")
    private String diagramName;

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

    @TableField("system_code_show")
    @ChineseDescription("系统编码，用于展示，展示的时候是8位10进制的字符串，例如展示的时候可能显示：#A00000000")
    private String systemCodeShow;

    @TableField("diagram_file_id")
    @ChineseDescription("图纸缩略图文件id")
    private Long diagramFileId;

    @TableField(value = "diagram_content", typeHandler = JacksonTypeHandler.class)
    @ChineseDescription("流程图的具体配置json")
    private Map<String, Object> diagramContent;

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

    @TableField(value = "version_flag", fill = FieldFill.INSERT)
    @ChineseDescription("乐观锁")
    @Version
    private Long versionFlag;

    @TableField(value = "del_flag", fill = FieldFill.INSERT)
    @ChineseDescription("删除标记：Y-已删除，N-未删除")
    @TableLogic
    private String delFlag;

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

}