完成模板模块,但配置类有问题
This commit is contained in:
@@ -19,6 +19,8 @@ namespace Yi.Framework.Core.Sqlsugar.Extensions
|
||||
var db = app.ApplicationServices.GetRequiredService<ISqlSugarClient>();
|
||||
var options = app.ApplicationServices.GetRequiredService<IOptions<DbConnOptions>>();
|
||||
|
||||
//if (options.Value.EnabledCodeFirst == false) return;
|
||||
|
||||
var assemblys = new List<Assembly>();
|
||||
|
||||
//全盘加载
|
||||
|
||||
@@ -16,7 +16,7 @@ using Yi.Framework.Ddd.Repositories;
|
||||
namespace Yi.Framework.Core.Sqlsugar.Repositories
|
||||
{
|
||||
[AppService(ServiceType = typeof(IRepository<>))]
|
||||
public class SqlsugarRepository<T> : SimpleClient<T>, IRepository<T> where T : class, IEntity, new()
|
||||
public class SqlsugarRepository<T> : SimpleClient<T>, IRepository<T> where T : class, new()
|
||||
{
|
||||
public SqlsugarRepository(ISqlSugarClient context) : base(context)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Yi.Framework.Core.Sqlsugar
|
||||
|
||||
//这里替换过滤器实现
|
||||
services.AddScoped<IDataFilter, SqlsugarDataFilter>();
|
||||
var ss= Appsettings.appConfiguration("DbConnOptions", "EnabledCodeFirst");
|
||||
services.Configure<DbConnOptions>(Appsettings.appConfiguration("DbConnOptions"));
|
||||
services.AddSqlsugarServer();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.Framework.Ddd.Repositories
|
||||
{
|
||||
public interface IRepository<T> where T : class, IEntity, new()
|
||||
public interface IRepository<T>
|
||||
{
|
||||
//单查
|
||||
Task<T> GetByIdAsync(dynamic id);
|
||||
|
||||
@@ -75,7 +75,7 @@ where TEntityDto : IEntityDto<TKey>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 全查
|
||||
/// 多查
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Ddd.Services.ReadOnlyAppService`5.GetListAsync(`4)">
|
||||
<summary>
|
||||
全查
|
||||
多查
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Template.Abstracts
|
||||
namespace Yi.Framework.Template.Abstract
|
||||
{
|
||||
public abstract class AbstractTemplateProvider : ITemplateProvider
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Template.Abstracts
|
||||
namespace Yi.Framework.Template.Abstract
|
||||
{
|
||||
public interface ITemplateProvider
|
||||
{
|
||||
@@ -5,14 +5,14 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Abstracts
|
||||
namespace Yi.Framework.Template.Abstract
|
||||
{
|
||||
public abstract class ModelTemplateProvider : ProgramTemplateProvider
|
||||
{
|
||||
|
||||
public ModelTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
AddIgnoreEntityField("Id", "TenantId");
|
||||
AddIgnoreEntityField(/*"Id", */"TenantId", "IsDeleted");
|
||||
}
|
||||
|
||||
private string entityPath=string.Empty;
|
||||
@@ -59,19 +59,27 @@ namespace Yi.Framework.Template.Abstracts
|
||||
continue;
|
||||
}
|
||||
//是字段属性,同时还包含忽略字段
|
||||
bool IsSkip = false;
|
||||
|
||||
foreach (var IgnoreEntityField in IgnoreEntityFields)
|
||||
{
|
||||
if (enetityDatas[i].Contains(IgnoreEntityField))
|
||||
{
|
||||
enetityDatas.RemoveAt(i);
|
||||
continue;
|
||||
IsSkip=true;
|
||||
break;;
|
||||
}
|
||||
}
|
||||
//以}结尾,不包含get不是属性,代表类结尾
|
||||
if (enetityDatas[i].EndsWith("}") && !enetityDatas[i].Contains("get"))
|
||||
|
||||
if (!IsSkip)
|
||||
{
|
||||
break;
|
||||
//以}结尾,不包含get不是属性,代表类结尾
|
||||
if (enetityDatas[i].EndsWith("}") && !enetityDatas[i].Contains("get"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//拼接实体字段
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Abstracts
|
||||
namespace Yi.Framework.Template.Abstract
|
||||
{
|
||||
|
||||
public abstract class ProgramTemplateProvider : AbstractTemplateProvider
|
||||
@@ -33,6 +33,10 @@ namespace Yi.Framework.Template.ConstClasses
|
||||
/// </summary>
|
||||
public const string EntityField = "#EntityField#";
|
||||
|
||||
public const string BuildRootPath = "";
|
||||
//public const string BuildRootPath = "../../../_Code";
|
||||
|
||||
|
||||
public const string BuildRootPath = "../../../../../project";
|
||||
public const string BuildEntityPath = "../../../../../project";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ TemplateFactory templateFactory = new();
|
||||
|
||||
//选择需要生成的模板提供者
|
||||
|
||||
string modelName = "";
|
||||
List<string> entityNames = new() { "_" };
|
||||
string modelName = "School";
|
||||
List<string> entityNames = new() { "Student" };
|
||||
|
||||
foreach (var entityName in entityNames)
|
||||
{
|
||||
@@ -16,17 +16,17 @@ foreach (var entityName in entityNames)
|
||||
option.Add(new ServiceTemplateProvider(modelName, entityName));
|
||||
option.Add(new IServiceTemplateProvider(modelName, entityName));
|
||||
|
||||
|
||||
option.Add(new CreateInputVoTemplateProvider(modelName, entityName));
|
||||
option.Add(new UpdateInputVoTemplateProvider(modelName, entityName));
|
||||
option.Add(new GetListInputVoTemplateProvider(modelName, entityName));
|
||||
option.Add(new GetListOutputDtoTemplateProvider(modelName, entityName));
|
||||
option.Add(new GetOutputDtoTemplateProvider(modelName, entityName));
|
||||
|
||||
option.Add(new ConstTemplateProvider(modelName, entityName));
|
||||
option.Add(new ProfileTemplateProvider(modelName, entityName));
|
||||
|
||||
|
||||
option.Add(new ApiTemplateProvider(modelName, entityName));
|
||||
//option.Add(new ApiTemplateProvider(modelName, entityName));
|
||||
});
|
||||
//开始构建模板
|
||||
templateFactory.BuildTemplate();
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
@@ -12,7 +12,7 @@ namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public ConstTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.DtoModel\{TemplateConst.ModelName}\{TemplateConst.EntityName}\ConstConfig\{TemplateConst.EntityName}Const.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Domain.Shared\{TemplateConst.ModelName}\ConstClasses\{TemplateConst.EntityName}Const.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\ConstTemplate.txt";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
@@ -12,9 +12,9 @@ namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public CreateInputVoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.DtoModel\{TemplateConst.ModelName}\{TemplateConst.EntityName}\{TemplateConst.EntityName}CreateInput.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\CreateInputTemplate.txt";
|
||||
EntityPath = $@"..\..\..\..\Yi.Framework.Model\{TemplateConst.ModelName}\Entitys\{TemplateConst.EntityName}Entity.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}CreateInputVo.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\CreateInputVoTemplate.txt";
|
||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,18 +3,18 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public class GetListInputTemplateProvider : ModelTemplateProvider
|
||||
public class GetListInputVoTemplateProvider : ModelTemplateProvider
|
||||
{
|
||||
public GetListInputTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
public GetListInputVoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.DtoModel\{TemplateConst.ModelName}\{TemplateConst.EntityName}\{TemplateConst.EntityName}GetListInput.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\GetListInputTemplate.txt";
|
||||
EntityPath = $@"..\..\..\..\Yi.Framework.Model\{TemplateConst.ModelName}\Entitys\{TemplateConst.EntityName}Entity.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}GetListInputVo.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\GetListInputVoTemplate.txt";
|
||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,18 +3,18 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public class GetListOutputTemplateProvider : ModelTemplateProvider
|
||||
public class GetListOutputDtoTemplateProvider : ModelTemplateProvider
|
||||
{
|
||||
public GetListOutputTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
public GetListOutputDtoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.DtoModel\{TemplateConst.ModelName}\{TemplateConst.EntityName}\{TemplateConst.EntityName}GetListOutput.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\GetListOutputTemplate.txt";
|
||||
EntityPath = $@"..\..\..\..\Yi.Framework.Model\{TemplateConst.ModelName}\Entitys\{TemplateConst.EntityName}Entity.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}GetListOutputDto.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\GetListOutputDtoTemplate.txt";
|
||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
@@ -12,9 +12,9 @@ namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public GetOutputDtoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.DtoModel\{TemplateConst.ModelName}\{TemplateConst.EntityName}\{TemplateConst.EntityName}GetOutputDto.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}\{TemplateConst.EntityName}GetOutputDto.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\GetOutputDtoTemplate.txt";
|
||||
EntityPath = $@"..\..\..\..\Yi.Framework.Model\{TemplateConst.ModelName}\Entitys\{TemplateConst.EntityName}Entity.cs";
|
||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
@@ -12,7 +12,7 @@ namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public IServiceTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.Interface\{TemplateConst.ModelName}\I{TemplateConst.EntityName}Service.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\I{TemplateConst.EntityName}Service.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\IServiceTemplate.txt";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
@@ -12,7 +12,7 @@ namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public ProfileTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.DtoModel\{TemplateConst.ModelName}\{TemplateConst.EntityName}\MapperConfig\{TemplateConst.EntityName}Profile.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application\{TemplateConst.ModelName}\MapperConfig\{TemplateConst.EntityName}Profile.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\ProfileTemplate.txt";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
@@ -12,7 +12,7 @@ namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public ServiceTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.Service\{TemplateConst.ModelName}\{TemplateConst.EntityName}Service.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application\{TemplateConst.ModelName}\{TemplateConst.EntityName}Service.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\ServiceTemplate.txt";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Server
|
||||
@@ -12,9 +12,9 @@ namespace Yi.Framework.Template.Provider.Server
|
||||
{
|
||||
public UpdateInputVoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
||||
{
|
||||
BuildPath = $@"..\..\..\..\Yi.Framework.DtoModel\{TemplateConst.ModelName}\{TemplateConst.EntityName}\{TemplateConst.EntityName}UpdateInputVo.cs";
|
||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}UpdateInputVo.cs";
|
||||
TemplatePath = $@"..\..\..\Template\Server\UpdateInputVoTemplate.txt";
|
||||
EntityPath = $@"..\..\..\..\Yi.Framework.Model\{TemplateConst.ModelName}\Entitys\{TemplateConst.EntityName}Entity.cs";
|
||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.ConstClasses;
|
||||
|
||||
namespace Yi.Framework.Template.Provider.Site
|
||||
|
||||
@@ -4,8 +4,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.#ModelName#.#EntityName#.ConstConfig
|
||||
namespace Yi.Framework.Domain.Shared.#ModelName#.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class #EntityName#Const
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.#ModelName#.#EntityName#
|
||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
||||
{
|
||||
public class #EntityName#CreateUpdateInput : EntityDto<long>
|
||||
/// <summary>
|
||||
/// #EntityName#输入创建对象
|
||||
/// </summary>
|
||||
public class #EntityName#CreateInputVo
|
||||
{
|
||||
#EntityField#
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.DtoModel.#ModelName#.#EntityName#
|
||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
||||
{
|
||||
public class #EntityName#GetListInput
|
||||
public class #EntityName#GetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
#EntityField#
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.DtoModel.#ModelName#.#EntityName#
|
||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
||||
{
|
||||
public class #EntityName#GetListOutput: EntityDto<long>
|
||||
public class #EntityName#GetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
#EntityField#
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.DtoModel.#ModelName#.#EntityName#
|
||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
||||
{
|
||||
public class #EntityName#GetListOutput: EntityDto<long>
|
||||
public class #EntityName#GetOutputDto : IEntityDto<long>
|
||||
{
|
||||
#EntityField#
|
||||
}
|
||||
|
||||
@@ -3,14 +3,16 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.#ModelName#.#EntityName#;
|
||||
using Yi.Framework.Interface.Base.Crud;
|
||||
using Yi.Framework.Application.Contracts.#ModelName#.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.Framework.Interface.#ModelName#
|
||||
namespace Yi.Framework.Application.Contracts.#ModelName#
|
||||
{
|
||||
public interface I#EntityName#Service : ICrudAppService<#EntityName#GetListOutput, long, #EntityName#CreateUpdateInput>
|
||||
/// <summary>
|
||||
/// #EntityName#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public interface I#EntityName#Service : ICrudAppService<#EntityName#GetOutputDto, #EntityName#GetListOutputDto, long, #EntityName#GetListInputVo, #EntityName#CreateInputVo, #EntityName#UpdateInputVo>
|
||||
{
|
||||
Task<PageModel<List<#EntityName#GetListOutput>>> PageListAsync(#EntityName#GetListInput input, PageParModel page);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,20 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.#ModelName#.Entitys;
|
||||
using Yi.Framework.Application.Contracts.#ModelName#.Dtos;
|
||||
using Yi.Framework.Domain.#ModelName#.Entities;
|
||||
|
||||
namespace Yi.Framework.DtoModel.#ModelName#.#EntityName#.MapperConfig
|
||||
namespace Yi.Framework.Application.#ModelName#.MapperConfig
|
||||
{
|
||||
public class Suppli#ModelName#rofile:Profile
|
||||
public class #EntityName#Profile: Profile
|
||||
{
|
||||
public Suppli#ModelName#rofile()
|
||||
public #EntityName#Profile()
|
||||
{
|
||||
CreateMap<#EntityName#CreateUpdateInput, #EntityName#Entity>();
|
||||
CreateMap<#EntityName#Entity, #EntityName#GetListOutput>();
|
||||
|
||||
CreateMap<#EntityName#GetListInputVo, #EntityName#Entity>();
|
||||
CreateMap<#EntityName#CreateInputVo, #EntityName#Entity>();
|
||||
CreateMap<#EntityName#UpdateInputVo, #EntityName#Entity>();
|
||||
CreateMap<#EntityName#Entity, #EntityName#GetListOutputDto>();
|
||||
CreateMap<#EntityName#Entity, #EntityName#GetOutputDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
using AutoMapper;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.#ModelName#.#EntityName#;
|
||||
using Yi.Framework.Interface.#ModelName#;
|
||||
using Yi.Framework.Model.#ModelName#.Entitys;
|
||||
using Yi.Framework.Repository;
|
||||
using Yi.Framework.Service.Base.Crud;
|
||||
using Yi.Framework.Application.Contracts.#ModelName#;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.Framework.Application.Contracts.#ModelName#.Dtos;
|
||||
using Yi.Framework.Domain.#ModelName#.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.Framework.Service.#ModelName#
|
||||
namespace Yi.Framework.Application.#ModelName#
|
||||
{
|
||||
public class #EntityName#Service : CrudAppService<#EntityName#Entity, #EntityName#GetListOutput, long, #EntityName#CreateUpdateInput>, I#EntityName#Service
|
||||
/// <summary>
|
||||
/// #EntityName#服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class #EntityName#Service : CrudAppService<#EntityName#Entity, #EntityName#GetOutputDto, #EntityName#GetListOutputDto, long, #EntityName#GetListInputVo, #EntityName#CreateInputVo, #EntityName#UpdateInputVo>,
|
||||
I#EntityName#Service, IAutoApiService
|
||||
{
|
||||
public async Task<PageModel<List<#EntityName#GetListOutput>>> PageListAsync(#EntityName#GetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
.WhereIF(input.Code is not null,u=>u.Code.Contains(input.Code))
|
||||
.WhereIF(input.Name is not null, u => u.Name.Contains(input.Name))
|
||||
.ToPageListAsync(page.PageNum, page.PageSize, totalNumber);
|
||||
return new PageModel<List<#EntityName#GetListOutput>> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.#ModelName#.#EntityName#
|
||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
||||
{
|
||||
public class #EntityName#CreateUpdateInput : EntityDto<long>
|
||||
public class #EntityName#UpdateInputVo
|
||||
{
|
||||
#EntityField#
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Template.Abstracts;
|
||||
using Yi.Framework.Template.Abstract;
|
||||
using Yi.Framework.Template.Provider;
|
||||
|
||||
namespace Yi.Framework.Template
|
||||
|
||||
@@ -11,16 +11,19 @@
|
||||
<None Update="Template\Server\ConstTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\Server\ControllerTemplate.txt">
|
||||
<None Update="Template\Server\GetOutputDtoTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\Server\CreateUpdateInputTemplate.txt">
|
||||
<None Update="Template\Server\UpdateInputVoTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\Server\GetListInputTemplate.txt">
|
||||
<None Update="Template\Server\CreateInputVoTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\Server\GetListOutputTemplate.txt">
|
||||
<None Update="Template\Server\GetListInputVoTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\Server\GetListOutputDtoTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\Server\IServiceTemplate.txt">
|
||||
|
||||
@@ -4,19 +4,14 @@
|
||||
<name>Yi.Framework.Application.Contracts</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Yi.Framework.Application.Contracts.Student.Dtos.StudentCreateInputVo">
|
||||
<member name="T:Yi.Framework.Application.Contracts.School.Dtos.StudentCreateInputVo">
|
||||
<summary>
|
||||
Student输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Application.Contracts.Student.Dtos.StudentGetListOutputDto.IsDeleted">
|
||||
<member name="T:Yi.Framework.Application.Contracts.School.IStudentService">
|
||||
<summary>
|
||||
想看一下结果
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Application.Contracts.Student.IStudentService">
|
||||
<summary>
|
||||
服务抽象
|
||||
Student<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.Student.Dtos
|
||||
namespace Yi.Framework.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public long Number { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,19 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.Student.Dtos
|
||||
namespace Yi.Framework.Application.Contracts.School.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Student输入创建对象
|
||||
/// </summary>
|
||||
public class StudentCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public long Number { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,17 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.Student.Dtos
|
||||
namespace Yi.Framework.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public long Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 想看一下结果
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.School.Dtos
|
||||
{
|
||||
public class StudentUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Application.Contracts.Student.Dtos;
|
||||
using Yi.Framework.Application.Contracts.School.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.Student
|
||||
namespace Yi.Framework.Application.Contracts.School
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务抽象
|
||||
/// Student<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public interface IStudentService : ICrudAppService<StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>
|
||||
{
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.Student.Dtos
|
||||
{
|
||||
public class StudentGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
|
||||
public long? Number { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Application.Contracts.Student.Dtos
|
||||
{
|
||||
public class StudentUpdateInputVo
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
|
||||
public long? Number { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
<DocumentationFile>./ApplicationContractsSwaggerDoc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj" />
|
||||
|
||||
@@ -4,29 +4,10 @@
|
||||
<name>Yi.Framework.Application</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Yi.Framework.Application.Student.StudentService">
|
||||
<member name="T:Yi.Framework.Application.School.StudentService">
|
||||
<summary>
|
||||
服务实现
|
||||
Student服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Application.Student.StudentService.GetDataFiterTestAsync(Yi.Framework.Application.Contracts.Student.Dtos.StudentGetListInputVo)">
|
||||
<summary>
|
||||
数据过滤测试
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Application.Student.StudentService.GetToken">
|
||||
<summary>
|
||||
测试token
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Application.Student.StudentService.PostUow">
|
||||
<summary>
|
||||
Uow
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using AutoMapper;
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Application.Contracts.Student.Dtos;
|
||||
using Yi.Framework.Domain.Student.Entities;
|
||||
using Yi.Framework.Application.Contracts.School.Dtos;
|
||||
using Yi.Framework.Domain.School.Entities;
|
||||
|
||||
namespace Yi.Framework.Application.Student.MapperConfig
|
||||
namespace Yi.Framework.Application.School.MapperConfig
|
||||
{
|
||||
public class StudentProfile: Profile
|
||||
{
|
||||
@@ -0,0 +1,17 @@
|
||||
using Yi.Framework.Application.Contracts.School;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.Framework.Application.Contracts.School.Dtos;
|
||||
using Yi.Framework.Domain.School.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.Framework.Application.School
|
||||
{
|
||||
/// <summary>
|
||||
/// Student服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class StudentService : CrudAppService<StudentEntity, StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>,
|
||||
IStudentService, IAutoApiService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Application.Contracts.Student;
|
||||
using Yi.Framework.Domain.Student;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
using Yi.Framework.Application.Contracts.Student.Dtos;
|
||||
using Yi.Framework.Domain.Student.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Uow;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Yi.Framework.Auth.JwtBearer.Authentication;
|
||||
using Yi.Framework.Core.Const;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.Auth.JwtBearer.Authorization;
|
||||
using Yi.Framework.Domain.Shared.Student.ConstClasses;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
using Yi.Framework.Data.Filters;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.Framework.Application.Student
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务实现
|
||||
/// </summary>
|
||||
|
||||
[AppService]
|
||||
public class StudentService : CrudAppService<StudentEntity, StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>,
|
||||
IStudentService, IAutoApiService
|
||||
{
|
||||
private readonly IStudentRepository _studentRepository;
|
||||
private readonly StudentManager _studentManager;
|
||||
private readonly IUnitOfWorkManager _unitOfWorkManager;
|
||||
private readonly JwtTokenManager _jwtTokenManager;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IDataFilter _dataFilter;
|
||||
public StudentService(IStudentRepository studentRepository, StudentManager studentManager, IUnitOfWorkManager unitOfWorkManager, JwtTokenManager jwtTokenManager, ICurrentUser currentUser, IDataFilter dataFilter)
|
||||
{
|
||||
_studentRepository = studentRepository;
|
||||
_studentManager = studentManager;
|
||||
_unitOfWorkManager = unitOfWorkManager;
|
||||
_jwtTokenManager = jwtTokenManager;
|
||||
_currentUser = currentUser;
|
||||
_dataFilter = dataFilter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据过滤测试
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PagedResultDto<StudentGetListOutputDto>> GetDataFiterTestAsync(StudentGetListInputVo input)
|
||||
{
|
||||
PagedResultDto<StudentGetListOutputDto> res = new();
|
||||
using (_dataFilter.Disable<ISoftDelete>())
|
||||
{
|
||||
|
||||
res = await base.GetListAsync(input);
|
||||
|
||||
|
||||
}
|
||||
|
||||
var p = await base.GetListAsync(input);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试token
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetToken()
|
||||
{
|
||||
var claimDic = new Dictionary<string, object>() { { TokenTypeConst.Id, "123" }, { TokenTypeConst.UserName, "cc" } };
|
||||
return _jwtTokenManager.CreateToken(claimDic);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uow
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
[Permission(AuthStudentConst.查询)]
|
||||
public async Task<StudentGetOutputDto> PostUow()
|
||||
{
|
||||
var o = _currentUser;
|
||||
StudentGetOutputDto res = new();
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var studentRepository = uow.GetRepository<StudentEntity>();
|
||||
res = await base.CreateAsync(new StudentCreateInputVo { Name = $"老杰哥{DateTime.Now.ToString("ffff")}", Number = 2023 });
|
||||
if (new Random().Next(0, 2) == 0) throw new NotImplementedException();
|
||||
uow.Commit();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,11 @@
|
||||
<DocumentationFile>./ApplicationSwaggerDoc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\framework\Yi.Framework.Auth.JwtBearer\Yi.Framework.Auth.JwtBearer.csproj" />
|
||||
<ProjectReference Include="..\..\src\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Auth.JwtBearer\Yi.Framework.Auth.JwtBearer.csproj" />
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Application.Contracts\Yi.Framework.Application.Contracts.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Domain\Yi.Framework.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -7,8 +7,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Application.Contracts;
|
||||
using Yi.Framework.Application.Contracts.Student;
|
||||
using Yi.Framework.Application.Student;
|
||||
using Yi.Framework.Auth.JwtBearer;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Data;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
global using Yi.Framework.Core.Attributes;
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Domain.Shared.Student.ConstClasses
|
||||
namespace Yi.Framework.Domain.Shared.School.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
@@ -12,6 +12,5 @@ namespace Yi.Framework.Domain.Shared.Student.ConstClasses
|
||||
|
||||
public class StudentConst
|
||||
{
|
||||
public const string 学生已重复 = "失败!学生已经重复";
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Domain.Shared.Student.ConstClasses
|
||||
{
|
||||
public class AuthStudentConst
|
||||
{
|
||||
public const string 查询 = "student:student:list";
|
||||
public const string 添加 = "student:student:add";
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,35 +4,5 @@
|
||||
<name>Yi.Framework.Domain</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Yi.Framework.Domain.Student.Entities.StudentEntity">
|
||||
<summary>
|
||||
学生实体
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Domain.Student.Entities.StudentEntity.Name">
|
||||
<summary>
|
||||
学生名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Domain.Student.Entities.StudentEntity.Number">
|
||||
<summary>
|
||||
学号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Domain.Student.Entities.StudentEntity.IsDeleted">
|
||||
<summary>
|
||||
软删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Domain.Student.Repositories.IStudentRepository">
|
||||
<summary>
|
||||
仓储抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Domain.Student.StudentManager">
|
||||
<summary>
|
||||
领域服务
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.Framework.Domain.School.Entities
|
||||
{
|
||||
[SugarTable("Student")]
|
||||
public class StudentEntity : IEntity<long>,ISoftDelete
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int? Height { get; set; }
|
||||
|
||||
public string? Phone { get; set; }
|
||||
public bool IsDeleted { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.Framework.Domain.Student.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 学生实体
|
||||
/// </summary>
|
||||
[SugarTable("Student")]
|
||||
public class StudentEntity : IEntity<long>, ISoftDelete
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学生名称
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 学号
|
||||
/// </summary>
|
||||
public long Number { get;set ; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.Framework.Domain.Student.Entities;
|
||||
|
||||
namespace Yi.Framework.Domain.Student.Repositories
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓储抽象
|
||||
/// </summary>
|
||||
public interface IStudentRepository : IRepository<StudentEntity>
|
||||
{
|
||||
Task<List<StudentEntity>> GetMyListAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
|
||||
namespace Yi.Framework.Domain.Student
|
||||
{
|
||||
/// <summary>
|
||||
/// 领域服务
|
||||
/// </summary>
|
||||
public class StudentManager
|
||||
{
|
||||
private readonly IStudentRepository _studentRepository;
|
||||
public StudentManager(IStudentRepository studentRepository)
|
||||
{
|
||||
_studentRepository=studentRepository;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@
|
||||
<DocumentationFile>./DomainSwaggerDoc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Data;
|
||||
using Yi.Framework.Domain.Shared;
|
||||
using Yi.Framework.Domain.Student;
|
||||
|
||||
namespace Yi.Framework.Domain
|
||||
{
|
||||
@@ -25,7 +24,7 @@ namespace Yi.Framework.Domain
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
services.AddTransient<StudentManager>();
|
||||
//services.AddTransient<StudentManager>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//using SqlSugar;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Yi.Framework.Core.Sqlsugar.Repositories;
|
||||
//using Yi.Framework.Domain.Teacher.Entities;
|
||||
//using Yi.Framework.Domain.Teacher.Repositories;
|
||||
|
||||
//namespace Yi.Framework.Sqlsugar.Teacher
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 仓储实现方式
|
||||
// /// </summary>
|
||||
// public class StudentRepository : SqlsugarRepository<StudentEntity>, IStudentRepository
|
||||
// {
|
||||
// public StudentRepository(ISqlSugarClient context) : base(context)
|
||||
// {
|
||||
// }
|
||||
|
||||
// public async Task<List<StudentEntity>> GetMyListAsync()
|
||||
// {
|
||||
// return await _DbQueryable.ToListAsync();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,27 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Sqlsugar.Repositories;
|
||||
using Yi.Framework.Domain.Student.Entities;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
|
||||
namespace Yi.Framework.Sqlsugar.Student
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓储实现方式
|
||||
/// </summary>
|
||||
public class StudentRepository : SqlsugarRepository<StudentEntity>, IStudentRepository
|
||||
{
|
||||
public StudentRepository(ISqlSugarClient context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<StudentEntity>> GetMyListAsync()
|
||||
{
|
||||
return await _DbQueryable.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\framework\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj" />
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Domain\Yi.Framework.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Core.Sqlsugar;
|
||||
using Yi.Framework.Domain;
|
||||
using Yi.Framework.Domain.Student.Repositories;
|
||||
using Yi.Framework.Sqlsugar.Student;
|
||||
|
||||
namespace Yi.Framework.Sqlsugar
|
||||
{
|
||||
@@ -24,7 +22,7 @@ namespace Yi.Framework.Sqlsugar
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
services.AddTransient<IStudentRepository, StudentRepository>();
|
||||
//services.AddTransient<IStudentRepository, StudentRepository>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ builder.WebHost.UseStartUrlsServer(builder.Configuration);
|
||||
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
builder.UseYiModules(typeof(YiFrameworkWebModule));
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>autofacģ<63><C4A3>,<2C><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
builder.Host.ConfigureAutoFacContainer(container =>
|
||||
{
|
||||
|
||||
@@ -75,3 +75,11 @@
|
||||
2023:01:20-18:53:16本次运行启动时间为:5186毫秒
|
||||
2023:01:20-19:01:36本次运行启动时间为:5194毫秒
|
||||
2023:01:21-15:04:00本次运行启动时间为:7763毫秒
|
||||
2023:01:21-18:34:52本次运行启动时间为:2507毫秒
|
||||
2023:01:21-22:17:17本次运行启动时间为:2137毫秒
|
||||
2023:01:21-22:18:22本次运行启动时间为:2040毫秒
|
||||
2023:01:21-22:20:13本次运行启动时间为:1611毫秒
|
||||
2023:01:21-22:20:37本次运行启动时间为:1525毫秒
|
||||
2023:01:21-22:21:52本次运行启动时间为:1563毫秒
|
||||
2023:01:21-22:29:30本次运行启动时间为:9099毫秒
|
||||
2023:01:21-22:30:38本次运行启动时间为:2136毫秒
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\framework\Yi.Framework.Core.Autofac\Yi.Framework.Core.Autofac.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Application\Yi.Framework.Application.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Sqlsugar\Yi.Framework.Sqlsugar.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"DbType": "Sqlite",
|
||||
"EnabledDbSeed": false,
|
||||
"EnabledReadWrite": false,
|
||||
"EnabledCodeFirst": false,
|
||||
"EnabledCodeFirst": true,
|
||||
"EntityAssembly": null,
|
||||
"ReadUrl": [
|
||||
"DataSource=[xxxx]", //sqlite
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user