This commit is contained in:
2024-08-22 14:08:16 +08:00
parent 4ce0a58715
commit 27e67dadf3
29 changed files with 758 additions and 184 deletions

View File

@@ -0,0 +1,49 @@
using JNPF.Common.Core.Manager;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Systems.Interfaces.System;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.BasicData.Interfaces;
namespace Tnb.BasicData
{
/// <summary>
/// 班组服务
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
[Route("api/[area]/[controller]/[action]")]
public class BasWorkgroupService : IBasWorkgroupService, IDynamicApiController, ITransient
{
private readonly ISqlSugarRepository<BasWorkgroup> _repository;
private readonly DataBaseManager _dbManager;
private readonly IDictionaryDataService _dictionaryDataService;
public BasWorkgroupService(
ISqlSugarRepository<BasWorkgroup> repository, DataBaseManager dbManager, IDictionaryDataService dictionaryDataService)
{
_repository = repository;
_dbManager = dbManager;
_dictionaryDataService = dictionaryDataService;
}
public async Task<List<string>> GetEmployeeIds(string workGroupId)
{
return await _repository.AsSugarClient().Queryable<BasWorkgroup>()
.InnerJoin<BasWorkgroupEmployee>((a, b) => a.id == b.group_id)
.Where((a,b)=>a.id==workGroupId)
.Select((a, b) => b.employee_id)
.ToListAsync();
}
public async Task<List<string>> GetWorkgroupIdsByUserId(string userId)
{
return await _repository.AsSugarClient().Queryable<BasWorkgroupEmployee>()
.InnerJoin<BasWorkgroup>((a, b) => a.group_id == b.id)
.Where((a,b)=>a.employee_id==userId)
.Select((a, b) => b.id)
.ToListAsync();
}
}
}