fix:填补缺失的object map
This commit is contained in:
parent
ec0acc2421
commit
fc73d4d85c
@ -1,5 +1,6 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using InterfaceForward.Application.Contracts.Dtos.App;
|
using InterfaceForward.Application.Contracts.Dtos.App;
|
||||||
|
using InterfaceForward.Application.HostServices;
|
||||||
using InterfaceForward.Repositories.App.Entitys;
|
using InterfaceForward.Repositories.App.Entitys;
|
||||||
|
|
||||||
namespace InterfaceForward.Application.AutoMapper;
|
namespace InterfaceForward.Application.AutoMapper;
|
||||||
@ -11,5 +12,9 @@ internal class AppProfile : Profile
|
|||||||
CreateMap<CreateAppInput, AppEntity>(MemberList.None);
|
CreateMap<CreateAppInput, AppEntity>(MemberList.None);
|
||||||
CreateMap<UpdateAppInput, AppEntity>(MemberList.None);
|
CreateMap<UpdateAppInput, AppEntity>(MemberList.None);
|
||||||
CreateMap<CreateAppScopeInput, AppScopeEntity>(MemberList.None);
|
CreateMap<CreateAppScopeInput, AppScopeEntity>(MemberList.None);
|
||||||
|
|
||||||
|
CreateMap<UpsertAppSubscribeConfigInput, AppSubscribeConfigEntity>(MemberList.None);
|
||||||
|
CreateMap<UpsertAppSubscribeConfigInput, AppSubscribeEvent>(MemberList.None);
|
||||||
|
CreateMap<DeleteAppSubscribeConfigInput, AppSubscribeEvent>(MemberList.None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15,6 +15,7 @@ public class ParameterProfile: Profile
|
|||||||
public ParameterProfile()
|
public ParameterProfile()
|
||||||
{
|
{
|
||||||
CreateMap<InterfaceParameterOutputValueObject, ParameterInput>(MemberList.None);
|
CreateMap<InterfaceParameterOutputValueObject, ParameterInput>(MemberList.None);
|
||||||
|
CreateMap<InterfaceParameterOutputValueObject, InterfaceParameterOutput>(MemberList.None);
|
||||||
CreateMap<ParameterEntity, MapParameterCascadedItem>(MemberList.None);
|
CreateMap<ParameterEntity, MapParameterCascadedItem>(MemberList.None);
|
||||||
CreateMap<ParameterInput, ParameterEntity>(MemberList.None)
|
CreateMap<ParameterInput, ParameterEntity>(MemberList.None)
|
||||||
.ForMember(dest => dest.Id,
|
.ForMember(dest => dest.Id,
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using InterfaceForward.Repositories;
|
|||||||
using InterfaceForward.Repositories.Interface.Entitys;
|
using InterfaceForward.Repositories.Interface.Entitys;
|
||||||
using InterfaceForward.Repositories.Interface.Services;
|
using InterfaceForward.Repositories.Interface.Services;
|
||||||
using InterfaceForward.Repositories.Interface.ValueObjects;
|
using InterfaceForward.Repositories.Interface.ValueObjects;
|
||||||
|
using InterfaceForward.Repositories.Parameter.VO;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace InterfaceForward.Application.Services.Interface;
|
namespace InterfaceForward.Application.Services.Interface;
|
||||||
@ -45,8 +46,8 @@ public class SystemInterfaceService : ApplicationService
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 系统接口分页列表
|
/// 系统接口分页列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -69,9 +70,9 @@ public class SystemInterfaceService : ApplicationService
|
|||||||
GetSystemInterfaceTreeListAsync(SystemInterfaceTreeListInputObjectValue input)
|
GetSystemInterfaceTreeListAsync(SystemInterfaceTreeListInputObjectValue input)
|
||||||
{
|
{
|
||||||
var res = await _interfaceRepository.GetSystemInterfaceListAsync(input);
|
var res = await _interfaceRepository.GetSystemInterfaceListAsync(input);
|
||||||
|
|
||||||
var tree = await _interfaceCategoryService.GetCategoryTree(true, res);
|
var tree = await _interfaceCategoryService.GetCategoryTree(true, res);
|
||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,9 +96,13 @@ public class SystemInterfaceService : ApplicationService
|
|||||||
// 构造参数
|
// 构造参数
|
||||||
var paras = await _interfaceRepository.GetParameterListByIdAsync(id);
|
var paras = await _interfaceRepository.GetParameterListByIdAsync(id);
|
||||||
// 入参树形列表
|
// 入参树形列表
|
||||||
res.InParameterList = paras.Where(x => x.IsInPara).ToList();
|
res.InParameterList =
|
||||||
|
ObjectMapper.Map<List<InterfaceParameterOutputValueObject>, List<InterfaceParameterOutput>>(
|
||||||
|
paras.Where(x => x.IsInPara).ToList());
|
||||||
// 出参树形列表
|
// 出参树形列表
|
||||||
res.OutParameterList = paras.Where(x => !x.IsInPara).ToList();
|
res.OutParameterList =
|
||||||
|
ObjectMapper.Map<List<InterfaceParameterOutputValueObject>, List<InterfaceParameterOutput>>(
|
||||||
|
paras.Where(x => !x.IsInPara).ToList());
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -137,10 +142,10 @@ public class SystemInterfaceService : ApplicationService
|
|||||||
switch (input.OptionType)
|
switch (input.OptionType)
|
||||||
{
|
{
|
||||||
case OptionType.新增:
|
case OptionType.新增:
|
||||||
await CreateSystemInterfaceAsync(input);
|
await CreateSystemInterfaceAsync(input);
|
||||||
break;
|
break;
|
||||||
case OptionType.修改:
|
case OptionType.修改:
|
||||||
await UpdateSystemInterfaceAsync(input);
|
await UpdateSystemInterfaceAsync(input);
|
||||||
break;
|
break;
|
||||||
case OptionType.删除:
|
case OptionType.删除:
|
||||||
await BatchDeleteSystemInterfaceByIdsAsync(new List<int> { input.Id ?? 0 });
|
await BatchDeleteSystemInterfaceByIdsAsync(new List<int> { input.Id ?? 0 });
|
||||||
@ -173,6 +178,7 @@ public class SystemInterfaceService : ApplicationService
|
|||||||
{
|
{
|
||||||
await _interfaceMapRepository.SoftDeleteAsync(x => mapIds.Contains(x.Id));
|
await _interfaceMapRepository.SoftDeleteAsync(x => mapIds.Contains(x.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删缓存
|
// 删缓存
|
||||||
await RedisHelper.Client.DelAsync(SystemInterfaceDropdownCacheKey);
|
await RedisHelper.Client.DelAsync(SystemInterfaceDropdownCacheKey);
|
||||||
|
|
||||||
@ -205,8 +211,7 @@ public class SystemInterfaceService : ApplicationService
|
|||||||
throw new BusinessException(message: $"接口名:{input.Name} 已存在");
|
throw new BusinessException(message: $"接口名:{input.Name} 已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await _interfaceRepository.IsAnyAsync(
|
if (await _interfaceRepository.IsAnyAsync(x => x.Id != input.Id && x.IsUpStream && x.Code.Equals(input.Code)))
|
||||||
x => x.Id != input.Id && x.IsUpStream && x.Code.Equals(input.Code)))
|
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "接口code已存在");
|
throw new BusinessException(message: "接口code已存在");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using InterfaceForward.Repositories.Parameter.VO;
|
using System.Text.Json.Serialization;
|
||||||
|
using InterfaceForward.Repositories.Parameter.VO;
|
||||||
|
|
||||||
namespace InterfaceForward.Repositories.Interface.ValueObjects;
|
namespace InterfaceForward.Repositories.Interface.ValueObjects;
|
||||||
|
|
||||||
@ -65,10 +66,64 @@ public class SystemInterfaceOutput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入参列表
|
/// 入参列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<InterfaceParameterOutputValueObject> InParameterList { get; set; }
|
public List<InterfaceParameterOutput> InParameterList { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出参列表
|
/// 出参列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<InterfaceParameterOutputValueObject> OutParameterList { get; set; }
|
public List<InterfaceParameterOutput> OutParameterList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InterfaceParameterOutput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 父级Id
|
||||||
|
/// </summary>
|
||||||
|
public int PId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 别名
|
||||||
|
/// </summary>
|
||||||
|
public string Alias { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// 参数名
|
||||||
|
///</summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// 参数名(中文)
|
||||||
|
///</summary>
|
||||||
|
public string CnName { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// 参数类型
|
||||||
|
///</summary>
|
||||||
|
public int Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否必填
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRequired { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// 参数描述
|
||||||
|
///</summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// 0:返回参数;1:请求参数
|
||||||
|
///</summary>
|
||||||
|
public bool IsInPara { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// 序列
|
||||||
|
///</summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public string Sort { get; set; }
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user