1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using YBEE.EQM.Core;
- namespace YBEE.EQM.Application;
- /// <summary>
- /// 字典数据服务
- /// </summary>
- public class SysDictDataService : ISysDictDataService, ITransient
- {
- private readonly IRepository<SysDictData> _dictDataRep;
- public SysDictDataService(IRepository<SysDictData> dictDataRep)
- {
- _dictDataRep = dictDataRep;
- }
- /// <summary>
- /// 获取所有字典列表
- /// </summary>
- /// <returns></returns>
- public async Task<List<SysDictDataOutput>> GetAllList()
- {
- var items = await _dictDataRep.DetachedEntities//.Include(t => t.DictType)
- .Where(u => u.Status == CommonStatus.ENABLE)
- .OrderBy(u => u.Sort)
- .ProjectToType<SysDictDataOutput>()
- .ToListAsync();
- return items;
- }
- /// <summary>
- /// 通过字典类型ID获取字典列表
- /// </summary>
- /// <param name="dictTypeId"></param>
- /// <returns></returns>
- public async Task<List<SysDictDataOutput>> GetListByDictTypeId(int dictTypeId)
- {
- var items = await _dictDataRep.DetachedEntities.Include(t => t.SysDictType)
- .Where(u => u.SysDictTypeId == dictTypeId && u.Status == CommonStatus.ENABLE)
- .OrderBy(u => u.Sort)
- .ProjectToType<SysDictDataOutput>()
- .ToListAsync();
- return items;
- }
- }
|