using SqlSugar;
using System;
using System.Linq;
namespace ZR.Model.System.Generate
{
///
/// 代码生成表字段
///
[SugarTable("gen_table_column")]
[Tenant("0")]
public class GenTableColumn : SysBase
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int ColumnId { get; set; }
///
/// 导入代码生成表列名 首字母转了小写
///
public string ColumnName { get; set; }
[SugarColumn(IsOnlyIgnoreUpdate = true)]
public int TableId { get; set; }
[SugarColumn(IsOnlyIgnoreUpdate = true)]
public string TableName { get; set; }
///
/// 列说明
///
public string ColumnComment { get; set; } = string.Empty;
///
/// 数据库列类型
///
[SugarColumn(IsOnlyIgnoreUpdate = true)]
public string ColumnType { get; set; }
///
/// C#类型
///
public string CsharpType { get; set; }
///
/// C# 字段名 首字母大写
///
public string CsharpField { get; set; }
///
/// 是否主键(1是)
///
[SugarColumn(IsOnlyIgnoreUpdate = true)]
public bool IsPk { get; set; }
///
/// 是否必填(1是)
///
public bool IsRequired { get; set; }
///
/// 是否自增(1是)
///
[SugarColumn(IsOnlyIgnoreUpdate = true)]
public bool IsIncrement { get; set; }
///
/// 是否插入(1是)
///
public bool IsInsert { get; set; }
///
/// 是否需要编辑(1是)
///
public bool IsEdit { get; set; }
///
/// 是否显示列表(1是)
///
public bool IsList { get; set; }
///
/// 是否查询(1是)
///
public bool IsQuery { get; set; }
///
/// 是否排序(1是)
///
public bool IsSort { get; set; }
///
/// 是否导出(1是)
///
public bool IsExport { get; set; }
///
/// 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
///
public string HtmlType { get; set; }
///
/// 查询类型(等于、不等于、大于、小于、范围)
///
public string QueryType { get; set; } = "EQ";
public int Sort { get; set; }
///
/// 字典类型
///
public string DictType { get; set; } = "";
///
/// 自动填充类型 1、添加 2、编辑 3、添加编辑
///
public int AutoFillType { get; set; }
#region 额外字段
[SugarColumn(IsIgnore = true)]
public string RequiredStr
{
get
{
string[] arr = new string[] { "int", "long" };
return (!IsRequired && HtmlType != "selectMulti" && (arr.Any(f => f.Contains(CsharpType))) || typeof(DateTime).Name == CsharpType) ? "?" : "";
}
}
///
/// 前端排序字符串
///
[SugarColumn(IsIgnore = true)]
public string SortStr
{
get
{
return IsSort ? " sortable" : "";
}
}
///
/// C# 字段名 首字母小写,用于前端
///
[SugarColumn(IsIgnore = true)]
public string CsharpFieldFl { get; set; }
///
/// 前端 只读字段
///
[SugarColumn(IsIgnore = true)]
public string DisabledStr
{
get
{
return ((IsPk) && !IsRequired) ? " :disabled=\"true\"" : "";
}
}
#endregion
}
}