优化代码生成模板

This commit is contained in:
不做码农
2021-12-02 17:44:46 +08:00
parent d08ecdd563
commit 84aeb9b27b
14 changed files with 329 additions and 235 deletions

View File

@@ -25,6 +25,14 @@ namespace ZR.Model.System.Generate
public string ColumnType { get; set; }
public string CsharpType { get; set; }
public string CsharpField { get; set; }
[SugarColumn(IsIgnore = true)]
public string CsharpField2
{
get
{
return CsharpField.Substring(0, 1).ToLower() + CsharpField[1..];
}
}
/// <summary>
/// 是否主键1是
/// </summary>
@@ -61,7 +69,7 @@ namespace ZR.Model.System.Generate
/// <summary>
/// 字典类型
/// </summary>
public string DictType { get; set; }
public string DictType { get; set; } = "";
#region
[SugarColumn(IsIgnore = true)]
@@ -70,7 +78,7 @@ namespace ZR.Model.System.Generate
get
{
string[] arr = new string[] { "int", "long" };
return (!IsRequired &&(arr.Any(f => f.Contains(CsharpType))) || typeof(DateTime).Name == CsharpType) ? "?" : "";
return (!IsRequired && (arr.Any(f => f.Contains(CsharpType))) || typeof(DateTime).Name == CsharpType) ? "?" : "";
}
}
/// <summary>