49 lines
1.8 KiB
C#
49 lines
1.8 KiB
C#
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();
|
|
}
|
|
}
|
|
} |