| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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<Sys_Post_System, string>, ISys_Post_SystemRepository
- {
- protected readonly ILogger<BaseRepository<Sys_Post_System, string>> _logger;
- protected readonly IMongoCollection<Sys_DictionaryValue> _collection_sys_dictionaryvalue;
- public Sys_Post_SystemRepository(IOptions<MongodbOptions> settings, ILogger<BaseRepository<Sys_Post_System, string>> logger) : base(settings, logger)
- {
- _collection_sys_dictionaryvalue = _context.GetCollection<Sys_DictionaryValue>();
- _logger = logger;
- }
- /// <summary>
- /// 获取岗位系统树形结构
- /// </summary>
- /// <returns></returns>
- public IEnumerable<object> 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;
- }
- }
- }
|