diff --git a/src/InterfaceForward.Application.Contracts/Dtos/Interface/ServiceProviderInterfaceDropdownListItem.cs b/src/InterfaceForward.Application.Contracts/Dtos/Interface/InterfaceDropdownListItem.cs similarity index 86% rename from src/InterfaceForward.Application.Contracts/Dtos/Interface/ServiceProviderInterfaceDropdownListItem.cs rename to src/InterfaceForward.Application.Contracts/Dtos/Interface/InterfaceDropdownListItem.cs index 68f5231..8660d9f 100644 --- a/src/InterfaceForward.Application.Contracts/Dtos/Interface/ServiceProviderInterfaceDropdownListItem.cs +++ b/src/InterfaceForward.Application.Contracts/Dtos/Interface/InterfaceDropdownListItem.cs @@ -1,6 +1,6 @@ namespace InterfaceForward.Application.Contracts.Dtos.Interface; -public class ServiceProviderInterfaceDropdownListItem +public class InterfaceDropdownListItem { /// /// 接口id diff --git a/src/InterfaceForward.Application.Contracts/Dtos/Interface/ServiceProviderInterfaceInput.cs b/src/InterfaceForward.Application.Contracts/Dtos/Interface/SaveInterfaceInput.cs similarity index 86% rename from src/InterfaceForward.Application.Contracts/Dtos/Interface/ServiceProviderInterfaceInput.cs rename to src/InterfaceForward.Application.Contracts/Dtos/Interface/SaveInterfaceInput.cs index d2403d3..56eb5b7 100644 --- a/src/InterfaceForward.Application.Contracts/Dtos/Interface/ServiceProviderInterfaceInput.cs +++ b/src/InterfaceForward.Application.Contracts/Dtos/Interface/SaveInterfaceInput.cs @@ -3,14 +3,17 @@ using InterfaceForward.Domain.Shared.Enum; namespace InterfaceForward.Application.Contracts.Dtos.Interface; -public class ServiceProviderInterfaceInput +public class SaveInterfaceInput { /// /// 操作类型 /// public OptionType OptionType { get; set; } - internal bool IsUpStream { get; set; } = false; + /// + /// 2025-10-31 重构,前端传入 + /// + public bool IsUpStream { get; set; } = false; /// /// 服务商Id @@ -21,6 +24,16 @@ public class ServiceProviderInterfaceInput /// 接口Id(id传null则新增,反之更新) /// public int? Id { get; set; } + + /// + /// 接口代码 + /// + public string Code { get; set; } + + /// + /// 接口分组 + /// + public int Category { get; set; } /// /// 接口名 diff --git a/src/InterfaceForward.Application.Contracts/Dtos/Interface/SystemInterfaceInput.cs b/src/InterfaceForward.Application.Contracts/Dtos/Interface/SystemInterfaceInput.cs deleted file mode 100644 index aa04284..0000000 --- a/src/InterfaceForward.Application.Contracts/Dtos/Interface/SystemInterfaceInput.cs +++ /dev/null @@ -1,63 +0,0 @@ - -using InterfaceForward.Domain.Shared.Enum; - -namespace InterfaceForward.Application.Contracts.Dtos.Interface -{ - /// - /// 系统接口入参 - /// - public class SystemInterfaceInput - { - /// - /// 操作类型 - /// - public OptionType OptionType { get; set; } - - internal bool IsUpStream { get; set; } = true; - - /// - /// 接口Id(id传null则新增,反之更新) - /// - public int? Id { get; set; } - - /// - /// 接口名 - /// - public string Name { get; set; } - - /// - /// 接口代码 - /// - public string Code { get; set; } - - /// - /// 接口描述 - /// - public string Description { get; set; } - - /// - /// 是否支持批量处理 - /// - public bool IsBatch { get; set; } - - /// - /// 接口分组 - /// - public int Category { get; set; } - - /// - /// 是否返回源报文 - /// - public bool IsReturnMessage { get; set; } - - /// - /// 入参列表 - /// - public List InParameterList { get; set; } - - /// - /// 出参列表 - /// - public List OutParameterList { get; set; } - } -} diff --git a/src/InterfaceForward.Application/AutoMapper/InterfaceProfile.cs b/src/InterfaceForward.Application/AutoMapper/InterfaceProfile.cs index 0ff1b96..d5bbe92 100644 --- a/src/InterfaceForward.Application/AutoMapper/InterfaceProfile.cs +++ b/src/InterfaceForward.Application/AutoMapper/InterfaceProfile.cs @@ -12,13 +12,10 @@ public class InterfaceProfile : Profile /// public InterfaceProfile() { - CreateMap(MemberList.None); - CreateMap(MemberList.None); - CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap(MemberList.None); + CreateMap(MemberList.None); - CreateMap(MemberList.None); + CreateMap(MemberList.None); CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/InterfaceForward.Application/AutoMapper/ParameterProfile.cs b/src/InterfaceForward.Application/AutoMapper/ParameterProfile.cs index 9374dcc..d0f2c29 100644 --- a/src/InterfaceForward.Application/AutoMapper/ParameterProfile.cs +++ b/src/InterfaceForward.Application/AutoMapper/ParameterProfile.cs @@ -15,7 +15,6 @@ public class ParameterProfile: Profile public ParameterProfile() { CreateMap(MemberList.None); - CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None) .ForMember(dest => dest.Id, diff --git a/src/InterfaceForward.Application/Services/Interface/InterfaceCategoryService.cs b/src/InterfaceForward.Application/Services/Interface/InterfaceCategoryService.cs index a6a14b5..6c92007 100644 --- a/src/InterfaceForward.Application/Services/Interface/InterfaceCategoryService.cs +++ b/src/InterfaceForward.Application/Services/Interface/InterfaceCategoryService.cs @@ -105,6 +105,7 @@ public class InterfaceCategoryService(IBasicRepository } } + public class CategoryTreeNode where T : HasCategoryId { public int Id { get; set; } diff --git a/src/InterfaceForward.Application/Services/Interface/ServiceProviderInterfaceService.cs b/src/InterfaceForward.Application/Services/Interface/InterfaceService.cs similarity index 65% rename from src/InterfaceForward.Application/Services/Interface/ServiceProviderInterfaceService.cs rename to src/InterfaceForward.Application/Services/Interface/InterfaceService.cs index 1435abf..d448bd8 100644 --- a/src/InterfaceForward.Application/Services/Interface/ServiceProviderInterfaceService.cs +++ b/src/InterfaceForward.Application/Services/Interface/InterfaceService.cs @@ -16,10 +16,10 @@ using Microsoft.AspNetCore.Mvc; namespace InterfaceForward.Application.Services.Interface; /// -/// 服务商接口 +/// 接口服务(包括上下游接口) /// [ApiExplorerSettings(GroupName = "接口服务")] -public class ServiceProviderInterfaceService : ApplicationService +public class InterfaceService : ApplicationService { private ParameterService ParameterService => LazyServiceProvider.GetRequiredService(); @@ -40,15 +40,15 @@ public class ServiceProviderInterfaceService : ApplicationService /// - /// 服务商接口树形列表 + /// 接口树形列表 /// /// /// - [HttpPost("Interface/GetServiceProviderInterfaceTreeListAsync")] - public async Task>> - GetServiceProviderInterfaceTreeListAsync(ServiceProviderInterfaceTreeListInputObjectValue input) + [HttpPost("Interface/GetInterfaceTreeListAsync")] + public async Task>> + GetInterfaceTreeListAsync(InterfaceTreeListInputObjectValue input) { - var res = await InterfaceRepository.GetServiceProviderInterfaceListAsync(input); + var res = await InterfaceRepository.GetInterfaceListAsync(input); var tree = await InterfaceCategoryService.GetCategoryTree(false, res); @@ -56,30 +56,32 @@ public class ServiceProviderInterfaceService : ApplicationService } /// - /// 服务商接口分页列表 + /// 接口分页列表 /// /// /// - [HttpPost("Interface/ServiceProviderInterfacePaginatedList")] - public async Task> - ServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input) + [HttpPost("Interface/InterfacePaginatedList")] + public async Task> + InterfacePaginatedListAsync(InterfacePaginatedInputObjectValue input) { - return await InterfaceRepository.GetServiceProviderInterfacePaginatedListAsync(input); + return await InterfaceRepository.GetInterfacePaginatedListAsync(input); } /// - /// 获取服务商接口下拉列表 + /// 获取接口下拉列表 /// - /// 服务商id + /// 是否上游 + /// 服务商id,上游接口传0 /// - [HttpGet("Interface/GetServiceProviderInterfaceDropdownList")] - public async Task> GetServiceProviderInterfaceDropdownListAsync( - [Required] int serviceProviderId) + [HttpGet("Interface/GetInterfaceDropdownList")] + public async Task> GetInterfaceDropdownListAsync( + [Required] bool isUpstream, [Required] int serviceProviderId) { - var res = await InterfaceRepository.GetListAsync(x => x.ServiceProviderId == serviceProviderId, + var res = await InterfaceRepository.GetListAsync(x => x.IsUpStream == isUpstream && + x.ServiceProviderId == serviceProviderId, x => new { x.Id, x.Code, x.Name }); - return res.Select(x => new ServiceProviderInterfaceDropdownListItem + return res.Select(x => new InterfaceDropdownListItem { Id = x.Id, Name = x.Name, @@ -88,21 +90,21 @@ public class ServiceProviderInterfaceService : ApplicationService } /// - /// 获取服务商接口明细 + /// 获取接口明细 /// - /// 服务商接口id + /// 接口id /// - [HttpGet("Interface/GetServiceProviderInterfaceById")] - public async Task GetServiceProviderInterfaceByIdAsync([Required] int id) + [HttpGet("Interface/GetInterfaceById")] + public async Task GetInterfaceByIdAsync([Required] int id) { // 接口基本信息 - var interfaceEntity = await InterfaceRepository.GetFirstAsync(x => x.Id == id && !x.IsUpStream); + var interfaceEntity = await InterfaceRepository.GetFirstAsync(x => x.Id == id); if (interfaceEntity == null) { - throw new BusinessException(message: "服务商接口不存在"); + throw new BusinessException(message: "接口不存在"); } - var res = ObjectMapper.Map(interfaceEntity); + var res = ObjectMapper.Map(interfaceEntity); // 构造参数 var paras = await InterfaceRepository.GetParameterListByIdAsync(id); @@ -119,7 +121,7 @@ public class ServiceProviderInterfaceService : ApplicationService /// - /// 保存服务商接口 + /// 保存接口 /// /// /// 用OptionType来区分操作目的,1:新增,2:删除,3:修改 @@ -128,8 +130,8 @@ public class ServiceProviderInterfaceService : ApplicationService /// /// /// - [HttpPost("Interface/SaveServiceProviderInterface")] - public async Task SaveServiceProviderInterfaceAsync(ServiceProviderInterfaceInput input) + [HttpPost("Interface/SaveInterface")] + public async Task SaveInterfaceAsync(SaveInterfaceInput input) { input.InParameterList.ForEach(x => { @@ -141,16 +143,16 @@ public class ServiceProviderInterfaceService : ApplicationService if (x.PId == 0 && x.Type == ParameterType.Array && x.Name == GlobalConst.RootParameterName) x.Name = string.Empty; }); - + switch (input.OptionType) { case OptionType.新增: - return await CreateServiceProviderInterfaceAsync(input); + return await CreateInterfaceAsync(input); case OptionType.修改: - await UpdateServiceProviderInterfaceAsync(input); + await UpdateInterfaceAsync(input); break; case OptionType.删除: - await BatchDeleteServiceProviderInterfaceByIdsAsync(new List { input.Id ?? 0 }); + await BatchDeleteInterfaceByIdsAsync(input.IsUpStream, [input.Id ?? 0]); break; case OptionType.无: break; @@ -163,22 +165,38 @@ public class ServiceProviderInterfaceService : ApplicationService /// - /// 批量删除服务商接口 + /// 批量删除接口 /// - /// 服务商接口id集合 + /// 是否上游 + /// 接口id集合 /// - [HttpPost("Interface/BatchDeleteServiceProviderInterfaceByIds")] - public async Task BatchDeleteServiceProviderInterfaceByIdsAsync([FromBody] List ids) + [HttpPost("Interface/BatchDeleteInterfaceByIds")] + public async Task BatchDeleteInterfaceByIdsAsync([FromQuery] bool isUpstream, + [FromBody] List ids) { using var tran = TransacationHelper.GetReadCommitted(); - // 删除接口 - await InterfaceRepository.SoftDeleteAsync(x => !x.IsUpStream && ids.Contains(x.Id)); - // 删除接口映射 - var mapIds = await InterfaceMapRepository.GetListAsync(x => ids.Contains(x.DownStreamId), x => x.Id); - if (mapIds.Count > 0) + if (isUpstream) { - await InterfaceMapRepository.SoftDeleteAsync(x => mapIds.Contains(x.Id)); + // 删除接口 + await InterfaceRepository.SoftDeleteAsync(x => x.IsUpStream && ids.Contains(x.Id)); + // 删除接口映射 + var mapIds = await InterfaceMapRepository.GetListAsync(x => ids.Contains(x.UpStreamId), x => x.Id); + if (mapIds.Count > 0) + { + await InterfaceMapRepository.SoftDeleteAsync(x => mapIds.Contains(x.Id)); + } + } + else + { + // 删除接口 + await InterfaceRepository.SoftDeleteAsync(x => !x.IsUpStream && ids.Contains(x.Id)); + // 删除接口映射 + var mapIds = await InterfaceMapRepository.GetListAsync(x => ids.Contains(x.DownStreamId), x => x.Id); + if (mapIds.Count > 0) + { + await InterfaceMapRepository.SoftDeleteAsync(x => mapIds.Contains(x.Id)); + } } tran.Complete(); @@ -186,7 +204,7 @@ public class ServiceProviderInterfaceService : ApplicationService return true; } - internal async Task CreateServiceProviderInterfaceAsync(ServiceProviderInterfaceInput input) + internal async Task CreateInterfaceAsync(SaveInterfaceInput input) { // 校验参数合法性 ParameterService.ValidateParameter( @@ -196,7 +214,6 @@ public class ServiceProviderInterfaceService : ApplicationService JsonConvert.DeserializeObject>( JsonConvert.SerializeObject(input.OutParameterList))!); - /* * 1.校验业务逻辑 * 接口名唯一性,接口简码唯一性,请求地址唯一性 @@ -208,53 +225,53 @@ public class ServiceProviderInterfaceService : ApplicationService #region 校验业务逻辑 - if (await InterfaceRepository.IsAnyAsync(x => - !x.IsUpStream && x.Name.Equals(input.Name) && x.ServiceProviderId == input.ServiceProviderId)) + if (input.Code.IsNullOrWhiteSpace()) { - throw new BusinessException(message: $"接口名:{input.Name} 已存在"); + input.Code = await GenerateInterfaceCode(input.ServiceProviderId); + } + + if (await InterfaceRepository.IsAnyAsync(x => + x.IsUpStream == input.IsUpStream && (x.Name.Equals(input.Name) || x.Code.Equals(input.Code)) && + x.ServiceProviderId == input.ServiceProviderId)) + { + throw new BusinessException(message: $"接口名或code:{input.Name} 已存在"); } #endregion - var interfaceEntity = ObjectMapper.Map(input); - - interfaceEntity.IsUpStream = false; + var interfaceEntity = ObjectMapper.Map(input); // 开启事务 using var ts = TransacationHelper.GetReadCommitted(); - // step1、生成接口编码 - interfaceEntity.Code = await GenerateServiceProviderInterfaceCode(input.ServiceProviderId); - // step2、持久化接口 + // 持久化接口 var interfaceId = await InterfaceRepository.InsertReturnIdentityAsync(interfaceEntity); + + // 持久化参数 + await ParameterService.CreateParametersAsync(input.InParameterList, interfaceId, true); + await ParameterService.CreateParametersAsync(input.OutParameterList, interfaceId, false); + + // 持久化表单参数 + await FormParameterService.CreateParametersAsync(input.FormParameterList, interfaceId); + // 接口代码生成时并发兜底方案 if (await InterfaceRepository.CountAsync(x => x.Code.Equals(interfaceEntity.Code)) > 1) { throw new BusinessException(message: "接口代码生成异常,请稍后重试"); } - // step3、持久化参数 - await ParameterService.CreateParametersAsync(input.InParameterList, interfaceId, true); - await ParameterService.CreateParametersAsync(input.OutParameterList, interfaceId, false); - - // step4、持久化表单参数 - if (input.FormParameterList.Count > 0) - { - await FormParameterService.CreateParametersAsync(input.FormParameterList, interfaceId); - } - // 提交事务 ts.Complete(); return interfaceId; } - private async Task GenerateServiceProviderInterfaceCode(int serviceProviderId) + private async Task GenerateInterfaceCode(int serviceProviderId) { // 系统生成,由服务商代码+3位数字组成(0-999按顺序生成) // tips:唯一性 var entity = await ServiceProviderRepository.GetFirstAsync(x => x.Id == serviceProviderId); - if (entity == null) throw new BusinessException(message: "服务商不存在"); + if (entity == null) throw new BusinessException(message: "服务商不存在,系统接口自己定义code谢谢配合"); string res = entity.Code; @@ -267,17 +284,17 @@ public class ServiceProviderInterfaceService : ApplicationService return res; } - private async Task UpdateServiceProviderInterfaceAsync(ServiceProviderInterfaceInput input) + private async Task UpdateInterfaceAsync(SaveInterfaceInput input) { #region 校验业务逻辑 if (!await InterfaceRepository.IsAnyAsync(x => x.Id == input.Id)) { - throw new BusinessException(message: "服务商接口不存在"); + throw new BusinessException(message: "接口不存在"); } if (await InterfaceRepository.IsAnyAsync(x => - x.Name.Equals(input.Name) && x.Id != input.Id && !x.IsUpStream && + x.Name.Equals(input.Name) && x.Id != input.Id && x.IsUpStream == input.IsUpStream && x.ServiceProviderId == input.ServiceProviderId)) { throw new BusinessException(message: $"接口名:{input.Name} 已存在"); @@ -287,7 +304,7 @@ public class ServiceProviderInterfaceService : ApplicationService Debug.Assert(input.Id != null, $"{input.Id} 不能为空"); - var interfaceEntity = ObjectMapper.Map(input); + var interfaceEntity = ObjectMapper.Map(input); // 开启事务 using var ts = TransacationHelper.GetReadCommitted(); diff --git a/src/InterfaceForward.Application/Services/Interface/SystemInterfaceService.cs b/src/InterfaceForward.Application/Services/Interface/SystemInterfaceService.cs deleted file mode 100644 index a9963ab..0000000 --- a/src/InterfaceForward.Application/Services/Interface/SystemInterfaceService.cs +++ /dev/null @@ -1,311 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Diagnostics; -using Newtonsoft.Json; -using InterfaceForward.Application.Contracts.Dtos.Interface; -using InterfaceForward.Application.Helpers; -using InterfaceForward.Application.Services.Parameter; -using InterfaceForward.Domain.Shared; -using InterfaceForward.Domain.Shared.Enum; -using InterfaceForward.Repositories; -using InterfaceForward.Repositories.Interface.Entitys; -using InterfaceForward.Repositories.Interface.Services; -using InterfaceForward.Repositories.Interface.ValueObjects; -using InterfaceForward.Repositories.Parameter.VO; -using Microsoft.AspNetCore.Mvc; - -namespace InterfaceForward.Application.Services.Interface; - -/// -/// 系统接口 -/// -[ApiExplorerSettings(GroupName = "接口服务")] -public class SystemInterfaceService : ApplicationService -{ - #region ctor - - private readonly ParameterService _parameterService; - private readonly IInterfaceRepository _interfaceRepository; - private readonly IBasicRepository _interfaceMapRepository; - private readonly InterfaceCategoryService _interfaceCategoryService; - - /// - /// 系统接口下拉列表缓存key - /// - private const string SystemInterfaceDropdownCacheKey = "SystemInterfaceDropdownCacheKey"; - - /// - public SystemInterfaceService( - IInterfaceRepository interfaceRepository - , ParameterService parameterService - , IBasicRepository interfaceMapRepository - , InterfaceCategoryService interfaceCategoryService) - { - _parameterService = parameterService; - _interfaceMapRepository = interfaceMapRepository; - _interfaceCategoryService = interfaceCategoryService; - _interfaceRepository = interfaceRepository; - } - - #endregion - - - /// - /// 系统接口分页列表 - /// - /// - /// - [HttpPost("Interface/SystemInterfacePaginatedList")] - public async Task> - SystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input) - { - return await _interfaceRepository.GetSystemInterfacePaginatedListAsync(input); - } - - /// - /// 系统接口树形列表 - /// - /// - /// - [HttpPost("Interface/GetSystemInterfaceTreeListAsync")] - public async Task>> - GetSystemInterfaceTreeListAsync(SystemInterfaceTreeListInputObjectValue input) - { - var res = await _interfaceRepository.GetSystemInterfaceListAsync(input); - - var tree = await _interfaceCategoryService.GetCategoryTree(true, res); - - return tree; - } - - /// - /// 获取系统接口明细 - /// - /// 系统接口id - /// - [HttpGet("Interface/GetSystemInterfaceById")] - public async Task GetSystemInterfaceByIdAsync([Required] int id) - { - // 接口基本信息 - var interfaceEntity = await _interfaceRepository.GetFirstAsync(x => x.Id == id && x.IsUpStream); - if (interfaceEntity == null) - { - throw new BusinessException(message: "系统接口不存在"); - } - - var res = ObjectMapper.Map(interfaceEntity); - - // 构造参数 - var paras = await _interfaceRepository.GetParameterListByIdAsync(id); - // 入参树形列表 - res.InParameterList = - ObjectMapper.Map, List>( - paras.Where(x => x.IsInPara).ToList()); - // 出参树形列表 - res.OutParameterList = - ObjectMapper.Map, List>( - paras.Where(x => !x.IsInPara).ToList()); - - return res; - } - - /// - /// 获取系统接口下拉列表 - /// - /// - [HttpGet("Interface/GetSystemInterfaceDropdownList")] - public async Task> GetSystemInterfaceDropdownListAsync() - { - var res = - (await RedisHelper.Client.GetAsync(SystemInterfaceDropdownCacheKey)) - .ToObject>(); - if (res == null) - { - res = await _interfaceRepository.GetSystemInterfaceDropdownListAsync(); - await RedisHelper.Client.SetAsync(SystemInterfaceDropdownCacheKey, res.ToJson(), 2 * 60 * 60); - } - - return res; - } - - /// - /// 保存系统接口 - /// - /// - /// 用OptionType来区分操作目的,1:新增,2:删除,3:修改 - ///注意!新增时,参数id由调用者伪造,以表现层级关系,不能小于1,你必须真实的表达id和pid的关系 - /// - /// - /// - /// - [HttpPost("Interface/SaveSystemInterface")] - public async Task SaveSystemInterfaceAsync(SystemInterfaceInput input) - { - input.InParameterList.ForEach(x => - { - if (x.PId == 0 && x.Type == ParameterType.Array && x.Name == GlobalConst.RootParameterName) - x.Name = string.Empty; - }); - input.OutParameterList.ForEach(x => - { - if (x.PId == 0 && x.Type == ParameterType.Array && x.Name == GlobalConst.RootParameterName) - x.Name = string.Empty; - }); - - switch (input.OptionType) - { - case OptionType.新增: - await CreateSystemInterfaceAsync(input); - break; - case OptionType.修改: - await UpdateSystemInterfaceAsync(input); - break; - case OptionType.删除: - await BatchDeleteSystemInterfaceByIdsAsync(new List { input.Id ?? 0 }); - break; - case OptionType.无: - break; - default: - throw new ArgumentOutOfRangeException(); - } - - // 干掉缓存 - await RedisHelper.Client.DelAsync(SystemInterfaceDropdownCacheKey); - } - - /// - /// 批量删除系统接口 - /// - /// 系统接口id集合 - /// - [HttpPost("Interface/BatchDeleteSystemInterfaceByIds")] - public async Task BatchDeleteSystemInterfaceByIdsAsync([FromBody] List ids) - { - using var tran = TransacationHelper.GetReadCommitted(); - - // 删除接口 - await _interfaceRepository.SoftDeleteAsync(x => x.IsUpStream && ids.Contains(x.Id)); - // 删除接口映射 - var mapIds = await _interfaceMapRepository.GetListAsync(x => ids.Contains(x.UpStreamId), x => x.Id); - if (mapIds.Count > 0) - { - await _interfaceMapRepository.SoftDeleteAsync(x => mapIds.Contains(x.Id)); - } - - // 删缓存 - await RedisHelper.Client.DelAsync(SystemInterfaceDropdownCacheKey); - - tran.Complete(); - - return true; - } - - #region private - - /// - /// 更新系统接口 - /// - /// - /// - private async Task UpdateSystemInterfaceAsync(SystemInterfaceInput input) - { - #region 校验业务逻辑 - - var entity = await _interfaceRepository.GetFirstAsync(x => x.Id == input.Id && x.IsUpStream); - - if (entity == null) - { - throw new BusinessException(message: "系统接口不存在"); - } - - if (await _interfaceRepository.IsAnyAsync(x => - x.Id != input.Id && x.IsUpStream && x.Name.Equals(input.Name))) - { - throw new BusinessException(message: $"接口名:{input.Name} 已存在"); - } - - if (await _interfaceRepository.IsAnyAsync(x => x.Id != input.Id && x.IsUpStream && x.Code.Equals(input.Code))) - { - throw new BusinessException(message: "接口code已存在"); - } - - #endregion - - Debug.Assert(input.Id != null, $"{input.Id} 不能为空"); - - var interfaceEntity = ObjectMapper.Map(input); - - // 开启事务 - using var ts = TransacationHelper.GetReadCommitted(); - - // step1、更新接口 - await _interfaceRepository.UpdateAsync(interfaceEntity, x => new - { - x.IsUpStream, - x.ServiceProviderId, - x.CreateTime, - x.CreateUserId, - x.IsDeleted - }); - - // step2、维护参数(增删改) - await _parameterService.MaintainParametersAsync(input.InParameterList, (int)input.Id, true); - - await _parameterService.MaintainParametersAsync(input.OutParameterList, (int)input.Id, false); - - // 这里再做参数校验,回滚代价是不是有点大了。。 - - // 提交事务 - ts.Complete(); - } - - private async Task CreateSystemInterfaceAsync(SystemInterfaceInput input) - { - // 校验参数合法性 - _parameterService.ValidateParameter( - JsonConvert.DeserializeObject>( - JsonConvert.SerializeObject(input.InParameterList))!); - _parameterService.ValidateParameter( - JsonConvert.DeserializeObject>( - JsonConvert.SerializeObject(input.OutParameterList))!); - - /* - * 1.校验业务逻辑 - * 接口名唯一性,接口简码唯一性,请求地址唯一性 - * 2.清洗数据结构 - * 参数合并,参数合法性,参数扁平化bfs - * 3.数据持久化 - * 由于业务的观测粒度是保存行为(即取消不做任何数据保存),因此保持行为可以直接覆盖上次行为,注意事务 - */ - - #region 校验业务逻辑 - - if (await _interfaceRepository.IsAnyAsync(x => x.IsUpStream && x.Name.Equals(input.Name))) - { - throw new BusinessException(message: $"接口名:{input.Name} 已存在"); - } - - if (await _interfaceRepository.IsAnyAsync(x => x.IsUpStream && x.Code.Equals(input.Code))) - { - throw new BusinessException(message: "接口code已存在"); - } - - #endregion - - var interfaceEntity = ObjectMapper.Map(input); - interfaceEntity.IsUpStream = true; - - // 开启事务 - using var ts = TransacationHelper.GetReadCommitted(); - // step1、持久化接口 - var interfaceId = await _interfaceRepository.InsertReturnIdentityAsync(interfaceEntity); - - // step2、持久化参数 - await _parameterService.CreateParametersAsync(input.InParameterList, interfaceId, true); - await _parameterService.CreateParametersAsync(input.OutParameterList, interfaceId, false); - - // 提交事务 - ts.Complete(); - } - - #endregion -} \ No newline at end of file diff --git a/src/InterfaceForward.Application/Services/Parameter/FormParameterService.cs b/src/InterfaceForward.Application/Services/Parameter/FormParameterService.cs index 8d74b59..ce11324 100644 --- a/src/InterfaceForward.Application/Services/Parameter/FormParameterService.cs +++ b/src/InterfaceForward.Application/Services/Parameter/FormParameterService.cs @@ -40,6 +40,7 @@ public class FormParameterService : ApplicationService /// 接口id internal async Task CreateParametersAsync(List list, int interfaceId) { + if (list.Count <= 0) return; var formEntities = ObjectMapper.Map, List>(list); formEntities.ForEach(x => x.InterfaceId = interfaceId); await _formParameterRepository.InsertRangeAsync(formEntities); diff --git a/src/InterfaceForward.Application/Services/Parameter/ParameterService.cs b/src/InterfaceForward.Application/Services/Parameter/ParameterService.cs index fe77d5c..9099d07 100644 --- a/src/InterfaceForward.Application/Services/Parameter/ParameterService.cs +++ b/src/InterfaceForward.Application/Services/Parameter/ParameterService.cs @@ -328,6 +328,7 @@ public class ParameterService : ApplicationService /// internal async Task CreateParametersAsync(List list, int interfaceId, bool isInPara) { + if (list.Count <= 0) return; var parameters = await _parameterRepository.GetListAsync(x => x.InterfaceId == interfaceId && x.IsInPara == isInPara); diff --git a/src/InterfaceForward.Repositories/Interface/Services/IInterfaceRepository.cs b/src/InterfaceForward.Repositories/Interface/Services/IInterfaceRepository.cs index f5bdcce..c80fb8e 100644 --- a/src/InterfaceForward.Repositories/Interface/Services/IInterfaceRepository.cs +++ b/src/InterfaceForward.Repositories/Interface/Services/IInterfaceRepository.cs @@ -13,18 +13,11 @@ namespace InterfaceForward.Repositories.Interface.Services public interface IInterfaceRepository:IBasicRepository { /// - /// 获取系统接口列表 + /// 获取接口列表 /// /// /// - Task> GetSystemInterfaceListAsync(SystemInterfaceTreeListInputObjectValue input); - - /// - /// 获取服务商接口列表 - /// - /// - /// - Task> GetServiceProviderInterfaceListAsync(ServiceProviderInterfaceTreeListInputObjectValue input); + Task> GetInterfaceListAsync(InterfaceTreeListInputObjectValue input); /// /// 获取参数列表 @@ -34,12 +27,6 @@ namespace InterfaceForward.Repositories.Interface.Services /// Task> GetParameterListByIdAsync(int id, bool onlyLeafs = false); - /// - /// 获取系统接口下拉列表 - /// - /// - Task> GetSystemInterfaceDropdownListAsync(); - /// /// 获取服务商接口当前用到的code /// @@ -47,7 +34,6 @@ namespace InterfaceForward.Repositories.Interface.Services /// /// Task GetCurrentCodeBySpId(int spId); - Task> GetSystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input); - Task> GetServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input); + Task> GetInterfacePaginatedListAsync(InterfacePaginatedInputObjectValue input); } } diff --git a/src/InterfaceForward.Repositories/Interface/Services/InterfaceRepository.cs b/src/InterfaceForward.Repositories/Interface/Services/InterfaceRepository.cs index d40827a..c5cd256 100644 --- a/src/InterfaceForward.Repositories/Interface/Services/InterfaceRepository.cs +++ b/src/InterfaceForward.Repositories/Interface/Services/InterfaceRepository.cs @@ -15,50 +15,35 @@ public class InterfaceRepository : BasicRepository, IInterfaceR public string InterfaceGroup => "InterfaceGroup"; /// - public async Task> - GetSystemInterfaceListAsync(SystemInterfaceTreeListInputObjectValue input) + public async Task> + GetInterfaceListAsync(InterfaceTreeListInputObjectValue input) { // t_interface驱动t_interface_map,数据量上来可以在t_interface_map UpStreamId字段建立索引 var query = AsQueryable() - .Where(a => a.IsUpStream) - ; + .Where(a => a.IsUpStream == input.IsUpstream) + .Where(a => a.ServiceProviderId == input.ServiceProviderId); query .WhereIF(!string.IsNullOrEmpty(input.Name), a => a.Name.Contains(input.Name!)) // 默认为空,支持模糊搜索 .WhereIF(!string.IsNullOrEmpty(input.Code), a => a.Code.Contains(input.Code!)) // 默认为空,支持模糊搜索 ; + if (input.IsUpstream) + { + return await query + .OrderBy(a => a.CreateTime) + .Select(a => new InterfaceTreeListOutputValueObject + { + Id = a.Id.SelectAll(), + MapCount = SqlFunc.Subqueryable().Where(x => x.UpStreamId == a.Id && !x.IsDeleted) + .DistinctCount(x => x.ServiceProviderId), + }) + .ToListAsync(); + } + return await query .OrderBy(a => a.CreateTime) - .Select(a => new SystemInterfaceTreeListValueObject - { - Id = a.Id, - CategoryId = a.Category, - Name = a.Name, - Code = a.Code, - RequestProtocol = a.RequestProtocol, - Description = a.Description, - MapCount = SqlFunc.Subqueryable().Where(x => x.UpStreamId == a.Id && !x.IsDeleted) - .DistinctCount(x => x.ServiceProviderId), - UpdateTime = a.UpdateTime, - }).ToListAsync(); - } - - /// - public async Task> - GetServiceProviderInterfaceListAsync(ServiceProviderInterfaceTreeListInputObjectValue input) - { - var query = AsQueryable() - .Where(a => !a.IsUpStream) - .Where(a => a.ServiceProviderId == input.ServiceProviderId); - - query - .WhereIF(!string.IsNullOrEmpty(input.Name), a => a.Name.Contains(input.Name!)) // 默认为空,支持模糊搜索 - .WhereIF(!string.IsNullOrEmpty(input.Code), a => a.Code.Contains(input.Code!)) // 默认为空,支持模糊搜索 - ; - return await query - .OrderBy(a => a.CreateTime) - .Select() + .Select() .ToListAsync(); } @@ -82,38 +67,6 @@ public class InterfaceRepository : BasicRepository, IInterfaceR return res; } - /// - public async Task> GetSystemInterfaceDropdownListAsync() - { - // 获取所有接口分组 - // var groups = await Context.Queryable() - // .Where(x => x.Type == InterfaceGroup) - // .Select(x => new { x.Id, x.Name }) - // .ToListAsync(); - - var groups = new List() { "全部" }; - - // 获取所有接口 - var interfaces = await AsQueryable() - .Where(x => x.IsUpStream) - .Select(x => new { x.Id, x.Name, x.Category }) - .ToListAsync(); - - // 渲染 - return groups.Select(x => new SystemInterfaceDropdownValueObject - { - Id = Guid.NewGuid().ToString(), - GroupName = x, - Interfaces = interfaces - //.Where(y => y.Category == x.Id) - .Select(y => new SystemInterfaceItemValueObject - { - Id = y.Id, - Name = y.Name - }).ToList() - }).ToList(); - } - /// public async Task GetCurrentCodeBySpId(int spId) { @@ -128,51 +81,35 @@ public class InterfaceRepository : BasicRepository, IInterfaceR } /// - public async Task> - GetSystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input) + public async Task> + GetInterfacePaginatedListAsync(InterfacePaginatedInputObjectValue input) { // t_interface驱动t_interface_map,数据量上来可以在t_interface_map UpStreamId字段建立索引 var query = AsQueryable() - .Where(a => a.IsUpStream) - ; - + .Where(a => a.IsUpStream == input.IsUpstream) + .Where(a => a.ServiceProviderId == input.ServiceProviderId); + var keyword = input.NameOrCode?.Trim(); query.WhereIF(input.Category != 0, a => a.Category == input.Category) // 默认“请选择”对应0,数据源在数据库字典中配置 .WhereIF(!string.IsNullOrEmpty(keyword), a => a.Name.Contains(keyword) || a.Code.Contains(keyword)) // 默认为空,支持模糊搜索 ; - var res = await query.Select(a => new SystemInterfacePaginatedOutputValueObject - { - Id = a.Id, - Category = a.Category, - Name = a.Name, - Code = a.Code, - RequestProtocol = a.RequestProtocol, - Description = a.Description, - MapCount = SqlFunc.Subqueryable().Where(x => x.UpStreamId == a.Id && !x.IsDeleted) - .DistinctCount(x => x.ServiceProviderId), - UpdateTime = a.UpdateTime, - }) - .OrderByDescending(a => a.UpdateTime) - .ToPagedListAsync(input.PageIndex, input.PageSize); + if (input.IsUpstream) + { + var res = await query.Select(a => new InterfacePaginatedOutputValueObject + { + Id = a.Id.SelectAll(), + MapCount = SqlFunc.Subqueryable().Where(x => x.UpStreamId == a.Id && !x.IsDeleted) + .DistinctCount(x => x.ServiceProviderId), + }) + .OrderByDescending(a => a.UpdateTime) + .ToPagedListAsync(input.PageIndex, input.PageSize); - return res; - } - - /// - public async Task> - GetServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input) - { - var query = AsQueryable() - .Where(a => !a.IsUpStream) - .Where(a => a.ServiceProviderId == input.ServiceProviderId); - - query - .WhereIF(!string.IsNullOrEmpty(input.Name), a => a.Name.Contains(input.Name!)) // 默认为空,支持模糊搜索 - .WhereIF(!string.IsNullOrEmpty(input.Code), a => a.Code.Contains(input.Code!)) // 默认为空,支持模糊搜索 - ; - return await query.Select() + return res; + } + + return await query.Select() .OrderByDescending(a => a.UpdateTime) .ToPagedListAsync(input.PageIndex, input.PageSize); } diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceOutput.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceOutput.cs similarity index 97% rename from src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceOutput.cs rename to src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceOutput.cs index d740048..4285016 100644 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceOutput.cs +++ b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceOutput.cs @@ -7,7 +7,7 @@ namespace InterfaceForward.Repositories.Interface.ValueObjects; /// /// 服务商接口输出模型 /// -public class ServiceProviderInterfaceOutput +public class InterfaceOutput { /// /// 接口id diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceTreeListInputObjectValue.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfacePaginatedInputObjectValue.cs similarity index 51% rename from src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceTreeListInputObjectValue.cs rename to src/InterfaceForward.Repositories/Interface/ValueObjects/InterfacePaginatedInputObjectValue.cs index c1b6338..07deaeb 100644 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceTreeListInputObjectValue.cs +++ b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfacePaginatedInputObjectValue.cs @@ -3,22 +3,27 @@ namespace InterfaceForward.Repositories.Interface.ValueObjects; /// -/// 服务商接口分页 +/// 接口分页 /// -public class ServiceProviderInterfaceTreeListInputObjectValue +public class InterfacePaginatedInputObjectValue : PagedQueryInput { + /// + /// 是否上游接口 + /// + public bool IsUpstream { get; set; } + /// /// 服务商Id /// public int ServiceProviderId { get; set; } /// - /// 接口名 + /// 接口分组,默认请选择对应0值 /// - public string? Name { get; set; } + public int Category { get; set; } /// - /// 接口代码 + /// 接口名 /// - public string? Code { get; set; } + public string NameOrCode { get; set; } } \ No newline at end of file diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfacePaginatedOutputValueObject.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfacePaginatedOutputValueObject.cs similarity index 78% rename from src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfacePaginatedOutputValueObject.cs rename to src/InterfaceForward.Repositories/Interface/ValueObjects/InterfacePaginatedOutputValueObject.cs index 652b1ec..2cfdfc8 100644 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfacePaginatedOutputValueObject.cs +++ b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfacePaginatedOutputValueObject.cs @@ -6,12 +6,22 @@ namespace InterfaceForward.Repositories.Interface.ValueObjects; /// /// /// -public class ServiceProviderInterfacePaginatedOutputValueObject +public class InterfacePaginatedOutputValueObject { /// /// 接口Id /// public int Id { get; set; } + + /// + /// 接口分组 + /// + public int Category { get; set; } + + /// + /// 接口分组Name + /// + public string CategoryName => "全部"; /// /// 接口名 @@ -52,6 +62,11 @@ public class ServiceProviderInterfacePaginatedOutputValueObject /// 接口描述 /// public string Description { get; set; } + + /// + /// 映射数 + /// + public int MapCount { get; set; } /// /// 更新时间 diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfacePaginatedInputObjectValue.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceTreeListInputObjectValue.cs similarity index 62% rename from src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfacePaginatedInputObjectValue.cs rename to src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceTreeListInputObjectValue.cs index e450bfd..8f48f64 100644 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfacePaginatedInputObjectValue.cs +++ b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceTreeListInputObjectValue.cs @@ -5,8 +5,13 @@ namespace InterfaceForward.Repositories.Interface.ValueObjects; /// /// 服务商接口分页 /// -public class ServiceProviderInterfacePaginatedInputObjectValue : PagedQueryInput +public class InterfaceTreeListInputObjectValue { + /// + /// 是否上游接口 + /// + public bool IsUpstream { get; set; } + /// /// 服务商Id /// @@ -15,10 +20,10 @@ public class ServiceProviderInterfacePaginatedInputObjectValue : PagedQueryInput /// /// 接口名 /// - public string? Name { get; set; } + public string Name { get; set; } /// /// 接口代码 /// - public string? Code { get; set; } + public string Code { get; set; } } \ No newline at end of file diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceTreeListOutputValueObject.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceTreeListOutputValueObject.cs similarity index 81% rename from src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceTreeListOutputValueObject.cs rename to src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceTreeListOutputValueObject.cs index 951d1e6..1b83b17 100644 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/ServiceProviderInterfaceTreeListOutputValueObject.cs +++ b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceTreeListOutputValueObject.cs @@ -3,10 +3,18 @@ using InterfaceForward.Domain.Shared.Helpers; namespace InterfaceForward.Repositories.Interface.ValueObjects; +public class HasCategoryId +{ + /// + /// 接口分组id + /// + public int CategoryId { get; set; } +} + /// /// /// -public class ServiceProviderInterfaceTreeListOutputValueObject: HasCategoryId +public class InterfaceTreeListOutputValueObject: HasCategoryId { /// /// 接口Id @@ -52,6 +60,11 @@ public class ServiceProviderInterfaceTreeListOutputValueObject: HasCategoryId /// 接口描述 /// public string Description { get; set; } + + /// + /// 映射数 + /// + public int MapCount { get; set; } /// /// 更新时间 diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceOutput.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceOutput.cs deleted file mode 100644 index 5cc9447..0000000 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceOutput.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System.Text.Json.Serialization; -using InterfaceForward.Repositories.Parameter.VO; - -namespace InterfaceForward.Repositories.Interface.ValueObjects; - -/// -/// 系统接口输出模型 -/// -public class SystemInterfaceOutput -{ - /// - /// 接口id - /// - public int Id { get; set; } - - /// - /// 接口代码 - /// - public string Code { get; set; } - - /// - /// 接口名 - /// - public string Name { get; set; } - - /// - /// 请求地址 - /// - public string RequestAddress { get; set; } - - /// - /// 接口描述 - /// - public string Description { get; set; } - - /// - /// 是否支持批量处理 - /// - public bool IsBatch { get; set; } - - /// - /// 请求协议 - /// - public int RequestProtocol { get; set; } - - /// - /// 请求方式 - /// - public int RequestMethod { get; set; } - - /// - /// 接口分组 - /// - public int Category { get; set; } - - /// - /// 内容类型 - /// - public int ContentType { get; set; } - - /// - /// 是否返回源报文 - /// - public bool IsReturnMessage { get; set; } - - /// - /// 入参列表 - /// - public List InParameterList { get; set; } - - /// - /// 出参列表 - /// - public List OutParameterList { get; set; } -} - -public class InterfaceParameterOutput -{ - /// - /// Id - /// - public int Id { get; set; } - - /// - /// 父级Id - /// - public int PId { get; set; } - - /// - /// 别名 - /// - public string Alias { get; set; } - - /// - /// 参数名 - /// - public string Name { get; set; } - - /// - /// 参数名(中文) - /// - public string CnName { get; set; } - - /// - /// 参数类型 - /// - public int Type { get; set; } - - /// - /// 是否必填 - /// - public bool IsRequired { get; set; } - - /// - /// 参数描述 - /// - public string Description { get; set; } - - /// - /// 0:返回参数;1:请求参数 - /// - public bool IsInPara { get; set; } - - /// - /// 序列 - /// - [JsonIgnore] - public string Sort { get; set; } -} \ No newline at end of file diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfacePaginatedInputObjectValue.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfacePaginatedInputObjectValue.cs deleted file mode 100644 index ec47100..0000000 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfacePaginatedInputObjectValue.cs +++ /dev/null @@ -1,20 +0,0 @@ -using InterfaceForward.Domain.Shared.Dtos; - -namespace InterfaceForward.Repositories.Interface.ValueObjects -{ - /// - /// 分页查询系统接口 - /// - public class SystemInterfacePaginatedInputObjectValue : PagedQueryInput - { - /// - /// 接口分组,默认请选择对应0值 - /// - public int Category { get; set; } - - /// - /// 接口名 - /// - public string? NameOrCode { get; set; } - } -} \ No newline at end of file diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfacePaginatedOutputValueObject.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfacePaginatedOutputValueObject.cs deleted file mode 100644 index bf0ff54..0000000 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfacePaginatedOutputValueObject.cs +++ /dev/null @@ -1,61 +0,0 @@ -using InterfaceForward.Domain.Shared.Enum; -using InterfaceForward.Domain.Shared.Helpers; - -namespace InterfaceForward.Repositories.Interface.ValueObjects -{ - /// - /// - /// - public class SystemInterfacePaginatedOutputValueObject - { - /// - /// 接口Id - /// - public int Id { get; set; } - - /// - /// 接口分组 - /// - public int Category { get; set; } - - /// - /// 接口分组Name - /// - public string CategoryName => "全部"; - - /// - /// 接口名 - /// - public string Name { get; set; } - - /// - /// 接口代码 - /// - public string Code { get; set; } - - /// - /// 请求协议 - /// - public RequestProtocol RequestProtocol { get; set; } - - /// - /// 请求协议Name - /// - public string RequestProtocolName => ((RequestProtocol)RequestProtocol).GetDescription(); - - /// - /// 接口描述 - /// - public string Description { get; set; } - - /// - /// 映射数 - /// - public int MapCount { get; set; } - - /// - /// 更新时间 - /// - public DateTime? UpdateTime { get; set; } - } -} diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceTreeListInputObjectValue.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceTreeListInputObjectValue.cs deleted file mode 100644 index 88fc7d5..0000000 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceTreeListInputObjectValue.cs +++ /dev/null @@ -1,20 +0,0 @@ -using InterfaceForward.Domain.Shared.Dtos; - -namespace InterfaceForward.Repositories.Interface.ValueObjects -{ - /// - /// 分页查询系统接口 - /// - public class SystemInterfaceTreeListInputObjectValue - { - /// - /// 接口名 - /// - public string? Name { get; set; } - - /// - /// 接口代码 - /// - public string? Code { get; set; } - } -} \ No newline at end of file diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceTreeListValueObject.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceTreeListValueObject.cs deleted file mode 100644 index b4935b5..0000000 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/SystemInterfaceTreeListValueObject.cs +++ /dev/null @@ -1,59 +0,0 @@ -using InterfaceForward.Domain.Shared.Enum; -using InterfaceForward.Domain.Shared.Helpers; - -namespace InterfaceForward.Repositories.Interface.ValueObjects -{ - public class HasCategoryId - { - /// - /// 接口分组id - /// - public int CategoryId { get; set; } - } - - /// - /// - /// - public class SystemInterfaceTreeListValueObject: HasCategoryId - { - /// - /// 接口Id - /// - public int Id { get; set; } - - /// - /// 接口名 - /// - public string Name { get; set; } - - /// - /// 接口代码 - /// - public string Code { get; set; } - - /// - /// 请求协议 - /// - public RequestProtocol RequestProtocol { get; set; } - - /// - /// 请求协议 - /// - public string RequestProtocolName => ((RequestProtocol)RequestProtocol).GetDescription(); - - /// - /// 接口描述 - /// - public string Description { get; set; } - - /// - /// 映射数 - /// - public int MapCount { get; set; } - - /// - /// 更新时间 - /// - public DateTime? UpdateTime { get; set; } - } -}