parent
1fe786d954
commit
b195a52329
@ -0,0 +1,14 @@
|
||||
using Entity.DbModel.Station;
|
||||
using HybirdFrameworkCore.Autofac.Attribute;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Repository.Station;
|
||||
|
||||
[Scope("SingleInstance")]
|
||||
public class EquipAlarmLevelRepository : BaseRepository<EquipAlarmLevel>
|
||||
{
|
||||
|
||||
public EquipAlarmLevelRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using Entity.DbModel.Station;
|
||||
using HybirdFrameworkCore.Autofac.Attribute;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Repository.Station;
|
||||
|
||||
[Scope("SingleInstance")]
|
||||
public class EquipAlarmTypeRepository : BaseRepository<EquipAlarmType>
|
||||
{
|
||||
|
||||
public EquipAlarmTypeRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
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));
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
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 EquipAlarmTypeService : BaseServices<EquipAlarmType>
|
||||
{
|
||||
EquipAlarmTypeRepository _equipAlarmTypeRepository;
|
||||
public EquipAlarmTypeService(EquipAlarmTypeRepository dal)
|
||||
{
|
||||
_equipAlarmTypeRepository = dal;
|
||||
BaseDal = dal;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询故障信息分页
|
||||
/// </summary>
|
||||
/// <param name="equipAlarmType"></param>
|
||||
/// <returns></returns>
|
||||
public PageResult<EquipAlarmTypeResp> QueryEqmFaultInfo(QueryEquipAlarmTypeReq equipAlarmType)
|
||||
{
|
||||
|
||||
//创建一个空的表达式树
|
||||
Expression<Func<EquipAlarmType, bool>> where = null;
|
||||
//// 定义参数表达式
|
||||
ParameterExpression parameter = Expression.Parameter(typeof(EquipAlarmType), "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<EquipAlarmTypeResp>.ConvertPage(_equipAlarmTypeRepository.QueryIPageByCause(equipAlarmType, where));
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
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 SwapOrderStepService : BaseServices<SwapOrderStep>
|
||||
{
|
||||
SwapOrderStepRepository _swapOrderStepRepository;
|
||||
public SwapOrderStepService(SwapOrderStepRepository dal)
|
||||
{
|
||||
_swapOrderStepRepository = dal;
|
||||
BaseDal = dal;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询换电步序信息分页
|
||||
/// </summary>
|
||||
/// <param name="swapOrderStep"></param>
|
||||
/// <returns></returns>
|
||||
public PageResult<SwapOrderStepResp> QueryEqmFaultInfo(QuerySwapOrderStepReq swapOrderStep)
|
||||
{
|
||||
|
||||
//创建一个空的表达式树
|
||||
Expression<Func<SwapOrderStep, bool>> where = null;
|
||||
//// 定义参数表达式
|
||||
ParameterExpression parameter = Expression.Parameter(typeof(SwapOrderStep), "u");
|
||||
|
||||
if (swapOrderStep.Id!=0)
|
||||
{
|
||||
Expression<Func<SwapOrderStep, bool>> condition1Expr = u => u.Id == swapOrderStep.Id;
|
||||
where = condition1Expr;
|
||||
}
|
||||
if (swapOrderStep.Step != 0)
|
||||
{
|
||||
Expression<Func<SwapOrderStep, bool>> condition2Expr = u => u.Step == swapOrderStep.Step;
|
||||
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrderStep, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(swapOrderStep.SwapOrderSn))
|
||||
{
|
||||
Expression<Func<SwapOrderStep, bool>> condition2Expr = u => u.SwapOrderSn == swapOrderStep.SwapOrderSn;
|
||||
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrderStep, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
||||
}
|
||||
// 构建查询条件
|
||||
if (!string.IsNullOrEmpty(swapOrderStep.StepName))
|
||||
{
|
||||
Expression<Func<SwapOrderStep, bool>> condition2Expr = u => u.StepName == swapOrderStep.StepName;
|
||||
where = where == null ? condition2Expr : Expression.Lambda<Func<SwapOrderStep, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
||||
}
|
||||
//查询
|
||||
return PageResult<SwapOrderStepResp>.ConvertPage(_swapOrderStepRepository.QueryIPageByCause(swapOrderStep, where));
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
using AutoMapper;
|
||||
using Entity.Api.Req;
|
||||
using Entity.Api.Resp;
|
||||
using Entity.DbModel.Station;
|
||||
using HybirdFrameworkCore.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Service.Station;
|
||||
|
||||
namespace WebStarter.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 换电设备报警等级
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class EquipAlarmLevelController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly EquipAlarmLevelService equipAlarmLevelService;
|
||||
|
||||
public EquipAlarmLevelController(EquipAlarmLevelService equipAlarmLevelService)
|
||||
{
|
||||
this.equipAlarmLevelService = equipAlarmLevelService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询故障等级信息
|
||||
/// </summary>
|
||||
/// <param name="eqmFaultLevelReq"> 查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("QueryEquipAlarmLevel")]
|
||||
public Result<PageResult<EquipAlarmLevelResp>> QueryEquipAlarmLevel([FromBody] QueryEquipAlarmLevelReq eqmFaultLevelReq)
|
||||
{
|
||||
|
||||
return Result<PageResult<EquipAlarmLevelResp>>.Success(equipAlarmLevelService.QueryEqmFaultInfo(eqmFaultLevelReq));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加故障等级信息
|
||||
/// </summary>
|
||||
/// <param name="eqmFaultLevelReq"> 添加参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("AddEquipAlarmLevel")]
|
||||
public Result<bool> AddEquipAlarmLevel([FromBody] AddEquipAlarmLevelReq eqmFaultLevelReq)
|
||||
{
|
||||
//映射数据
|
||||
var config = new MapperConfiguration(cfg => cfg.CreateMap<EquipAlarmLevel, AddEquipAlarmLevelReq>().ReverseMap());
|
||||
IMapper mapper = config.CreateMapper();
|
||||
EquipAlarmLevel baseEqmFaultLevel = mapper.Map<EquipAlarmLevel>(eqmFaultLevelReq);
|
||||
|
||||
//TODO Id换成等级字段
|
||||
var eqmFaultLevel = equipAlarmLevelService.QueryByClause(u => u.Id == eqmFaultLevelReq.Id);
|
||||
if (eqmFaultLevel!=null)
|
||||
{
|
||||
return Result<bool>.Fail("插入失败!已有改等级信息");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 更改
|
||||
if (equipAlarmLevelService.Insert(baseEqmFaultLevel) != 0)
|
||||
{
|
||||
return Result<bool>.Success("插入成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Result<bool>.Fail("插入失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更改故障等级信息
|
||||
/// </summary>
|
||||
/// <param name="eqmFaultLevelReq">更改信息 </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("ModifyEquipAlarmLevel")]
|
||||
public Result<bool> ModifyEquipAlarmLevel([FromBody] ModifyEquipAlarmLevelReq eqmFaultLevelReq)
|
||||
{
|
||||
var config = new MapperConfiguration(cfg => cfg.CreateMap<EquipAlarmLevel, ModifyEquipAlarmLevelReq>().ReverseMap());
|
||||
IMapper mapper = config.CreateMapper();
|
||||
EquipAlarmLevel baseEqmFaultLevel = mapper.Map<EquipAlarmLevel>(eqmFaultLevelReq);
|
||||
|
||||
if (equipAlarmLevelService.Update(baseEqmFaultLevel))
|
||||
{
|
||||
return Result<bool>.Success("更改成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Result<bool>.Fail("更改失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除故障等级信息
|
||||
/// </summary>
|
||||
/// <param name="ids">自增id数组</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("RemoveEquipAlarmLevel")]
|
||||
public Result<bool> RemoveEquipAlarmLevel([FromBody] int[] ids)
|
||||
{
|
||||
if (equipAlarmLevelService.DeleteByIds(ids))
|
||||
{
|
||||
return Result<bool>.Success("删除成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Result<bool>.Fail("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using AutoMapper;
|
||||
using Entity.Api.Req;
|
||||
using Entity.Api.Resp;
|
||||
using Entity.DbModel.Station;
|
||||
using HybirdFrameworkCore.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Service.Station;
|
||||
|
||||
namespace WebStarter.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 换电状态订单信息
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class SwapOrderStepController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly SwapOrderStepService swapOrderStepService;
|
||||
|
||||
public SwapOrderStepController(SwapOrderStepService swapOrderStepService)
|
||||
{
|
||||
this.swapOrderStepService = swapOrderStepService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询换电状态订单信息
|
||||
/// </summary>
|
||||
/// <param name="swapOrderStepReq"> 查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("QuerySwapOrderStep")]
|
||||
public Result<PageResult<SwapOrderStepResp>> QuerySwapOrderStep([FromBody] QuerySwapOrderStepReq swapOrderStepReq)
|
||||
{
|
||||
return Result<PageResult<SwapOrderStepResp>>.Success(swapOrderStepService.QueryEqmFaultInfo(swapOrderStepReq));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除换电状态订单信息
|
||||
/// </summary>
|
||||
/// <param name="ids">自增id数组</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("RemoveSwapOrderStep")]
|
||||
public Result<bool> RemoveSwapOrderStep([FromBody] int[] ids)
|
||||
{
|
||||
if (swapOrderStepService.DeleteByIds(ids))
|
||||
{
|
||||
return Result<bool>.Success("删除成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Result<bool>.Fail("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue