修改T4模板
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
3701d8bcd9
commit
423fa4001b
|
@ -77,11 +77,6 @@
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>IRaCIS.Core.Dto.tt</DependentUpon>
|
<DependentUpon>IRaCIS.Core.Dto.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="TT_Template\IRaCIS.Core.Entity.cs">
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>IRaCIS.Core.Entity.tt</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="TT_Template\IRaCIS.Core.IRepository.cs">
|
<Compile Update="TT_Template\IRaCIS.Core.IRepository.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
|
@ -102,12 +97,18 @@
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>IRaCIS.Core.Services.tt</DependentUpon>
|
<DependentUpon>IRaCIS.Core.Services.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="TT_Template\IRaCIS.Core.Entity.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>IRaCIS.Core.Entity.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="TT_Template\Dto_New\" />
|
<Folder Include="TT_Template\Dto_New\" />
|
||||||
<Folder Include="TT_Template\IServices_New\" />
|
<Folder Include="TT_Template\IServices_New\" />
|
||||||
<Folder Include="TT_Template\Models_New\" />
|
<Folder Include="TT_Template\Models_New\" />
|
||||||
|
<Folder Include="TT_Template\Repositories_New\" />
|
||||||
<Folder Include="TT_Template\Services_New\" />
|
<Folder Include="TT_Template\Services_New\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -42,30 +42,34 @@ using IRaCIS.Core.Domain.Share;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace IRaCIS.Core.Application.ViewModel
|
namespace IRaCIS.Core.Application.ViewModel
|
||||||
{
|
{
|
||||||
/// <summary> <#=tableName#>View 列表视图模型 </summary>
|
<# var excludedColumns = new[] { "CreateUserId", "UpdateUserId", "CreateTime", "UpdateTime" };#>
|
||||||
public class <#=tableName#>View
|
|
||||||
|
/// <summary> <#=tableName#>View 列表视图 </summary>
|
||||||
|
public class <#=tableName#>View:<#=tableName#>AddOrEdit
|
||||||
{
|
{
|
||||||
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
|
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
|
||||||
|
<# if (excludedColumns.Contains(column.ColumnName)){ #>
|
||||||
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
||||||
<# }#>
|
<# }#>
|
||||||
|
<# }#>
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary><#=tableName#>Query 列表查询参数模型</summary>
|
///<summary><#=tableName#>Query 列表查询参数</summary>
|
||||||
public class <#=tableName#>Query
|
public class <#=tableName#>Query
|
||||||
{
|
{
|
||||||
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#><# if(column.CSharpType=="string"){#>
|
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#><# if(column.CSharpType=="string"){#>
|
||||||
///<summary> <#= column.Remark == "" ? column.ColumnName : column.Remark.Replace("\r\n","") #></summary>
|
|
||||||
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
||||||
|
|
||||||
<# }#>
|
<# }#>
|
||||||
<# }#>
|
<# }#>
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary> <#=tableName#>AddOrEdit 列表查询参数模型</summary>
|
///<summary> <#=tableName#>AddOrEdit 添加编辑</summary>
|
||||||
public class <#=tableName#>AddOrEdit
|
public class <#=tableName#>AddOrEdit
|
||||||
{
|
{
|
||||||
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
|
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
|
||||||
|
<# if (!excludedColumns.Contains(column.ColumnName)){ #>
|
||||||
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
||||||
|
<#}#>
|
||||||
<# }#>
|
<# }#>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||||
<#@ output extension=".cs" #>
|
<#@ output extension=".cs" #>
|
||||||
<#@ assembly name="System.Core.dll" #>
|
<#@ assembly name="System.Core.dll" #>
|
||||||
<#@ assembly name="System.Data.dll" #>
|
<#@ assembly name="System.Data.dll" #>
|
||||||
|
@ -27,13 +27,13 @@
|
||||||
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
|
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
|
||||||
{
|
{
|
||||||
var tableName=item.ToString();
|
var tableName=item.ToString();
|
||||||
manager.StartBlock(tableName+".cs",OutputPath1);//文件名
|
manager.StartBlock(tableName+".cs",OutputPath1);//文件名
|
||||||
#>
|
#>
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||||
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||||
using System;
|
using System;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
@ -44,18 +44,14 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
///<#=tableName#>
|
///<#=tableName#>
|
||||||
///</summary>
|
///</summary>
|
||||||
[Table("<#=tableName#>")]
|
[Table("<#=tableName#>")]
|
||||||
public class <#=tableName#> : Entity, IAuditUpdate, IAuditAdd
|
public class <#=tableName#> : BaseFullAuditEntity
|
||||||
{
|
{
|
||||||
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){#>
|
<# var excludedColumns = new[] { "CreateUserId", "Id", "UpdateUserId", "CreateTime", "UpdateTime", "DeleteUserId", "IsDeleted", "DeletedTime" };#>
|
||||||
|
<# foreach(DbColumn column in DbHelper.GetDbColumns(config.ConnectionString, config.DbDatabase, tableName)){ #>
|
||||||
/// <summary>
|
<# if (!excludedColumns.Contains(column.ColumnName)){ #>
|
||||||
/// <#= column.Remark == "" ? column.ColumnName : column.Remark.Replace("\r\n"," ") #>
|
/// <summary> <#= column.Remark == "" ? column.ColumnName : column.Remark.Replace("\r\n"," ") #> </summary>
|
||||||
/// </summary>
|
public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
||||||
<#
|
<#}#>
|
||||||
if(column.IsPrimaryKey)
|
|
||||||
{#>[Key]
|
|
||||||
<#}#><# if(!column.IsNullable) {#>[Required]
|
|
||||||
<# }#>public <#= column.CSharpType#><# if(column.CommonType.IsValueType && column.IsNullable){#>?<#}#> <#=column.ColumnName#> { get; set; }
|
|
||||||
<#}#>
|
<#}#>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue