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.

55 lines
1.8 KiB

using Entity.Api.Req;
using Entity.Api.Resp;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using Repository.Station;
using SqlSugar;
using System.Linq.Expressions;
namespace Service.Station;
[Scope("SingleInstance")]
public class EquipAlarmLevelService : BaseServices<EquipAlarmLevel>
{
EquipAlarmLevelRepository _equipAlarmLevelRepository;
public EquipAlarmLevelService(EquipAlarmLevelRepository dal)
{
_equipAlarmLevelRepository = dal;
BaseDal = dal;
}
/// <summary>
/// 根据条件查询故障等级信息分页
/// </summary>
/// <param name="equipAlarmLevel"></param>
/// <returns></returns>
public PageResult<EquipAlarmLevelResp> QueryEqmFaultInfo(QueryEquipAlarmLevelReq equipAlarmLevel)
{
//创建一个空的表达式树
Expression<Func<EquipAlarmLevel, bool>> where = null;
//// 定义参数表达式
ParameterExpression parameter = Expression.Parameter(typeof(EquipAlarmLevel), "u");
//TODO 缺少数据库字段先屏蔽
//if (!string.IsNullOrEmpty(quipAlarmLevel.Level))
//{
// Expression<Func<EquipAlarmLevel, bool>> condition1Expr = u => u.Level == quipAlarmLevel.Level;
// where = condition1Expr;
//}
//// 构建查询条件
//if (!string.IsNullOrEmpty(quipAlarmLevel.LevelName))
//{
// Expression<Func<EquipAlarmLevel, bool>> condition2Expr = u => u.LevelName == quipAlarmLevel.LevelName;
// where = where == null ? condition2Expr : Expression.Lambda<Func<EquipAlarmLevel, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
//}
//查询
return PageResult<EquipAlarmLevelResp>.ConvertPage(_equipAlarmLevelRepository.QueryIPageByCause(equipAlarmLevel, where));
}
}