diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude index d33e52c37..cc5fddb73 100644 --- a/IRaCIS.Core.Test/DbHelper.ttinclude +++ b/IRaCIS.Core.Test/DbHelper.ttinclude @@ -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().Select(row =>row.Field("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().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().Select(row => new DbColumn() { diff --git a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj index 0be844e14..a43f6707d 100644 --- a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj +++ b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj @@ -12,6 +12,8 @@ ..\bin + + IRaCIS .Core.ServiceAsync.cs @@ -25,22 +27,6 @@ TextTemplatingFileGenerator IRaCIS.Core.Dto.cs - - TextTemplatingFileGenerator - IRaCIS.Core.Services.cs - - - TextTemplatingFileGenerator - IRaCIS.Core.IServices.cs - - - TextTemplatingFileGenerator - IRaCIS.Core.Repository.cs - - - TextTemplatingFileGenerator - IRaCIS.Core.IRepository.cs - TextTemplatingFileGenerator IRaCIS.Core.Entity.cs @@ -67,26 +53,6 @@ True IRaCIS.Core.Dto.tt - - True - True - IRaCIS.Core.IRepository.tt - - - True - True - IRaCIS.Core.IServices.tt - - - True - True - IRaCIS.Core.Repository.tt - - - True - True - IRaCIS.Core.Services.tt - True True @@ -95,11 +61,9 @@ - - diff --git a/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs b/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs new file mode 100644 index 000000000..4c2f68b3a --- /dev/null +++ b/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs @@ -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 +{ + + /// UserFeedBackView 列表视图 + public class UserFeedBackView : UserFeedBackAddOrEdit + { + + + + + + + public Guid CreateUserId { get; set; } + + + public DateTime CreateTime { get; set; } + + + public Guid UpdateUserId { get; set; } + + + public DateTime UpdateTime { get; set; } + + + + + + + } + + ///UserFeedBackQuery 列表查询参数 + public class UserFeedBackQuery + { + public string QuestionDescription { get; set; } + public string ScreenshotListStr { get; set; } + } + + /// UserFeedBackAddOrEdit 添加编辑 + 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; } + + } + + +} + + diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt index cdca2030c..99090292f 100644 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt +++ b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt @@ -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 { diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.cs deleted file mode 100644 index aaed97b3f..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.cs +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.tt deleted file mode 100644 index f3285219b..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.tt +++ /dev/null @@ -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 -{ - /// - /// I<#=tableName#>Repository - /// - public interface I<#=tableName#>Repository : IRepository<<#=tableName#>> - { - - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> - - - - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.cs deleted file mode 100644 index fe5554c90..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.cs +++ /dev/null @@ -1,10 +0,0 @@ - - -//在这里设置 isPage 是否生成分页的还是不分页 - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt deleted file mode 100644 index 4c91654a8..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt +++ /dev/null @@ -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 -{ - /// - /// I<#=tableName#>Service - /// - 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); - #> - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.cs deleted file mode 100644 index b26f15449..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.cs +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.tt deleted file mode 100644 index 0ba20925a..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.tt +++ /dev/null @@ -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; -{ - /// - /// <#=tableName#>Repository - /// - public class <#=tableName#>Repository : Repository<<#=tableName#>>, IRepository<<#=tableName#>> - { - public <#=tableName#>Repository( IRaCISDBContext db) : base( db) - { - - } - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.cs deleted file mode 100644 index 2faa758b0..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.cs +++ /dev/null @@ -1,9 +0,0 @@ - - - - -//在这里设置 isPage 是否生成分页的还是不分页 - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.tt deleted file mode 100644 index 7b76254a2..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.tt +++ /dev/null @@ -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 -{ - /// - /// <#=tableName#>Service - /// - [ 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); - #> diff --git a/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs b/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs new file mode 100644 index 000000000..6acb33c57 --- /dev/null +++ b/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs @@ -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 +{ + /// + /// UserFeedBackService + /// + [ ApiExplorerSettings(GroupName = "Test")] + public class UserFeedBackService(IRepository _userFeedBackRepository): BaseService, IUserFeedBackService + { + + [HttpPost] + public async Task> GetUserFeedBackList(UserFeedBackQuery inQuery) + { + + var userFeedBackQueryable = + + _userFeedBackRepository + .ProjectTo(_mapper.ConfigurationProvider); + + var pageList= await userFeedBackQueryable.ToPagedListAsync(inQuery); + + return pageList; + } + + + public async Task AddOrUpdateUserFeedBack(UserFeedBackAddOrEdit addOrEditUserFeedBack) + { + // 在此处拷贝automapper 映射 + + + CreateMap(); + // CreateMap< UserFeedBack,UserFeedBackAddOrEdit>().ReverseMap(); + + + var entity = await _userFeedBackRepository.InsertOrUpdateAsync(addOrEditUserFeedBack, true); + + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + [HttpDelete("{userFeedBackId:guid}")] + public async Task DeleteUserFeedBack(Guid userFeedBackId) + { + var success = await _userFeedBackRepository.DeleteFromQueryAsync(t => t.Id == userFeedBackId,true); + return ResponseOutput.Ok(); + } + + + } +} diff --git a/IRaCIS.Core.Test/UnitTest1.cs b/IRaCIS.Core.Test/UnitTest1.cs deleted file mode 100644 index 1084bdf89..000000000 --- a/IRaCIS.Core.Test/UnitTest1.cs +++ /dev/null @@ -1,18 +0,0 @@ -//using NUnit.Framework; - -//namespace IRaCIS.Core.Test -//{ -// public class Tests -// { -// [SetUp] -// public void Setup() -// { -// } - -// [Test] -// public void Test1() -// { -// Assert.Pass(); -// } -// } -//} \ No newline at end of file