feat 查询档案人员所在的人员分组
This commit is contained in:
@@ -56,6 +56,17 @@ public class GainfoGroupsController : ControllerBase
|
||||
return await _gainfoGroupService.GetGainfosByGroupAsync(code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据userCode获取分配的分组
|
||||
/// </summary>
|
||||
/// <param name="userCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("groups")]
|
||||
public async Task<List<GainfoGroupTreeResponse>> GetGainfoGroupsByUserCodeAsync(string userCode)
|
||||
{
|
||||
return await _gainfoGroupService.GetGainfoGroupsByUserCodeAsync(userCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分配人员
|
||||
/// </summary>
|
||||
@@ -69,4 +80,4 @@ public class GainfoGroupsController : ControllerBase
|
||||
{
|
||||
await _gainfoGroupService.AssignGainfosAsync(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,6 @@ public interface IGainfoGroupService : IScopeDependency
|
||||
Task<List<GainfoPageResponse>> GetGainfosByGroupAsync(Guid code);
|
||||
|
||||
Task AssignGainfosAsync(GainfoAssignRequest request);
|
||||
|
||||
Task<List<GainfoGroupTreeResponse>> GetGainfoGroupsByUserCodeAsync(string userCode);
|
||||
}
|
||||
|
||||
@@ -101,6 +101,29 @@ public class GainfoGroupService : IGainfoGroupService
|
||||
}, null);
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<GainfoGroupTreeResponse>> GetGainfoGroupsByUserCodeAsync(string userCode)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == userCode).SingleAsync();
|
||||
var userNo = gainfo?.No;
|
||||
|
||||
return await _dbContext.Queryable<GainfoGroupEntity>()
|
||||
.LeftJoin<GainfoGroupRelationshipEntity>((x, r) => x.Code == r.GroupCode)
|
||||
.Where((x, r) => r.UserNo == userNo)
|
||||
.Select(x => new GainfoGroupTreeResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
PCode = x.PCode,
|
||||
Code = x.Code,
|
||||
Name = x.Name,
|
||||
Remark = x.Remark,
|
||||
Editable = x.Editable,
|
||||
IsDefault = x.IsDefault,
|
||||
TenantId = x.TenantId
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
//******************************************************* help methods ***********************************************************
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user