34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using Cms.Core.Entity;
|
|
using Cms.Core.EntityFramework;
|
|
using Cms.External.WebApi.Dtos;
|
|
using Cms.External.WebApi.Services.Impl;
|
|
using DG.EntityFramework;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Cms.External.WebApi.Services
|
|
{
|
|
internal class WeworkAgentService : IWeworkAgentService
|
|
{
|
|
private readonly IBaseRepository<DncmsbaseDbContext> _dncmsbaseRepository;
|
|
public WeworkAgentService(IBaseRepository<DncmsbaseDbContext> dncmsbaseRepository)
|
|
{
|
|
_dncmsbaseRepository = dncmsbaseRepository;
|
|
}
|
|
|
|
public async Task<List<WeworkAgentDto>> GetWeworkAgents()
|
|
{
|
|
return await (from a in _dncmsbaseRepository.GetRepository<WeworkAgent>().Query()
|
|
join b in _dncmsbaseRepository.GetRepository<Wework>().Query() on a.Appid equals b.Appid
|
|
select new { a, b })
|
|
.Where(x => x.a.Close == 1)
|
|
.Select(x => new WeworkAgentDto
|
|
{
|
|
WeworkName = x.b.Name,
|
|
Agentid = x.a.Agentid,
|
|
Appid = x.a.Appid,
|
|
Name = x.a.Name,
|
|
}).ToListAsync();
|
|
}
|
|
}
|
|
}
|