You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.7 KiB
C#

using CompressorXN_Log;
using CompressorXN_Model;
using CompressorXN_Model.ViewModel.Response;
using System;
using System.Collections.Generic;
namespace CompressorXN_Service
{
public class ParaPlcPointService : DbContext
{
/// <summary>
/// 查询参数及参数点位
/// </summary>
/// <param name="productTypeName"></param>
/// <returns></returns>
public List<ParaPointVM> QueryParaPointByProductTypeName(string productTypeName)
{
try
{
return db.Queryable<T_Para>()
.InnerJoin<T_ParaPlcPoint>((a, b) => a.ParaType == b.ParaType && b.ParaName == a.ParaName)
.Where((a, b) => a.ProductTypeName == productTypeName)
.Select((a, b) => new ParaPointVM
{
ProductTypeName = a.ProductTypeName,
ParaType = a.ParaType,
ParaName = a.ParaName,
TargetVal = a.TargetVal,
TargetAddress = b.TargetAddress,
MinVal = a.MinVal,
MinAddress = b.MinAddress,
MaxVal = a.MaxVal,
MaxAddress = b.MaxAddress,
IsCheck = a.IsCheck,
CheckAddress = b.CheckAddress
}).ToList();
}
catch (Exception ex)
{
LogHelper.Error(ex, "执行ParaPlcPointService下QueryParaPointByProductTypeName时异常");
return null;
}
}
}
}