package com.keyware.shandan.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.OrderBy;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.keyware.shandan.common.entity.BaseEntity;
import com.keyware.shandan.common.util.MD5Util;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 前端数据表格表头配置实体类
 *
 * @author GuoXin
 * @date 2023/8/30
 */
@Data
@Builder
@EqualsAndHashCode(callSuper = true)
@TableName("SYS_THEAD_CONFIG")
public class SysTheadConfig extends BaseEntity {

    private static final long serialVersionUID = 1480474706145625172L;
    /**
     * 主键
     */
    @TableId(type = IdType.INPUT)
    private String id;
    /**
     * 数据表ID，对应前端页面上的layui中table组件的id
     */
    private String tableId;
    /**
     * 列名
     */
    private String colName;
    /**
     * 列标题
     */
    private String colTitle;
    /**
     * 列顺序
     */
    @OrderBy(isDesc = false, sort = 2)
    private Integer colSort;
    /**
     * 列宽度
     */
    private String colWidth;
    /**
     * 是否显示
     */
    @OrderBy(sort = 1)
    private Boolean isShow;
    /**
     * 是否允许排序
     */
    private Boolean isSort;

    public void genId(String userName) {
        this.id = MD5Util.getMD5(tableId + colName + userName);
    }
}
