删除T4模板废弃的
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
48ea90ce97
commit
2450602227
|
@ -3,9 +3,9 @@
|
|||
{
|
||||
public static readonly string ConnectionString = "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true";
|
||||
public static readonly string DbDatabase = "Test_IRC";
|
||||
//表名称用字符串,拼接
|
||||
//表名称用字符串,拼接
|
||||
public static readonly string TableName = "UserFeedBack";
|
||||
//具体文件里面 例如service 可以配置是否分页
|
||||
//具体文件里面 例如service 可以配置是否分页
|
||||
}
|
||||
#>
|
||||
<#+
|
||||
|
@ -21,12 +21,12 @@
|
|||
}
|
||||
string sql = string.Format(@"SELECT
|
||||
obj.name tablename
|
||||
from sys.objects obj
|
||||
inner join dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1
|
||||
INNER JOIN sys.schemas schem ON obj.schema_id=schem.schema_id
|
||||
left join sys.extended_properties g ON (obj.object_id = g.major_id AND g.minor_id = 0 AND g.name= 'MS_Description')
|
||||
where type='U' {0}
|
||||
order by obj.name",tables);
|
||||
from {0}.sys.objects obj
|
||||
inner join {0}.dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1
|
||||
INNER JOIN {0}.sys.schemas schem ON obj.schema_id=schem.schema_id
|
||||
left join {0}.sys.extended_properties g ON (obj.object_id = g.major_id AND g.minor_id = 0 AND g.name= 'MS_Description')
|
||||
where type='U' {1}
|
||||
order by obj.name", database,tables);
|
||||
DataTable dt = GetDataTable(connectionString, sql);
|
||||
return dt.Rows.Cast<DataRow>().Select(row =>row.Field<string>("tablename")).ToList();
|
||||
}
|
||||
|
@ -50,11 +50,11 @@
|
|||
ELSE 0
|
||||
END
|
||||
AS BIT) HasPrimaryKey
|
||||
from sys.objects obj
|
||||
inner join dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1
|
||||
INNER JOIN sys.schemas schem ON obj.schema_id=schem.schema_id
|
||||
where type='U' {0}
|
||||
order by obj.name", tables);
|
||||
from {0}.sys.objects obj
|
||||
inner join {0}.dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1
|
||||
INNER JOIN {0}.sys.schemas schem ON obj.schema_id=schem.schema_id
|
||||
where type='U' {1}
|
||||
order by obj.name", database, tables);
|
||||
#endregion
|
||||
DataTable dt = GetDataTable(connectionString, sql);
|
||||
return dt.Rows.Cast<DataRow>().Select(row => new DbTable
|
||||
|
@ -79,8 +79,8 @@
|
|||
ic.column_id,
|
||||
ic.index_column_id,
|
||||
ic.object_id
|
||||
FROM sys.indexes idx
|
||||
INNER JOIN sys.index_columns ic ON idx.index_id = ic.index_id AND idx.object_id = ic.object_id
|
||||
FROM {0}.sys.indexes idx
|
||||
INNER JOIN {0}.sys.index_columns ic ON idx.index_id = ic.index_id AND idx.object_id = ic.object_id
|
||||
WHERE idx.object_id =OBJECT_ID(@tableName) AND idx.is_primary_key=1
|
||||
)
|
||||
select
|
||||
|
@ -102,14 +102,14 @@
|
|||
cast(colm.precision as int) Precision,
|
||||
cast(colm.scale as int) Scale,
|
||||
prop.value Remark
|
||||
from sys.columns colm
|
||||
inner join sys.types systype on colm.system_type_id=systype.system_type_id and colm.user_type_id=systype.user_type_id
|
||||
left join sys.extended_properties prop on colm.object_id=prop.major_id and colm.column_id=prop.minor_id
|
||||
from {0}.sys.columns colm
|
||||
inner join {0}.sys.types systype on colm.system_type_id=systype.system_type_id and colm.user_type_id=systype.user_type_id
|
||||
left join {0}.sys.extended_properties prop on colm.object_id=prop.major_id and colm.column_id=prop.minor_id
|
||||
LEFT JOIN indexCTE ON colm.column_id=indexCTE.column_id AND colm.object_id=indexCTE.object_id
|
||||
where colm.object_id=OBJECT_ID(@tableName)
|
||||
order by colm.column_id");
|
||||
order by colm.column_id", database);
|
||||
#endregion
|
||||
SqlParameter param = new SqlParameter("@tableName", SqlDbType.NVarChar, 100) { Value = string.Format("{0}.{1}", schema, tableName) };
|
||||
SqlParameter param = new SqlParameter("@tableName", SqlDbType.NVarChar, 100) { Value = string.Format("{0}.{1}.{2}", database, schema, tableName) };
|
||||
DataTable dt = GetDataTable(connectionString, sql, param);
|
||||
return dt.Rows.Cast<DataRow>().Select(row => new DbColumn()
|
||||
{
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
<OutputPath>..\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="TT_Template\IRaCIS .Core.ServiceAsync.tt">
|
||||
<LastGenOutput>IRaCIS .Core.ServiceAsync.cs</LastGenOutput>
|
||||
|
@ -25,22 +27,6 @@
|
|||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>IRaCIS.Core.Dto.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="TT_Template\IRaCIS.Core.Services.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>IRaCIS.Core.Services.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="TT_Template\IRaCIS.Core.IServices.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>IRaCIS.Core.IServices.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="TT_Template\IRaCIS.Core.Repository.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>IRaCIS.Core.Repository.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="TT_Template\IRaCIS.Core.IRepository.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>IRaCIS.Core.IRepository.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="TT_Template\IRaCIS.Core.Entity.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>IRaCIS.Core.Entity.cs</LastGenOutput>
|
||||
|
@ -67,26 +53,6 @@
|
|||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>IRaCIS.Core.Dto.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="TT_Template\IRaCIS.Core.IRepository.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>IRaCIS.Core.IRepository.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="TT_Template\IRaCIS.Core.IServices.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>IRaCIS.Core.IServices.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="TT_Template\IRaCIS.Core.Repository.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>IRaCIS.Core.Repository.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="TT_Template\IRaCIS.Core.Services.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>IRaCIS.Core.Services.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="TT_Template\IRaCIS.Core.Entity.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
|
@ -95,11 +61,9 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Test\Audit\" />
|
||||
<Folder Include="TT_Template\Dto_New\" />
|
||||
<Folder Include="TT_Template\IServices_New\" />
|
||||
<Folder Include="TT_Template\Models_New\" />
|
||||
<Folder Include="TT_Template\Repositories_New\" />
|
||||
<Folder Include="TT_Template\Services_New\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-09-04 14:40:49
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
|
||||
/// <summary> UserFeedBackView 列表视图 </summary>
|
||||
public class UserFeedBackView : UserFeedBackAddOrEdit
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
public Guid UpdateUserId { get; set; }
|
||||
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
///<summary>UserFeedBackQuery 列表查询参数</summary>
|
||||
public class UserFeedBackQuery
|
||||
{
|
||||
public string QuestionDescription { get; set; }
|
||||
public string ScreenshotListStr { get; set; }
|
||||
}
|
||||
|
||||
///<summary> UserFeedBackAddOrEdit 添加编辑</summary>
|
||||
public class UserFeedBackAddOrEdit
|
||||
{
|
||||
|
||||
public Guid Id { get; set; }
|
||||
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
|
||||
|
||||
public int QuestionType { get; set; }
|
||||
|
||||
|
||||
public string QuestionDescription { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int State { get; set; }
|
||||
|
||||
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
|
||||
public string ScreenshotListStr { get; set; }
|
||||
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -38,6 +38,7 @@ using System;
|
|||
using IRaCIS.Core.Domain.Share;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
<#@ assembly name="System.Core.dll" #>
|
||||
<#@ assembly name="System.Data.dll" #>
|
||||
<#@ assembly name="System.Data.DataSetExtensions.dll" #>
|
||||
<#@ assembly name="System.Xml.dll" #>
|
||||
<#@ import namespace="System" #>
|
||||
<#@ import namespace="System.Xml" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Data" #>
|
||||
<#@ import namespace="System.Data.SqlClient" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ include file="$(ProjectDir)DbHelper.ttinclude" #>
|
||||
<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #>
|
||||
<# var manager = new Manager(Host, GenerationEnvironment, true); #>
|
||||
|
||||
|
||||
<#
|
||||
var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+"..");
|
||||
OutputPath1=Path.Combine(OutputPath1,"IRepositories_New");
|
||||
if (!Directory.Exists(OutputPath1))
|
||||
{
|
||||
Directory.CreateDirectory(OutputPath1);
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
|
||||
{
|
||||
var tableName=item.ToString();
|
||||
manager.StartBlock("I"+tableName+"Repository"+".cs",OutputPath1);//文件名
|
||||
#>
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
||||
// 使用泛型仓储注册,现在不需要这个文件了,作为学习例子
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Domain.IRepository;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
namespace IRaCIS.Core.Domain.IRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// I<#=tableName#>Repository
|
||||
/// </summary>
|
||||
public interface I<#=tableName#>Repository : IRepository<<#=tableName#>>
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
<#
|
||||
manager.EndBlock();
|
||||
}
|
||||
manager.Process(true);
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
|
||||
//在这里设置 isPage 是否生成分页的还是不分页
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
<#@ assembly name="System.Core.dll" #>
|
||||
<#@ assembly name="System.Data.dll" #>
|
||||
<#@ assembly name="System.Data.DataSetExtensions.dll" #>
|
||||
<#@ assembly name="System.Xml.dll" #>
|
||||
<#@ import namespace="System" #>
|
||||
<#@ import namespace="System.Xml" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Data" #>
|
||||
<#@ import namespace="System.Data.SqlClient" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ include file="$(ProjectDir)DbHelper.ttinclude" #>
|
||||
<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #>
|
||||
<# var manager = new Manager(Host, GenerationEnvironment, true); #>
|
||||
|
||||
//在这里设置 isPage 是否生成分页的还是不分页
|
||||
|
||||
<#
|
||||
var isPage=false;
|
||||
#>
|
||||
|
||||
<#
|
||||
var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+"..");
|
||||
OutputPath1=Path.Combine(OutputPath1,"IServices_New");
|
||||
if (!Directory.Exists(OutputPath1))
|
||||
{
|
||||
Directory.CreateDirectory(OutputPath1);
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
|
||||
{
|
||||
var tableName=item.ToString();
|
||||
manager.StartBlock("I"+tableName+"Service"+".cs",OutputPath1);//文件名
|
||||
#>
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// I<#=tableName#>Service
|
||||
/// </summary>
|
||||
public interface I<#=tableName#>Service
|
||||
{
|
||||
|
||||
<# if(isPage){#>
|
||||
PageOutput<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>);
|
||||
<# } else {#>
|
||||
|
||||
List<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>);
|
||||
<# }#>
|
||||
|
||||
IResponseOutput AddOrUpdate<#=tableName#>(<#=tableName#>AddOrEdit addOrEdit<#=tableName#>);
|
||||
|
||||
IResponseOutput Delete<#=tableName#>(Guid <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
<#
|
||||
manager.EndBlock();
|
||||
}
|
||||
manager.Process(true);
|
||||
#>
|
||||
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
<#@ assembly name="System.Core.dll" #>
|
||||
<#@ assembly name="System.Data.dll" #>
|
||||
<#@ assembly name="System.Data.DataSetExtensions.dll" #>
|
||||
<#@ assembly name="System.Xml.dll" #>
|
||||
<#@ import namespace="System" #>
|
||||
<#@ import namespace="System.Xml" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Data" #>
|
||||
<#@ import namespace="System.Data.SqlClient" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ include file="$(ProjectDir)DbHelper.ttinclude" #>
|
||||
<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #>
|
||||
<# var manager = new Manager(Host, GenerationEnvironment, true); #>
|
||||
|
||||
|
||||
|
||||
<#
|
||||
var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+"..");
|
||||
OutputPath1=Path.Combine(OutputPath1,"Repositories_New");
|
||||
if (!Directory.Exists(OutputPath1))
|
||||
{
|
||||
Directory.CreateDirectory(OutputPath1);
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
|
||||
{
|
||||
var tableName=item.ToString();
|
||||
manager.StartBlock(tableName+"Repository"+".cs",OutputPath1);//文件名
|
||||
#>
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
||||
// 使用泛型仓储注册,现在不需要这个文件了,作为学习例子
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Domain.IRepository;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
namespace IRaCIS.Core.Domain.Repository;
|
||||
{
|
||||
/// <summary>
|
||||
/// <#=tableName#>Repository
|
||||
/// </summary>
|
||||
public class <#=tableName#>Repository : Repository<<#=tableName#>>, IRepository<<#=tableName#>>
|
||||
{
|
||||
public <#=tableName#>Repository( IRaCISDBContext db) : base( db)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
<#
|
||||
manager.EndBlock();
|
||||
}
|
||||
manager.Process(true);
|
||||
#>
|
||||
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
||||
//在这里设置 isPage 是否生成分页的还是不分页
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
<#@ assembly name="System.Core.dll" #>
|
||||
<#@ assembly name="System.Data.dll" #>
|
||||
<#@ assembly name="System.Data.DataSetExtensions.dll" #>
|
||||
<#@ assembly name="System.Xml.dll" #>
|
||||
<#@ import namespace="System" #>
|
||||
<#@ import namespace="System.Xml" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Data" #>
|
||||
<#@ import namespace="System.Data.SqlClient" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
|
||||
<#@ include file="$(ProjectDir)DbHelper.ttinclude" #>
|
||||
<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #>
|
||||
<# var manager = new Manager(Host, GenerationEnvironment, true); #>
|
||||
|
||||
|
||||
//在这里设置 isPage 是否生成分页的还是不分页
|
||||
|
||||
<#
|
||||
var isPage=false;
|
||||
#>
|
||||
|
||||
<#
|
||||
var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+"..");
|
||||
OutputPath1=Path.Combine(OutputPath1,"Services_New");
|
||||
if (!Directory.Exists(OutputPath1))
|
||||
{
|
||||
Directory.CreateDirectory(OutputPath1);
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName))
|
||||
{
|
||||
var tableName=item.ToString();
|
||||
manager.StartBlock(tableName+"Service"+".cs",OutputPath1);//文件名
|
||||
#>
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// <#=tableName#>Service
|
||||
/// </summary>
|
||||
[ ApiExplorerSettings(GroupName = "Test")]
|
||||
public class <#=tableName#>Service: BaseService, I<#=tableName#>Service
|
||||
{
|
||||
|
||||
private readonly IRepository<<#=tableName#>> _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository;
|
||||
|
||||
public <#=tableName#>Service(IRepository<<#=tableName#>> <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository)
|
||||
{
|
||||
_<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository = <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository;
|
||||
}
|
||||
|
||||
<# if(isPage){#>
|
||||
public PageOutput<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>)
|
||||
{
|
||||
|
||||
var <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable =
|
||||
|
||||
_<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.AsQueryable()
|
||||
.ProjectTo<<#=tableName#>View>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList=<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable.
|
||||
.ToPagedList(query<#=tableName#>.PageIndex, query<#=tableName#>.PageSize, string.IsNullOrWhiteSpace(query<#=tableName#>.SortField) ? "Id" : query<#=tableName#>.SortField,
|
||||
hospitalSearchModel.Asc);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
<# } else {#>
|
||||
|
||||
public List<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>)
|
||||
{
|
||||
|
||||
|
||||
var <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable = _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository
|
||||
.Where(<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Lambda).ProjectTo<<#=tableName#>View>(_mapper.ConfigurationProvider);
|
||||
|
||||
return <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable.ToList();
|
||||
}
|
||||
<# }#>
|
||||
|
||||
|
||||
public IResponseOutput AddOrUpdate<#=tableName#>(<#=tableName#>AddOrEdit addOrEdit<#=tableName#>)
|
||||
{
|
||||
// 在此处拷贝automapper 映射
|
||||
// CreateMap<<#=tableName#>AddOrEdit, <#=tableName#>>();
|
||||
// CreateMap< <#=tableName#>,<#=tableName#>AddOrEdit>();
|
||||
|
||||
var entity = _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.UseMapper(_mapper).InsertOrUpdate(addOrEdit<#=tableName#>, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id:guid}")]
|
||||
public IResponseOutput Delete<#=tableName#>(Guid <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id)
|
||||
{
|
||||
var success = _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.Delete(t => t.Id == <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id);
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
<#
|
||||
manager.EndBlock();
|
||||
}
|
||||
manager.Process(true);
|
||||
#>
|
|
@ -0,0 +1,60 @@
|
|||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-09-04 14:41:20
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// UserFeedBackService
|
||||
/// </summary>
|
||||
[ ApiExplorerSettings(GroupName = "Test")]
|
||||
public class UserFeedBackService(IRepository<UserFeedBack> _userFeedBackRepository): BaseService, IUserFeedBackService
|
||||
{
|
||||
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<UserFeedBackView>> GetUserFeedBackList(UserFeedBackQuery inQuery)
|
||||
{
|
||||
|
||||
var userFeedBackQueryable =
|
||||
|
||||
_userFeedBackRepository
|
||||
.ProjectTo<UserFeedBackView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList= await userFeedBackQueryable.ToPagedListAsync(inQuery);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateUserFeedBack(UserFeedBackAddOrEdit addOrEditUserFeedBack)
|
||||
{
|
||||
// 在此处拷贝automapper 映射
|
||||
|
||||
|
||||
CreateMap<UserFeedBack, UserFeedBackView>();
|
||||
// CreateMap< UserFeedBack,UserFeedBackAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
var entity = await _userFeedBackRepository.InsertOrUpdateAsync(addOrEditUserFeedBack, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{userFeedBackId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteUserFeedBack(Guid userFeedBackId)
|
||||
{
|
||||
var success = await _userFeedBackRepository.DeleteFromQueryAsync(t => t.Id == userFeedBackId,true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
//using NUnit.Framework;
|
||||
|
||||
//namespace IRaCIS.Core.Test
|
||||
//{
|
||||
// public class Tests
|
||||
// {
|
||||
// [SetUp]
|
||||
// public void Setup()
|
||||
// {
|
||||
// }
|
||||
|
||||
// [Test]
|
||||
// public void Test1()
|
||||
// {
|
||||
// Assert.Pass();
|
||||
// }
|
||||
// }
|
||||
//}
|
Loading…
Reference in New Issue