namespace IStation.Service
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public partial class AnalysisConclusion
|
{
|
/// <summary>
|
///
|
/// </summary>
|
/// <returns></returns>
|
private static Dictionary<string, List<Model.AnalysisConclusion>> GetDictCache()
|
{
|
return AnalysisConclusionCacheHelper.GetSet(() =>
|
{
|
var dal = DALCreateHelper.CreateDAL<IStation.DAL.IAnalysisConclusion>();
|
var entity_dict = dal.GetAllTable();
|
if (entity_dict == null || !entity_dict.Any())
|
{
|
return new Dictionary<string, List<Model.AnalysisConclusion>>();
|
}
|
|
var model_dict = new Dictionary<string, List<Model.AnalysisConclusion>>();
|
for (int i = 0; i < entity_dict.Count; i++)
|
{
|
var entity_item = entity_dict.ElementAt(i);
|
model_dict[entity_item.Key] = Entity2Models(entity_item.Value);
|
}
|
return model_dict;
|
}, ConfigHelper.CacheKeepTime, ConfigHelper.CacheRandomTime);
|
}
|
|
|
/// <summary>
|
/// 查询
|
/// </summary>
|
public List<Model.AnalysisConclusion> GetList(string runFlag)
|
{
|
var dal = DALCreateHelper.CreateDAL<IStation.DAL.IAnalysisConclusion>();
|
var tableName = dal.GetTableName(runFlag);
|
var dict = GetDictCache();
|
if (!dict.ContainsKey(tableName))
|
return default;
|
|
return dict[tableName]?.OrderBy(x => x.Power).ToList();
|
}
|
|
/// <summary>
|
/// 查询
|
/// </summary>
|
public List<Model.AnalysisConclusion> GetList(string runFlag, double targetHead)
|
{
|
var dal = DALCreateHelper.CreateDAL<IStation.DAL.IAnalysisConclusion>();
|
var tableName = dal.GetTableName(runFlag);
|
var dict = GetDictCache();
|
if (!dict.ContainsKey(tableName))
|
return default;
|
|
return dict[tableName]?
|
.Where(x => x.Head == targetHead)
|
.OrderBy(x => x.Power)
|
.ToList();
|
}
|
|
/// <summary>
|
/// 查询
|
/// </summary>
|
public Model.AnalysisConclusion GetMinHead(string runFlag)
|
{
|
var dal = DALCreateHelper.CreateDAL<IStation.DAL.IAnalysisConclusion>();
|
var tableName = dal.GetTableName(runFlag);
|
var dict = GetDictCache();
|
if (!dict.ContainsKey(tableName))
|
return default;
|
return dict[tableName]?.OrderBy(x => x.Head).FirstOrDefault();
|
}
|
|
/// <summary>
|
/// 查询
|
/// </summary>
|
public List<Model.AnalysisConclusion> GetList(string runFlag, double minHz, double maxHz, double targetHead)
|
{
|
var dal = DALCreateHelper.CreateDAL<IStation.DAL.IAnalysisConclusion>();
|
var tableName = dal.GetTableName(runFlag);
|
var dict = GetDictCache();
|
if (!dict.ContainsKey(tableName))
|
return default;
|
|
return dict[tableName]?
|
.Where(x => x.Pump1 >= minHz && x.Pump1 <= maxHz && x.Head == targetHead)
|
.OrderBy(x => x.Power)
|
.ToList();
|
}
|
|
}
|
}
|