You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.7 KiB
48 lines
1.7 KiB
|
|
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;
|
|
|
|
/// <summary>
|
|
/// Ghra_Staff (服务)
|
|
/// </summary>
|
|
public class Ghra_StaffServices : BaseServices<Ghra_Staff, Ghra_StaffDto, InsertGhra_StaffInput, EditGhra_StaffInput>, IGhra_StaffServices
|
|
{
|
|
private readonly IBaseRepository<Ghra_Staff> _dal;
|
|
private IGhra_StaffLicenceServices _ghra_StaffLicenceServices;
|
|
public Ghra_StaffServices(ICaching caching,
|
|
IGhra_StaffLicenceServices ghra_StaffLicenceServices,
|
|
IBaseRepository<Ghra_Staff> dal)
|
|
{
|
|
this._dal = dal;
|
|
base.BaseDal = dal;
|
|
base._caching = caching;
|
|
_ghra_StaffLicenceServices = ghra_StaffLicenceServices;
|
|
}
|
|
public async Task<ServiceResult<Ghra_StaffDto>> QuerySimple(int id)
|
|
{
|
|
var entity = await Db.Ado.SqlQuerySingleAsync<Ghra_StaffDto>($"SELECT * FROM Ghra_Staff WHERE StaffID='{id}' ");
|
|
|
|
|
|
if (entity != null)
|
|
{
|
|
var licences = await Db.Ado.SqlQueryAsync<Ghra_StaffLicenceDto>($"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<List<Ghrs_AttachmentDto>>(x.AttachmentIDs);
|
|
});
|
|
entity.Licences = licences;
|
|
}
|
|
return ServiceResult<Ghra_StaffDto>.OprateSuccess("查询成功!", entity);
|
|
}
|
|
} |