2021-11-30 21:33:34 +08:00
|
|
|
|
using SqlSugar;
|
2021-09-18 16:10:34 +08:00
|
|
|
|
using System;
|
2021-11-30 21:33:34 +08:00
|
|
|
|
using System.Linq;
|
2021-09-17 18:19:53 +08:00
|
|
|
|
|
|
|
|
|
|
namespace ZR.Model.System.Generate
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 代码生成表字段
|
|
|
|
|
|
/// </summary>
|
2023-06-07 22:28:06 +08:00
|
|
|
|
[SugarTable("gen_table_column", "代码生成表字段")]
|
2021-11-30 21:33:34 +08:00
|
|
|
|
[Tenant("0")]
|
2021-11-28 15:20:00 +08:00
|
|
|
|
public class GenTableColumn : SysBase
|
2021-09-17 18:19:53 +08:00
|
|
|
|
{
|
2023-06-07 22:28:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 列id
|
|
|
|
|
|
/// </summary>
|
2021-11-30 21:33:34 +08:00
|
|
|
|
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
2023-06-07 22:28:06 +08:00
|
|
|
|
public long ColumnId { get; set; }
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 导入代码生成表列名 首字母转了小写
|
|
|
|
|
|
/// </summary>
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public string ColumnName { get; set; }
|
2021-11-30 21:33:34 +08:00
|
|
|
|
[SugarColumn(IsOnlyIgnoreUpdate = true)]
|
2023-06-07 22:28:06 +08:00
|
|
|
|
public long TableId { get; set; }
|
2021-09-18 16:10:34 +08:00
|
|
|
|
|
2021-11-30 21:33:34 +08:00
|
|
|
|
[SugarColumn(IsOnlyIgnoreUpdate = true)]
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public string TableName { get; set; }
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 列说明
|
|
|
|
|
|
/// </summary>
|
2023-03-05 17:06:50 +08:00
|
|
|
|
private string columnComment;
|
|
|
|
|
|
public string ColumnComment
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return string.IsNullOrEmpty(columnComment) ? CsharpField : columnComment;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
columnComment = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 数据库列类型
|
|
|
|
|
|
/// </summary>
|
2021-09-18 16:10:34 +08:00
|
|
|
|
|
2021-11-30 21:33:34 +08:00
|
|
|
|
[SugarColumn(IsOnlyIgnoreUpdate = true)]
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public string ColumnType { get; set; }
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// C#类型
|
|
|
|
|
|
/// </summary>
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public string CsharpType { get; set; }
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// C# 字段名 首字母大写
|
|
|
|
|
|
/// </summary>
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public string CsharpField { get; set; }
|
2021-09-18 16:10:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否主键(1是)
|
|
|
|
|
|
/// </summary>
|
2021-11-30 21:33:34 +08:00
|
|
|
|
[SugarColumn(IsOnlyIgnoreUpdate = true)]
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public bool IsPk { get; set; }
|
2021-09-18 16:10:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否必填(1是)
|
|
|
|
|
|
/// </summary>
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public bool IsRequired { get; set; }
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否自增(1是)
|
|
|
|
|
|
/// </summary>
|
2021-11-30 21:33:34 +08:00
|
|
|
|
[SugarColumn(IsOnlyIgnoreUpdate = true)]
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public bool IsIncrement { get; set; }
|
|
|
|
|
|
/// <summary>
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// 是否插入(1是)
|
2021-09-17 18:19:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsInsert { get; set; }
|
|
|
|
|
|
/// <summary>
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// 是否需要编辑(1是)
|
2021-09-17 18:19:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsEdit { get; set; }
|
|
|
|
|
|
/// <summary>
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// 是否显示列表(1是)
|
2021-09-17 18:19:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsList { get; set; }
|
2021-12-02 21:38:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否查询(1是)
|
|
|
|
|
|
/// </summary>
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public bool IsQuery { get; set; }
|
2021-09-18 16:10:34 +08:00
|
|
|
|
/// <summary>
|
2022-05-22 13:50:27 +08:00
|
|
|
|
/// 是否排序(1是)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsSort { get; set; }
|
|
|
|
|
|
/// <summary>
|
2022-10-19 21:27:53 +08:00
|
|
|
|
/// 是否导出(1是)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsExport { get; set; }
|
|
|
|
|
|
/// <summary>
|
2021-09-18 16:10:34 +08:00
|
|
|
|
/// 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string HtmlType { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询类型(等于、不等于、大于、小于、范围)
|
|
|
|
|
|
/// </summary>
|
2023-06-07 22:28:06 +08:00
|
|
|
|
[SugarColumn(DefaultValue = "EQ")]
|
2021-09-18 16:10:34 +08:00
|
|
|
|
public string QueryType { get; set; } = "EQ";
|
2021-09-17 18:19:53 +08:00
|
|
|
|
public int Sort { get; set; }
|
2021-09-21 20:31:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 字典类型
|
|
|
|
|
|
/// </summary>
|
2021-12-02 17:44:46 +08:00
|
|
|
|
public string DictType { get; set; } = "";
|
2023-02-17 11:02:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 自动填充类型 1、添加 2、编辑 3、添加编辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int AutoFillType { get; set; }
|
2021-11-30 21:33:34 +08:00
|
|
|
|
|
|
|
|
|
|
#region 额外字段
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
|
|
|
|
|
public string RequiredStr
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] arr = new string[] { "int", "long" };
|
2022-10-17 17:59:52 +08:00
|
|
|
|
return (!IsRequired && HtmlType != "selectMulti" && (arr.Any(f => f.Contains(CsharpType))) || typeof(DateTime).Name == CsharpType) ? "?" : "";
|
2021-11-30 21:33:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-11-27 18:43:14 +08:00
|
|
|
|
/// <summary>
|
2022-05-22 13:50:27 +08:00
|
|
|
|
/// 前端排序字符串
|
2021-12-17 11:42:54 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
2022-05-22 13:50:27 +08:00
|
|
|
|
public string SortStr
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsSort ? " sortable" : "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-12-17 11:42:54 +08:00
|
|
|
|
/// <summary>
|
2022-05-22 13:50:27 +08:00
|
|
|
|
/// C# 字段名 首字母小写,用于前端
|
2021-11-27 18:43:14 +08:00
|
|
|
|
/// </summary>
|
2022-05-22 13:50:27 +08:00
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
2023-03-05 17:06:50 +08:00
|
|
|
|
public string CsharpFieldFl
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return CsharpField[..1].ToLower() + CsharpField[1..];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-05-22 18:07:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 前端 只读字段
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
|
|
|
|
|
public string DisabledStr
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2023-02-17 11:02:27 +08:00
|
|
|
|
return ((IsPk) && !IsRequired) ? " :disabled=\"true\"" : "";
|
2022-05-22 18:07:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-05-22 13:50:27 +08:00
|
|
|
|
|
2021-11-30 21:33:34 +08:00
|
|
|
|
#endregion
|
2021-09-17 18:19:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|