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
{
///
/// 班组服务
///
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
[Route("api/[area]/[controller]/[action]")]
public class BasWorkgroupService : IBasWorkgroupService, IDynamicApiController, ITransient
{
private readonly ISqlSugarRepository _repository;
private readonly DataBaseManager _dbManager;
private readonly IDictionaryDataService _dictionaryDataService;
public BasWorkgroupService(
ISqlSugarRepository repository, DataBaseManager dbManager, IDictionaryDataService dictionaryDataService)
{
_repository = repository;
_dbManager = dbManager;
_dictionaryDataService = dictionaryDataService;
}
public async Task> GetEmployeeIds(string workGroupId)
{
return await _repository.AsSugarClient().Queryable()
.InnerJoin((a, b) => a.id == b.group_id)
.Where((a,b)=>a.id==workGroupId)
.Select((a, b) => b.employee_id)
.ToListAsync();
}
public async Task> GetWorkgroupIdsByUserId(string userId)
{
return await _repository.AsSugarClient().Queryable()
.InnerJoin((a, b) => a.group_id == b.id)
.Where((a,b)=>a.employee_id==userId)
.Select((a, b) => b.id)
.ToListAsync();
}
}
}