feat 获取额外信息
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -31,7 +33,7 @@ public class GainfoOutsourceController : ControllerBase
|
||||
{
|
||||
await _gainfoOutSourceService.SaveAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
@@ -42,4 +44,15 @@ public class GainfoOutsourceController : ControllerBase
|
||||
{
|
||||
await _gainfoOutSourceService.SaveAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取外包人员额外信息
|
||||
/// </summary>
|
||||
/// <param name="userNo"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("info")]
|
||||
public async Task<GainfoOutSourceExternalInfoResponse> GetExternalInfoAsync([Required] string userNo)
|
||||
{
|
||||
return await _gainfoOutSourceService.GetExternalInfoAsync(userNo);
|
||||
}
|
||||
}
|
||||
@@ -55,13 +55,15 @@ public class GainfoOutsourceRequest
|
||||
/// <summary>
|
||||
/// 入职日期
|
||||
/// </summary>
|
||||
public DateTime? EntryDate { get; set; }
|
||||
public DateTime EntryDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 离职日期
|
||||
/// </summary>
|
||||
public DateTime? ResignationDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 额外信息
|
||||
/// </summary>
|
||||
public GainfoOutSourceExternalInfoDto ExternalInfo { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
public class GainfoOutSourceExternalInfoResponse : GainfoOutSourceExternalInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -1,8 +1,21 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IGainfoOutsourceService : IScopeDependency
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存/编辑外包人员信息
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task SaveAsync(GainfoOutsourceRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 获取额外信息
|
||||
/// </summary>
|
||||
/// <param name="userNo"></param>
|
||||
/// <returns></returns>
|
||||
Task<GainfoOutSourceExternalInfoResponse> GetExternalInfoAsync(string userNo);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
@@ -13,7 +14,7 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly RedisCache _redisCache;
|
||||
|
||||
public GainfoOutsourceService(IDbContext dbContext, RedisCache redisCache )
|
||||
public GainfoOutsourceService(IDbContext dbContext, RedisCache redisCache)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_redisCache = redisCache;
|
||||
@@ -55,6 +56,23 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
||||
}
|
||||
|
||||
|
||||
public async Task<GainfoOutSourceExternalInfoResponse> GetExternalInfoAsync(string userNo)
|
||||
{
|
||||
return await _dbContext.Queryable<OutsourceEntity>()
|
||||
.LeftJoin<GainfoEntity>((a, b) => a.Code == b.Code)
|
||||
.LeftJoin<GainfoEntity>((a, b, c) => a.SapCode == c.Code)
|
||||
.Where((a, b, c) => b.No == userNo)
|
||||
.Select((a, b, c) => new GainfoOutSourceExternalInfoResponse
|
||||
{
|
||||
Supplier = a.Supplier,
|
||||
SapCode = a.SapCode,
|
||||
SapPhone = a.SapPhone,
|
||||
Name = c.Name
|
||||
})
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
|
||||
//********************************************************************** help methods ***********************************************************************************
|
||||
|
||||
private async Task<string> GetOutSourceCodeAsync()
|
||||
|
||||
Reference in New Issue
Block a user