完成模板模块,但配置类有问题
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user