fix 映射转换
This commit is contained in:
@@ -3,6 +3,7 @@ using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Sys.Api;
|
||||
using Dlhis.Sys.Api.Request;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
@@ -35,9 +36,15 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
var users = await _userApi.GetUserByIdsAsync(page.Data.Select(x => x.UserId).Distinct().ToList());
|
||||
|
||||
try
|
||||
{
|
||||
var users = await _userApi.GetUserByIdsAsync(new IdsRequest { Ids = page.Data.Select(x => x.UserId).Distinct().ToList() });
|
||||
page.Data.ForEach(item => { item.UserName = users.FirstOrDefault(x => x.Id == item.UserId)?.UserName; });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.ScheduledTask.TaskAssignment.Request;
|
||||
using Dlhis.ScheduledTask.TaskAssignment.Response;
|
||||
using Dlhis.Sys.Api;
|
||||
using Dlhis.Sys.Api.Request;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
@@ -91,7 +92,7 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
|
||||
try
|
||||
{
|
||||
var userIds = page.Data.Select(x => x.CreateBy).Distinct().ToList();
|
||||
var userInfos = await _userApi.GetUserByIdsAsync(userIds);
|
||||
var userInfos = await _userApi.GetUserByIdsAsync(new IdsRequest { Ids = userIds });
|
||||
page.Data.ForEach(item => item.Creator = userInfos.FirstOrDefault(x => x.Id == item.CreateBy)?.OperatorName);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Sys.Api.Response;
|
||||
using Dlhis.Sys.Api.Request;
|
||||
using Dlhis.Sys.Api.Response;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
namespace Dlhis.Sys.Api;
|
||||
@@ -13,5 +14,5 @@ public interface IUserApi
|
||||
|
||||
[Auth]
|
||||
[Post("/api/users/by-ids")]
|
||||
Task<List<UserResponse>> GetUserByIdsAsync(List<int> ids);
|
||||
Task<List<UserResponse>> GetUserByIdsAsync(IdsRequest request);
|
||||
}
|
||||
6
Src/Dlhis.Sys.Api/Request/IdsRequest.cs
Normal file
6
Src/Dlhis.Sys.Api/Request/IdsRequest.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Dlhis.Sys.Api.Request;
|
||||
|
||||
public class IdsRequest
|
||||
{
|
||||
public List<int> Ids { get; set; }
|
||||
}
|
||||
@@ -59,9 +59,9 @@ public class UsersController : ControllerBase
|
||||
|
||||
[Authorize]
|
||||
[HttpPost("by-ids")]
|
||||
public async Task<List<UserResponse>> GetUserByIdsAsync(List<int> ids)
|
||||
public async Task<List<UserResponse>> GetUserByIdsAsync(IdsRequest request)
|
||||
{
|
||||
return await _userService.GetUserByIdsAsync(ids);
|
||||
return await _userService.GetUserByIdsAsync(request.Ids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,3 +4,9 @@ public class IdRequest
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class IdsRequest
|
||||
{
|
||||
public List<int> Ids { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user