package com.keyware.shandan.bianmu.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.keyware.shandan.common.entity.BaseEntity;
import com.keyware.shandan.system.entity.SysUser;
import lombok.*;

/**
 * @author GuoXin
 * @date 2023-01-04
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("B_FORM_LABEL_CONFIG")
public class FormLabelVo extends BaseEntity {
    private static final long serialVersionUID = -7175350761154249003L;

    @TableId(type = IdType.AUTO)
    @TableField("ID")
    private Integer id;

    @TableField("LABEL_ID")
    private Integer labelId;

    @TableField("LABEL_ID_PATH")
    private String labelIdPath;

    @TableField("FIELD_TITLE")
    private String fieldTitle;

    @TableField("FIELD_SORT")
    @OrderBy(isDesc = false, sort = 1)
    private Integer fieldSort;

    @TableField(exist = false)
    private DataLabelsVo label;

    @TableField(exist = false)
    private SysUser user;

    public String getLabelTitle(){
        if(label != null){
            return label.getTitle();
        }
        return "";
    }

    public String getLabelTitlePath(){
        if(label != null){
            return label.getTitlePath();
        }
        return "";
    }

    public String getCreateUserName(){
        if(user != null){
            return user.getUserName();
        }
        return createUser;
    }

}
