using ConfigurationApi.IRepositories; using MadRunFabric.Common; using MadRunFabric.Common.Options; using MadRunFabric.Model; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Text; using System.Linq; namespace ConfigurationApi.Repositories { public class Sys_Post_SystemRepository : BaseRepository, ISys_Post_SystemRepository { protected readonly ILogger> _logger; protected readonly IMongoCollection _collection_sys_dictionaryvalue; public Sys_Post_SystemRepository(IOptions settings, ILogger> logger) : base(settings, logger) { _collection_sys_dictionaryvalue = _context.GetCollection(); _logger = logger; } /// /// 获取岗位系统树形结构 /// /// public IEnumerable GetPostSystemAsync(string postid) { var query = from p in _collection.AsQueryable() where p.postid == postid && p.isdelete == 0 select p; var systemlist = from p in _collection_sys_dictionaryvalue.AsQueryable() where p.dictionarycode == "XTMC" && p.statetype == true select p; var list = systemlist.ToList().Select(p => new { p.id, pid = "-1", name = p.name, ischecked = query.Where(q => q.systemid == p.id).FirstOrDefault() != null ? true : false }); return list; } } }