完成模板模块动态支持命名空间
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
using Yi.Framework.Template.ConstClasses;
|
using Yi.Framework.Template.ConstClasses;
|
||||||
|
|
||||||
namespace Yi.Framework.Template.Abstract
|
namespace Yi.Framework.Template.Abstract
|
||||||
@@ -10,7 +11,7 @@ namespace Yi.Framework.Template.Abstract
|
|||||||
public abstract class ModelTemplateProvider : ProgramTemplateProvider
|
public abstract class ModelTemplateProvider : ProgramTemplateProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
public ModelTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public ModelTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
AddIgnoreEntityField(/*"Id", */"TenantId", "IsDeleted");
|
AddIgnoreEntityField(/*"Id", */"TenantId", "IsDeleted");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,15 +10,23 @@ namespace Yi.Framework.Template.Abstract
|
|||||||
|
|
||||||
public abstract class ProgramTemplateProvider : AbstractTemplateProvider
|
public abstract class ProgramTemplateProvider : AbstractTemplateProvider
|
||||||
{
|
{
|
||||||
public ProgramTemplateProvider(string modelName, string entityName)
|
public ProgramTemplateProvider(string modelName, string entityName,string nameSpaces)
|
||||||
{
|
{
|
||||||
ModelName = modelName;
|
ModelName = modelName;
|
||||||
EntityName = entityName;
|
EntityName = entityName;
|
||||||
|
NameSpaces = nameSpaces;
|
||||||
|
base.AddTemplateDic(TemplateConst.NameSpaces, NameSpaces);
|
||||||
base.AddTemplateDic(TemplateConst.EntityName, EntityName);
|
base.AddTemplateDic(TemplateConst.EntityName, EntityName);
|
||||||
base.AddTemplateDic(TemplateConst.ModelName, ModelName);
|
base.AddTemplateDic(TemplateConst.ModelName, ModelName);
|
||||||
base.AddTemplateDic(TemplateConst.LowerEntityName, EntityName.Substring(0, 1).ToLower() + EntityName.Substring(1));
|
base.AddTemplateDic(TemplateConst.LowerEntityName, EntityName.Substring(0, 1).ToLower() + EntityName.Substring(1));
|
||||||
base.AddTemplateDic(TemplateConst.LowerModelName, ModelName.ToLower());
|
base.AddTemplateDic(TemplateConst.LowerModelName, ModelName.ToLower());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 命名空间
|
||||||
|
/// </summary>
|
||||||
|
public string NameSpaces { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实体名称
|
/// 实体名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ namespace Yi.Framework.Template.ConstClasses
|
|||||||
//public const string BuildRootPath = "../../../_Code";
|
//public const string BuildRootPath = "../../../_Code";
|
||||||
|
|
||||||
|
|
||||||
public const string BuildRootPath = "../../../../../project";
|
public const string NameSpaces = "#NameSpaces#";
|
||||||
public const string BuildEntityPath = "../../../../../project";
|
|
||||||
|
public const string BuildRootPath = "../../../../../project/bbs";
|
||||||
|
public const string BuildEntityPath = "../../../../../project/bbs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,23 +8,24 @@ TemplateFactory templateFactory = new();
|
|||||||
//选择需要生成的模板提供者
|
//选择需要生成的模板提供者
|
||||||
|
|
||||||
string modelName = "School";
|
string modelName = "School";
|
||||||
|
string nameSpaces = "Yi.BBS";
|
||||||
List<string> entityNames = new() { "Student" };
|
List<string> entityNames = new() { "Student" };
|
||||||
|
|
||||||
foreach (var entityName in entityNames)
|
foreach (var entityName in entityNames)
|
||||||
{
|
{
|
||||||
templateFactory.CreateTemplateProviders((option) =>
|
templateFactory.CreateTemplateProviders((option) =>
|
||||||
{
|
{
|
||||||
option.Add(new ServiceTemplateProvider(modelName, entityName));
|
option.Add(new ServiceTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
option.Add(new IServiceTemplateProvider(modelName, entityName));
|
option.Add(new IServiceTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
|
|
||||||
option.Add(new CreateInputVoTemplateProvider(modelName, entityName));
|
option.Add(new CreateInputVoTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
option.Add(new UpdateInputVoTemplateProvider(modelName, entityName));
|
option.Add(new UpdateInputVoTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
option.Add(new GetListInputVoTemplateProvider(modelName, entityName));
|
option.Add(new GetListInputVoTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
option.Add(new GetListOutputDtoTemplateProvider(modelName, entityName));
|
option.Add(new GetListOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
option.Add(new GetOutputDtoTemplateProvider(modelName, entityName));
|
option.Add(new GetOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
|
|
||||||
option.Add(new ConstTemplateProvider(modelName, entityName));
|
option.Add(new ConstTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
option.Add(new ProfileTemplateProvider(modelName, entityName));
|
option.Add(new ProfileTemplateProvider(modelName, entityName, nameSpaces));
|
||||||
//option.Add(new ApiTemplateProvider(modelName, entityName));
|
//option.Add(new ApiTemplateProvider(modelName, entityName));
|
||||||
});
|
});
|
||||||
//开始构建模板
|
//开始构建模板
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
internal class ConstTemplateProvider : ProgramTemplateProvider
|
internal class ConstTemplateProvider : ProgramTemplateProvider
|
||||||
{
|
{
|
||||||
public ConstTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public ConstTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Domain.Shared\{TemplateConst.ModelName}\ConstClasses\{TemplateConst.EntityName}Const.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Domain.Shared\{TemplateConst.ModelName}\ConstClasses\{TemplateConst.EntityName}Const.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\ConstTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\ConstTemplate.txt";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class CreateInputVoTemplateProvider : ModelTemplateProvider
|
public class CreateInputVoTemplateProvider : ModelTemplateProvider
|
||||||
{
|
{
|
||||||
public CreateInputVoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public CreateInputVoTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}CreateInputVo.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}CreateInputVo.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\CreateInputVoTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\CreateInputVoTemplate.txt";
|
||||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
EntityPath = $@"{TemplateConst.BuildEntityPath}\{nameSpaces}.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class GetListInputVoTemplateProvider : ModelTemplateProvider
|
public class GetListInputVoTemplateProvider : ModelTemplateProvider
|
||||||
{
|
{
|
||||||
public GetListInputVoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public GetListInputVoTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}GetListInputVo.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}GetListInputVo.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\GetListInputVoTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\GetListInputVoTemplate.txt";
|
||||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
EntityPath = $@"{TemplateConst.BuildEntityPath}\{nameSpaces}.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class GetListOutputDtoTemplateProvider : ModelTemplateProvider
|
public class GetListOutputDtoTemplateProvider : ModelTemplateProvider
|
||||||
{
|
{
|
||||||
public GetListOutputDtoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public GetListOutputDtoTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}GetListOutputDto.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}GetListOutputDto.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\GetListOutputDtoTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\GetListOutputDtoTemplate.txt";
|
||||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
EntityPath = $@"{TemplateConst.BuildEntityPath}\{nameSpaces}.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class GetOutputDtoTemplateProvider : ModelTemplateProvider
|
public class GetOutputDtoTemplateProvider : ModelTemplateProvider
|
||||||
{
|
{
|
||||||
public GetOutputDtoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public GetOutputDtoTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}\{TemplateConst.EntityName}GetOutputDto.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}\{TemplateConst.EntityName}GetOutputDto.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\GetOutputDtoTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\GetOutputDtoTemplate.txt";
|
||||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
EntityPath = $@"{TemplateConst.BuildEntityPath}\{nameSpaces}.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class IServiceTemplateProvider : ProgramTemplateProvider
|
public class IServiceTemplateProvider : ProgramTemplateProvider
|
||||||
{
|
{
|
||||||
public IServiceTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public IServiceTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\I{TemplateConst.EntityName}Service.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application.Contracts\{TemplateConst.ModelName}\I{TemplateConst.EntityName}Service.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\IServiceTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\IServiceTemplate.txt";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class ProfileTemplateProvider : ProgramTemplateProvider
|
public class ProfileTemplateProvider : ProgramTemplateProvider
|
||||||
{
|
{
|
||||||
public ProfileTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public ProfileTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application\{TemplateConst.ModelName}\MapperConfig\{TemplateConst.EntityName}Profile.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application\{TemplateConst.ModelName}\MapperConfig\{TemplateConst.EntityName}Profile.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\ProfileTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\ProfileTemplate.txt";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class ServiceTemplateProvider : ProgramTemplateProvider
|
public class ServiceTemplateProvider : ProgramTemplateProvider
|
||||||
{
|
{
|
||||||
public ServiceTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public ServiceTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application\{TemplateConst.ModelName}\{TemplateConst.EntityName}Service.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application\{TemplateConst.ModelName}\{TemplateConst.EntityName}Service.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\ServiceTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\ServiceTemplate.txt";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ namespace Yi.Framework.Template.Provider.Server
|
|||||||
{
|
{
|
||||||
public class UpdateInputVoTemplateProvider : ModelTemplateProvider
|
public class UpdateInputVoTemplateProvider : ModelTemplateProvider
|
||||||
{
|
{
|
||||||
public UpdateInputVoTemplateProvider(string modelName, string entityName) : base(modelName, entityName)
|
public UpdateInputVoTemplateProvider(string modelName, string entityName, string nameSpaces) : base(modelName, entityName, nameSpaces)
|
||||||
{
|
{
|
||||||
BuildPath = $@"{TemplateConst.BuildRootPath}\Yi.Framework.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}UpdateInputVo.cs";
|
BuildPath = $@"{TemplateConst.BuildRootPath}\{nameSpaces}.Application.Contracts\{TemplateConst.ModelName}\Dtos\{TemplateConst.EntityName}UpdateInputVo.cs";
|
||||||
TemplatePath = $@"..\..\..\Template\Server\UpdateInputVoTemplate.txt";
|
TemplatePath = $@"..\..\..\Template\Server\UpdateInputVoTemplate.txt";
|
||||||
EntityPath = $@"{TemplateConst.BuildEntityPath}\Yi.Framework.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
EntityPath = $@"{TemplateConst.BuildEntityPath}\{nameSpaces}.Domain\{TemplateConst.ModelName}\Entities\{TemplateConst.EntityName}Entity.cs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Yi.Framework.Domain.Shared.#ModelName#.ConstClasses
|
namespace #NameSpaces#.Domain.Shared.#ModelName#.ConstClasses
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 常量定义
|
/// 常量定义
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
namespace #NameSpaces#.Application.Contracts.#ModelName#.Dtos
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// #EntityName#输入创建对象
|
/// #EntityName#输入创建对象
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Yi.Framework.Ddd.Dtos;
|
using Yi.Framework.Ddd.Dtos;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
namespace #NameSpaces#.Application.Contracts.#ModelName#.Dtos
|
||||||
{
|
{
|
||||||
public class #EntityName#GetListInputVo : PagedAndSortedResultRequestDto
|
public class #EntityName#GetListInputVo : PagedAndSortedResultRequestDto
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Yi.Framework.Ddd.Dtos;
|
using Yi.Framework.Ddd.Dtos;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
namespace #NameSpaces#.Application.Contracts.#ModelName#.Dtos
|
||||||
{
|
{
|
||||||
public class #EntityName#GetListOutputDto : IEntityDto<long>
|
public class #EntityName#GetListOutputDto : IEntityDto<long>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Yi.Framework.Ddd.Dtos;
|
using Yi.Framework.Ddd.Dtos;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
namespace #NameSpaces#.Application.Contracts.#ModelName#.Dtos
|
||||||
{
|
{
|
||||||
public class #EntityName#GetOutputDto : IEntityDto<long>
|
public class #EntityName#GetOutputDto : IEntityDto<long>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Yi.Framework.Application.Contracts.#ModelName#.Dtos;
|
using #NameSpaces#.Application.Contracts.#ModelName#.Dtos;
|
||||||
using Yi.Framework.Ddd.Services.Abstract;
|
using Yi.Framework.Ddd.Services.Abstract;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.Contracts.#ModelName#
|
namespace #NameSpaces#.Application.Contracts.#ModelName#
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// #EntityName#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
/// #EntityName#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Yi.Framework.Application.Contracts.#ModelName#.Dtos;
|
using #NameSpaces#.Application.Contracts.#ModelName#.Dtos;
|
||||||
using Yi.Framework.Domain.#ModelName#.Entities;
|
using #NameSpaces#.Domain.#ModelName#.Entities;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.#ModelName#.MapperConfig
|
namespace #NameSpaces#.Application.#ModelName#.MapperConfig
|
||||||
{
|
{
|
||||||
public class #EntityName#Profile: Profile
|
public class #EntityName#Profile: Profile
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using Yi.Framework.Application.Contracts.#ModelName#;
|
using #NameSpaces#.Application.Contracts.#ModelName#;
|
||||||
using NET.AutoWebApi.Setting;
|
using NET.AutoWebApi.Setting;
|
||||||
using Yi.Framework.Application.Contracts.#ModelName#.Dtos;
|
using #NameSpaces#.Application.Contracts.#ModelName#.Dtos;
|
||||||
using Yi.Framework.Domain.#ModelName#.Entities;
|
using #NameSpaces#.Domain.#ModelName#.Entities;
|
||||||
using Yi.Framework.Ddd.Services;
|
using Yi.Framework.Ddd.Services;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.#ModelName#
|
namespace #NameSpaces#.Application.#ModelName#
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// #EntityName#服务实现
|
/// #EntityName#服务实现
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Yi.Framework.Application.Contracts.#ModelName#.Dtos
|
namespace #NameSpaces#.Application.Contracts.#ModelName#.Dtos
|
||||||
{
|
{
|
||||||
public class #EntityName#UpdateInputVo
|
public class #EntityName#UpdateInputVo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,17 +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.BBS.Application.Contracts.School.Dtos
|
|
||||||
{
|
|
||||||
public class StudentGetOutputDto : IEntityDto<long>
|
|
||||||
{
|
|
||||||
public long Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int? Height { get; set; }
|
|
||||||
public string? Phone { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.BBS.Application.Contracts.School.Dtos
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Student输入创建对象
|
|
||||||
/// </summary>
|
|
||||||
public class StudentCreateInputVo
|
|
||||||
{
|
|
||||||
public long Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int? Height { get; set; }
|
|
||||||
public string? Phone { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +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.BBS.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,17 +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.BBS.Application.Contracts.School.Dtos
|
|
||||||
{
|
|
||||||
public class StudentGetListOutputDto : IEntityDto<long>
|
|
||||||
{
|
|
||||||
public long Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int? Height { get; set; }
|
|
||||||
public string? Phone { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.BBS.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,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Yi.BBS.Application.Contracts.School.Dtos;
|
|
||||||
using Yi.Framework.Ddd.Services.Abstract;
|
|
||||||
|
|
||||||
namespace Yi.BBS.Application.Contracts.School
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Student
|
|
||||||
/// </summary>
|
|
||||||
public interface IStudentService : ICrudAppService<StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using AutoMapper;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Yi.BBS.Application.Contracts.School.Dtos;
|
|
||||||
using Yi.BBS.Domain.School.Entities;
|
|
||||||
|
|
||||||
namespace Yi.BBS.Application.School.MapperConfig
|
|
||||||
{
|
|
||||||
public class StudentProfile: Profile
|
|
||||||
{
|
|
||||||
public StudentProfile()
|
|
||||||
{
|
|
||||||
CreateMap<StudentGetListInputVo, StudentEntity>();
|
|
||||||
CreateMap<StudentCreateInputVo, StudentEntity>();
|
|
||||||
CreateMap<StudentUpdateInputVo, StudentEntity>();
|
|
||||||
CreateMap<StudentEntity, StudentGetListOutputDto>();
|
|
||||||
CreateMap<StudentEntity, StudentGetOutputDto>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
using Yi.BBS.Application.Contracts.School;
|
|
||||||
using NET.AutoWebApi.Setting;
|
|
||||||
using Yi.BBS.Application.Contracts.School.Dtos;
|
|
||||||
using Yi.BBS.Domain.School.Entities;
|
|
||||||
using Yi.Framework.Ddd.Services;
|
|
||||||
|
|
||||||
namespace Yi.BBS.Application.School
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Student服务实现
|
|
||||||
/// </summary>
|
|
||||||
[AppService]
|
|
||||||
public class StudentService : CrudAppService<StudentEntity, StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>,
|
|
||||||
IStudentService, IAutoApiService
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.BBS.Domain.Shared.School.ConstClasses
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 常量定义
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
public class StudentConst
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Yi.Framework.Data.DataSeeds;
|
|
||||||
using Yi.Framework.Ddd.Repositories;
|
|
||||||
using Yi.BBS.Domain.School.Entities;
|
|
||||||
|
|
||||||
namespace Yi.BBS.Domain.School.DataSeeds
|
|
||||||
{
|
|
||||||
[AppService(typeof(IDataSeed))]
|
|
||||||
public class StudentDataSeed : AbstractDataSeed<StudentEntity>
|
|
||||||
{
|
|
||||||
public StudentDataSeed(IRepository<StudentEntity> repository) : base(repository)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override List<StudentEntity> GetSeedData()
|
|
||||||
{
|
|
||||||
return new List<StudentEntity>() { new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好", Phone = "123", Height = 188, IsDeleted = false } ,
|
|
||||||
new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好1", Phone = "123", Height = 188, IsDeleted = false },
|
|
||||||
new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好2", Phone = "123", Height = 188, IsDeleted = false }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +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.BBS.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user