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.
 
 
 
Tiobon.Web.Core/Tiobon.Core.Services/Ghre/Ghre_SchoolServices.cs

55 lines
1.8 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 Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace Tiobon.Core.Services;
/// <summary>
/// 培训机构 (服务)
/// </summary>
public class Ghre_SchoolServices : BaseServices<Ghre_School, Ghre_SchoolDto, InsertGhre_SchoolInput, EditGhre_SchoolInput>, IGhre_SchoolServices
{
private readonly IBaseRepository<Ghre_School> _dal;
public Ghre_SchoolServices(ICaching caching, IBaseRepository<Ghre_School> dal)
{
this._dal = dal;
base.BaseDal = dal;
base._caching = caching;
}
public override async Task<ServicePageResult<Ghre_SchoolDto>> QueryFilterPage(QueryBody filter)
{
string schoolNo1 = string.Empty;
foreach (JProperty jProperty in filter.jsonParam.Properties())
{
var name = jProperty.Name;
var value = jProperty.Value.ToString();
if (name == "SchoolNo1")
{
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value);
schoolNo1 = jsonParam?.columnValue;
}
}
var condition = string.Empty;
if (!string.IsNullOrWhiteSpace(schoolNo1))
condition = $"(SchoolNo LIKE '%{schoolNo1}%' OR SchoolName LIKE '%{schoolNo1}%')";
var data = await base.QueryFilterPage(filter, condition);
data.result.DT_TableDataT1.ForEach(x =>
{
if (x.ExpirationDate != null)
x.ExpirationDate1 = x.ExpirationDate.Value.ToString("yyyy-MM-dd");
if (x.EffectiveDate != null)
x.EffectiveDate1 = x.EffectiveDate.Value.ToString("yyyy-MM-dd");
});
return data;
}
}