fix 补充代码

This commit is contained in:
2024-01-08 11:36:38 +08:00
parent b341a59359
commit a4333f7f45
9 changed files with 96 additions and 71 deletions

View File

@@ -5,4 +5,6 @@ namespace Dlhis.Basic.Organization.Services;
public interface IWerkService : IScopeDependency
{
Task<List<WerkResponse>> GetListAsync();
Task<WerkResponse> GetCurrentAsync();
}

View File

@@ -27,7 +27,7 @@ public class GainfoService : IGainfoService
/// <returns></returns>
public Task<Pagination<GainfoPageResponse>> GetPageAsync(GainfoPageRequest request)
{
var page = _gainfoStore.Queryable(request.gainfoStatus)
var page = _gainfoStore.Queryable(request.Status)
.Select<GainfoPageResponse>()
.ToPageListAsync(request);
@@ -44,7 +44,7 @@ public class GainfoService : IGainfoService
var gainfos = new List<GainfoEntity>();
GainfoEntity aginfoEntity = request.Adapt<GainfoEntity>();
aginfoEntity.Guestno = "F" + Guid.NewGuid().ToString();
aginfoEntity.No = "F" + Guid.NewGuid().ToString();
gainfos.Add(aginfoEntity);
await _gainfoStore.InsertAsync(GainfoStatusEnumType.Working, gainfos);
@@ -81,7 +81,7 @@ public class GainfoService : IGainfoService
public async Task DimissionAsync(GainfoDImissionRequest request)
{
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
.Where(x => x.Guestno == request.UserId)
.Where(x => x.No == request.UserId)
.FirstAsync();
gainfo.ThrowIfNull($"该档案不存在");
@@ -106,7 +106,7 @@ public class GainfoService : IGainfoService
public async Task OnboardingAsync(GainfoDImissionRequest request)
{
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External)
.Where(x => x.Guestno == request.UserId)
.Where(x => x.No == request.UserId)
.FirstAsync();
gainfo.ThrowIfNull($"该档案不存在");

View File

@@ -28,7 +28,7 @@ public class GainfoStore : IGainfoStore
if (gainfoStatus.HasValue && gainfoStatus != GainfoStatusEnumType.Working)
{
var tableName = typeof(GainfoEntity).GetCustomAttribute<SugarTable>().TableName;
return _dbContext.Queryable<GainfoEntity>().AS(tableName + "_" + gainfoStatus);
return _dbContext.Queryable<GainfoEntity>().AS(tableName + gainfoStatus);
}
return _dbContext.Queryable<GainfoEntity>();

View File

@@ -1,5 +1,6 @@
using Dlhis.Basic.Organization.Response;
using Dlhis.Entity.Basic.Entity;
using Kurisu.Core.User.Abstractions;
using Kurisu.SqlSugar.Services;
namespace Dlhis.Basic.Organization.Services.Implements;
@@ -7,10 +8,12 @@ namespace Dlhis.Basic.Organization.Services.Implements;
public class WerkService : IWerkService
{
private readonly IDbContext _dbContext;
private readonly ICurrentUser _currentUser;
public WerkService(IDbContext dbContext)
public WerkService(IDbContext dbContext, ICurrentUser currentUser)
{
_dbContext = dbContext;
_currentUser = currentUser;
}
public async Task<List<WerkResponse>> GetListAsync()
@@ -19,4 +22,13 @@ public class WerkService : IWerkService
.Select<WerkResponse>()
.ToListAsync();
}
public async Task<WerkResponse> GetCurrentAsync()
{
var tenant = _currentUser.GetStringTenantId();
return await _dbContext.Queryable<WerkEntity>()
.Where(x => x.Code == tenant)
.Select<WerkResponse>()
.FirstAsync();
}
}