using Tiobon.Core.IServices; using Tiobon.Core.Model.Models; using Tiobon.Core.Services.BASE; using Tiobon.Core.IRepository.Base; using Tiobon.Core.Common.Caches; using Tiobon.Core.Common; using Tiobon.Core.Model; using Tiobon.Core.Common.Helper; namespace Tiobon.Core.Services; /// /// Ghra_Staff (服务) /// public class Ghra_StaffServices : BaseServices, IGhra_StaffServices { private readonly IBaseRepository _dal; private IGhra_StaffLicenceServices _ghra_StaffLicenceServices; public Ghra_StaffServices(ICaching caching, IGhra_StaffLicenceServices ghra_StaffLicenceServices, IBaseRepository dal) { this._dal = dal; base.BaseDal = dal; base._caching = caching; _ghra_StaffLicenceServices = ghra_StaffLicenceServices; } public async Task> QuerySimple(int id) { var entity = await Db.Ado.SqlQuerySingleAsync($"SELECT * FROM Ghra_Staff WHERE StaffID='{id}' "); if (entity != null) { var licences = await Db.Ado.SqlQueryAsync($"SELECT * FROM Ghra_StaffLicence WHERE StaffID='{id}' AND IsEnable=1"); //var licences = await _ghra_StaffLicenceServices.QueryDto(x => x.StaffID == id); licences.ForEach(x => { if (!string.IsNullOrWhiteSpace(x.AttachmentIDs)) x.Attachments = JsonHelper.JsonToObj>(x.AttachmentIDs); }); entity.Licences = licences; } return ServiceResult.OprateSuccess("查询成功!", entity); } }