ModelTemplate.tt 1.2 KB
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
using System;
using SqlSugar;

namespace Hh.Mes.POJO.Entity
{
    [SugarTable("<#=TableName #>")]
    public partial class <#=TableName #>:base_Entity
    {
<# foreach (var item in TableColumnInfos) #>
<# { #>
<# if (item.ColumnName.Equals("id",StringComparison.OrdinalIgnoreCase)) #>
<# { #>
        /// <summary>
        /// 主键
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
<# } #>
<# else { if (!string.IsNullOrWhiteSpace(item.ColumnDescription)) #>
<# { #>
        /// <summary>
        /// <#=item.ColumnDescription #>
        /// </summary>
<# } #>
        [SugarColumn(<#= item.TypeName.Equals("string", StringComparison.OrdinalIgnoreCase) ? $"Length = {item.TypeLenght}, " : "" #><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? "" : $"ColumnDescription = \"{item.ColumnDescription}\", " #>IsNullable = <#= item.NullAble ? "true" : "false" #>)]
<# } #>
        public <#=item.TypeName #> <#=item.ColumnName #> { get; set; }
 
<# } #>
     }
}