From b195a52329196a5305b595026db4bfda6fe22933 Mon Sep 17 00:00:00 2001 From: xjl <2595686544@qq.com> Date: Wed, 22 May 2024 11:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=85=E9=9A=9C=E9=85=8D=E7=BD=AE=EF=BC=88?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97=E6=AE=B5=E4=B8=8D=E5=85=A8?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Api/Req/AddEquipAlarmLevelReq.cs | 52 ++++++++ Entity/Api/Req/AddEquipAlarmTypeReq.cs | 52 ++++++++ Entity/Api/Req/ModifyEquipAlarmLevelReq.cs | 49 ++++++++ Entity/Api/Req/ModifyEquipAlarmTypeReq.cs | 49 ++++++++ Entity/Api/Req/QueryEquipAlarmLevelReq.cs | 53 ++++++++ Entity/Api/Req/QueryEquipAlarmTypeReq.cs | 53 ++++++++ Entity/Api/Req/QuerySwapOrderStepReq.cs | 41 ++++++ Entity/Api/Resp/EquipAlarmLevelResp.cs | 52 ++++++++ Entity/Api/Resp/EquipAlarmTypeResp.cs | 52 ++++++++ Entity/DbModel/Station/EquipAlarmLevel.cs | 79 ++++++------ Entity/DbModel/Station/EquipAlarmType.cs | 65 +++++----- Entity/DbModel/Station/SwapOrderStep.cs | 110 ++++++++-------- .../Station/EquipAlarmLevelRepository.cs | 14 +++ .../Station/EquipAlarmTypeRepository.cs | 14 +++ Service/Station/EquipAlarmLevelService.cs | 52 ++++++++ Service/Station/EquipAlarmTypeService.cs | 52 ++++++++ Service/Station/SwapOrderStepService.cs | 63 ++++++++++ .../Controllers/EquipAlarmLevelController.cs | 118 ++++++++++++++++++ .../Controllers/SwapOrderStepController.cs | 59 +++++++++ WinFormStarter/appsettings.json | 3 +- 20 files changed, 956 insertions(+), 126 deletions(-) create mode 100644 Entity/Api/Req/AddEquipAlarmLevelReq.cs create mode 100644 Entity/Api/Req/AddEquipAlarmTypeReq.cs create mode 100644 Entity/Api/Req/ModifyEquipAlarmLevelReq.cs create mode 100644 Entity/Api/Req/ModifyEquipAlarmTypeReq.cs create mode 100644 Entity/Api/Req/QueryEquipAlarmLevelReq.cs create mode 100644 Entity/Api/Req/QueryEquipAlarmTypeReq.cs create mode 100644 Entity/Api/Req/QuerySwapOrderStepReq.cs create mode 100644 Entity/Api/Resp/EquipAlarmLevelResp.cs create mode 100644 Entity/Api/Resp/EquipAlarmTypeResp.cs create mode 100644 Repository/Station/EquipAlarmLevelRepository.cs create mode 100644 Repository/Station/EquipAlarmTypeRepository.cs create mode 100644 Service/Station/EquipAlarmLevelService.cs create mode 100644 Service/Station/EquipAlarmTypeService.cs create mode 100644 Service/Station/SwapOrderStepService.cs create mode 100644 WebStarter/Controllers/EquipAlarmLevelController.cs create mode 100644 WebStarter/Controllers/SwapOrderStepController.cs diff --git a/Entity/Api/Req/AddEquipAlarmLevelReq.cs b/Entity/Api/Req/AddEquipAlarmLevelReq.cs new file mode 100644 index 0000000..8af9bc8 --- /dev/null +++ b/Entity/Api/Req/AddEquipAlarmLevelReq.cs @@ -0,0 +1,52 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///添加设备报警等级 + /// + public partial class AddEquipAlarmLevelReq + { + /// + /// 自增id + /// + public long Id { get; set; } + + + + + + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/Api/Req/AddEquipAlarmTypeReq.cs b/Entity/Api/Req/AddEquipAlarmTypeReq.cs new file mode 100644 index 0000000..ecebb90 --- /dev/null +++ b/Entity/Api/Req/AddEquipAlarmTypeReq.cs @@ -0,0 +1,52 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///添加设备报警等级 + /// + public partial class AddEquipAlarmTypeReq + { + /// + /// 自增id + /// + public long Id { get; set; } + + + + + + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/Api/Req/ModifyEquipAlarmLevelReq.cs b/Entity/Api/Req/ModifyEquipAlarmLevelReq.cs new file mode 100644 index 0000000..77fb35e --- /dev/null +++ b/Entity/Api/Req/ModifyEquipAlarmLevelReq.cs @@ -0,0 +1,49 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///更改设备报警等级 + /// + public partial class ModifyEquipAlarmLevelReq + { + /// + /// 自增id + /// + [Required] + public long Id { get; set; } + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/Api/Req/ModifyEquipAlarmTypeReq.cs b/Entity/Api/Req/ModifyEquipAlarmTypeReq.cs new file mode 100644 index 0000000..3b6bcde --- /dev/null +++ b/Entity/Api/Req/ModifyEquipAlarmTypeReq.cs @@ -0,0 +1,49 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///更改设备报警等级 + /// + public partial class ModifyEquipAlarmTypeReq + { + /// + /// 自增id + /// + [Required] + public long Id { get; set; } + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/Api/Req/QueryEquipAlarmLevelReq.cs b/Entity/Api/Req/QueryEquipAlarmLevelReq.cs new file mode 100644 index 0000000..5bc8ee3 --- /dev/null +++ b/Entity/Api/Req/QueryEquipAlarmLevelReq.cs @@ -0,0 +1,53 @@ +using System; +using System.Linq; +using System.Text; +using HybirdFrameworkCore.Entity; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///查询设备报警等级 + /// + public partial class QueryEquipAlarmLevelReq : QueryPageModel + { + /// + /// 自增id + /// + public long Id { get; set; } + + + + + + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string? CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string? UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/Api/Req/QueryEquipAlarmTypeReq.cs b/Entity/Api/Req/QueryEquipAlarmTypeReq.cs new file mode 100644 index 0000000..960158b --- /dev/null +++ b/Entity/Api/Req/QueryEquipAlarmTypeReq.cs @@ -0,0 +1,53 @@ +using System; +using System.Linq; +using System.Text; +using HybirdFrameworkCore.Entity; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///查询设备报警等级 + /// + public partial class QueryEquipAlarmTypeReq : QueryPageModel + { + /// + /// 自增id + /// + public long Id { get; set; } + + + + + + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string? CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string? UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/Api/Req/QuerySwapOrderStepReq.cs b/Entity/Api/Req/QuerySwapOrderStepReq.cs new file mode 100644 index 0000000..7d79dbb --- /dev/null +++ b/Entity/Api/Req/QuerySwapOrderStepReq.cs @@ -0,0 +1,41 @@ +using HybirdFrameworkCore.Entity; + +namespace Entity.Api.Req; + + +/// +/// 查询换电步序 +/// +public class QuerySwapOrderStepReq : QueryPageModel +{ + + /// + /// Desc:id + /// Default: + /// Nullable:False + /// + public int Id { get; set; } + + /// + /// Desc:换电订单编号 + /// Default: + /// Nullable:True + /// + public string? SwapOrderSn { get; set; } + + /// + /// Desc:步序;0-未知;1-空闲;200-rfid扫描;300-云平台验证; + /// Default: + /// Nullable:True + /// + public int? Step { get; set; } + + /// + /// Desc:步序名称 + /// Default: + /// Nullable:True + /// + public string? StepName { get; set; } + + +} \ No newline at end of file diff --git a/Entity/Api/Resp/EquipAlarmLevelResp.cs b/Entity/Api/Resp/EquipAlarmLevelResp.cs new file mode 100644 index 0000000..0b5e8a7 --- /dev/null +++ b/Entity/Api/Resp/EquipAlarmLevelResp.cs @@ -0,0 +1,52 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///添加设备报警等级 + /// + public partial class EquipAlarmLevelResp + { + /// + /// 自增id + /// + public long Id { get; set; } + + + + + + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/Api/Resp/EquipAlarmTypeResp.cs b/Entity/Api/Resp/EquipAlarmTypeResp.cs new file mode 100644 index 0000000..15d5483 --- /dev/null +++ b/Entity/Api/Resp/EquipAlarmTypeResp.cs @@ -0,0 +1,52 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Entity.DbModel.Station +{ + /// + ///添加设备报警等级 + /// + public partial class EquipAlarmTypeResp + { + /// + /// 自增id + /// + public long Id { get; set; } + + + + + + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + public string UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/Entity/DbModel/Station/EquipAlarmLevel.cs b/Entity/DbModel/Station/EquipAlarmLevel.cs index 4cd6e1d..ef22194 100644 --- a/Entity/DbModel/Station/EquipAlarmLevel.cs +++ b/Entity/DbModel/Station/EquipAlarmLevel.cs @@ -11,41 +11,50 @@ namespace Entity.DbModel.Station [SugarTable("equip_alarm_level")] public partial class EquipAlarmLevel { - public EquipAlarmLevel(){ - - - } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="created_by")] - public string CreatedBy {get;set;} - - /// - /// Desc:创建时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [SugarColumn(ColumnName="created_time")] - public DateTime? CreatedTime {get;set;} - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="updated_by")] - public string UpdatedBy {get;set;} - - /// - /// Desc:更新时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [SugarColumn(ColumnName="updated_time")] - public DateTime? UpdatedTime {get;set;} + /// + /// 自增id + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)] + public long Id { get; set; } + + //TODO 数据库字段未设计完 + + + + + + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } + + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } } } diff --git a/Entity/DbModel/Station/EquipAlarmType.cs b/Entity/DbModel/Station/EquipAlarmType.cs index 74ad129..f7c10fa 100644 --- a/Entity/DbModel/Station/EquipAlarmType.cs +++ b/Entity/DbModel/Station/EquipAlarmType.cs @@ -11,41 +11,44 @@ namespace Entity.DbModel.Station [SugarTable("equip_alarm_type")] public partial class EquipAlarmType { - public EquipAlarmType(){ + /// + /// 自增id + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)] + public long Id { get; set; } + //TODO 数据库字段未设计完 + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } - } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="created_by")] - public string CreatedBy {get;set;} + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } - /// - /// Desc:创建时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [SugarColumn(ColumnName="created_time")] - public DateTime? CreatedTime {get;set;} + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="updated_by")] - public string UpdatedBy {get;set;} - - /// - /// Desc:更新时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [SugarColumn(ColumnName="updated_time")] - public DateTime? UpdatedTime {get;set;} + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } } } diff --git a/Entity/DbModel/Station/SwapOrderStep.cs b/Entity/DbModel/Station/SwapOrderStep.cs index 5fbfffd..bca4eeb 100644 --- a/Entity/DbModel/Station/SwapOrderStep.cs +++ b/Entity/DbModel/Station/SwapOrderStep.cs @@ -11,73 +11,65 @@ namespace Entity.DbModel.Station [SugarTable("swap_order_step")] public partial class SwapOrderStep { - public SwapOrderStep(){ + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] + public int Id { get; set; } - } - /// - /// Desc:id - /// Default: - /// Nullable:False - /// - [SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="id")] - public int Id {get;set;} + /// + /// Desc:换电订单编号 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "swap_order_sn")] + public string? SwapOrderSn { get; set; } - /// - /// Desc:换电订单编号 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="swap_order_sn")] - public string SwapOrderSn {get;set;} + /// + /// Desc:步序;0-未知;1-空闲;200-rfid扫描;300-云平台验证; + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "step")] + public int Step { get; set; } - /// - /// Desc:步序;0-未知;1-空闲;200-rfid扫描;300-云平台验证; - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="step")] - public int? Step {get;set;} + /// + /// Desc:步序名称 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "step_name")] + public string? StepName { get; set; } - /// - /// Desc:步序名称 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="step_name")] - public string StepName {get;set;} + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_by")] + public string ?CreatedBy { get; set; } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="created_by")] - public string CreatedBy {get;set;} + /// + /// Desc:创建时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } - /// - /// Desc:创建时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [SugarColumn(ColumnName="created_time")] - public DateTime? CreatedTime {get;set;} + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_by")] + public string ?UpdatedBy { get; set; } - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="updated_by")] - public string UpdatedBy {get;set;} - - /// - /// Desc:更新时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [SugarColumn(ColumnName="updated_time")] - public DateTime? UpdatedTime {get;set;} + /// + /// Desc:更新时间 + /// Default:CURRENT_TIMESTAMP + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } } } diff --git a/Repository/Station/EquipAlarmLevelRepository.cs b/Repository/Station/EquipAlarmLevelRepository.cs new file mode 100644 index 0000000..f0c71b9 --- /dev/null +++ b/Repository/Station/EquipAlarmLevelRepository.cs @@ -0,0 +1,14 @@ +using Entity.DbModel.Station; +using HybirdFrameworkCore.Autofac.Attribute; +using SqlSugar; + +namespace Repository.Station; + +[Scope("SingleInstance")] +public class EquipAlarmLevelRepository : BaseRepository +{ + + public EquipAlarmLevelRepository(ISqlSugarClient sqlSugar) : base(sqlSugar) + { + } +} \ No newline at end of file diff --git a/Repository/Station/EquipAlarmTypeRepository.cs b/Repository/Station/EquipAlarmTypeRepository.cs new file mode 100644 index 0000000..e903466 --- /dev/null +++ b/Repository/Station/EquipAlarmTypeRepository.cs @@ -0,0 +1,14 @@ +using Entity.DbModel.Station; +using HybirdFrameworkCore.Autofac.Attribute; +using SqlSugar; + +namespace Repository.Station; + +[Scope("SingleInstance")] +public class EquipAlarmTypeRepository : BaseRepository +{ + + public EquipAlarmTypeRepository(ISqlSugarClient sqlSugar) : base(sqlSugar) + { + } +} \ No newline at end of file diff --git a/Service/Station/EquipAlarmLevelService.cs b/Service/Station/EquipAlarmLevelService.cs new file mode 100644 index 0000000..db0cbf5 --- /dev/null +++ b/Service/Station/EquipAlarmLevelService.cs @@ -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 +{ + EquipAlarmLevelRepository _equipAlarmLevelRepository; + public EquipAlarmLevelService(EquipAlarmLevelRepository dal) + { + _equipAlarmLevelRepository = dal; + BaseDal = dal; + } + + + /// + /// ѯϵȼϢҳ + /// + /// + /// + public PageResult QueryEqmFaultInfo(QueryEquipAlarmLevelReq equipAlarmLevel) + { + + //һյıʽ + Expression> where = null; + //// ʽ + ParameterExpression parameter = Expression.Parameter(typeof(EquipAlarmLevel), "u"); + + //TODO ȱݿֶ + + //if (!string.IsNullOrEmpty(quipAlarmLevel.Level)) + //{ + // Expression> condition1Expr = u => u.Level == quipAlarmLevel.Level; + // where = condition1Expr; + //} + //// ѯ + //if (!string.IsNullOrEmpty(quipAlarmLevel.LevelName)) + //{ + // Expression> condition2Expr = u => u.LevelName == quipAlarmLevel.LevelName; + // where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); + //} + //ѯ + return PageResult.ConvertPage(_equipAlarmLevelRepository.QueryIPageByCause(equipAlarmLevel, where)); + + + } +} \ No newline at end of file diff --git a/Service/Station/EquipAlarmTypeService.cs b/Service/Station/EquipAlarmTypeService.cs new file mode 100644 index 0000000..b539e25 --- /dev/null +++ b/Service/Station/EquipAlarmTypeService.cs @@ -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 +{ + EquipAlarmTypeRepository _equipAlarmTypeRepository; + public EquipAlarmTypeService(EquipAlarmTypeRepository dal) + { + _equipAlarmTypeRepository = dal; + BaseDal = dal; + } + + + /// + /// ѯϢҳ + /// + /// + /// + public PageResult QueryEqmFaultInfo(QueryEquipAlarmTypeReq equipAlarmType) + { + + //һյıʽ + Expression> where = null; + //// ʽ + ParameterExpression parameter = Expression.Parameter(typeof(EquipAlarmType), "u"); + + //TODO ȱݿֶ + + //if (!string.IsNullOrEmpty(quipAlarmLevel.Level)) + //{ + // Expression> condition1Expr = u => u.Level == quipAlarmLevel.Level; + // where = condition1Expr; + //} + //// ѯ + //if (!string.IsNullOrEmpty(quipAlarmLevel.LevelName)) + //{ + // Expression> condition2Expr = u => u.LevelName == quipAlarmLevel.LevelName; + // where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); + //} + //ѯ + return PageResult.ConvertPage(_equipAlarmTypeRepository.QueryIPageByCause(equipAlarmType, where)); + + + } +} \ No newline at end of file diff --git a/Service/Station/SwapOrderStepService.cs b/Service/Station/SwapOrderStepService.cs new file mode 100644 index 0000000..f36efbd --- /dev/null +++ b/Service/Station/SwapOrderStepService.cs @@ -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 +{ + SwapOrderStepRepository _swapOrderStepRepository; + public SwapOrderStepService(SwapOrderStepRepository dal) + { + _swapOrderStepRepository = dal; + BaseDal = dal; + } + + + /// + /// ѯ粽Ϣҳ + /// + /// + /// + public PageResult QueryEqmFaultInfo(QuerySwapOrderStepReq swapOrderStep) + { + + //һյıʽ + Expression> where = null; + //// ʽ + ParameterExpression parameter = Expression.Parameter(typeof(SwapOrderStep), "u"); + + if (swapOrderStep.Id!=0) + { + Expression> condition1Expr = u => u.Id == swapOrderStep.Id; + where = condition1Expr; + } + if (swapOrderStep.Step != 0) + { + Expression> condition2Expr = u => u.Step == swapOrderStep.Step; + where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); + } + + if (!string.IsNullOrEmpty(swapOrderStep.SwapOrderSn)) + { + Expression> condition2Expr = u => u.SwapOrderSn == swapOrderStep.SwapOrderSn; + where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); + } + // ѯ + if (!string.IsNullOrEmpty(swapOrderStep.StepName)) + { + Expression> condition2Expr = u => u.StepName == swapOrderStep.StepName; + where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); + } + //ѯ + return PageResult.ConvertPage(_swapOrderStepRepository.QueryIPageByCause(swapOrderStep, where)); + + + } +} \ No newline at end of file diff --git a/WebStarter/Controllers/EquipAlarmLevelController.cs b/WebStarter/Controllers/EquipAlarmLevelController.cs new file mode 100644 index 0000000..ebf33d7 --- /dev/null +++ b/WebStarter/Controllers/EquipAlarmLevelController.cs @@ -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; + +/// +/// 换电设备报警等级 +/// +[ApiController] +[Route("api/[controller]")] +public class EquipAlarmLevelController : ControllerBase +{ + + private readonly EquipAlarmLevelService equipAlarmLevelService; + + public EquipAlarmLevelController(EquipAlarmLevelService equipAlarmLevelService) + { + this.equipAlarmLevelService = equipAlarmLevelService; + } + + /// + /// 查询故障等级信息 + /// + /// 查询参数 + /// + [HttpPost] + [Route("QueryEquipAlarmLevel")] + public Result> QueryEquipAlarmLevel([FromBody] QueryEquipAlarmLevelReq eqmFaultLevelReq) + { + + return Result>.Success(equipAlarmLevelService.QueryEqmFaultInfo(eqmFaultLevelReq)); + + } + + /// + /// 添加故障等级信息 + /// + /// 添加参数 + /// + [HttpPost] + [Route("AddEquipAlarmLevel")] + public Result AddEquipAlarmLevel([FromBody] AddEquipAlarmLevelReq eqmFaultLevelReq) + { + //映射数据 + var config = new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap()); + IMapper mapper = config.CreateMapper(); + EquipAlarmLevel baseEqmFaultLevel = mapper.Map(eqmFaultLevelReq); + + //TODO Id换成等级字段 + var eqmFaultLevel = equipAlarmLevelService.QueryByClause(u => u.Id == eqmFaultLevelReq.Id); + if (eqmFaultLevel!=null) + { + return Result.Fail("插入失败!已有改等级信息"); + } + else + { + // 更改 + if (equipAlarmLevelService.Insert(baseEqmFaultLevel) != 0) + { + return Result.Success("插入成功"); + } + else + { + return Result.Fail("插入失败"); + } + } + + + } + + /// + /// 更改故障等级信息 + /// + /// 更改信息 + /// + [HttpPost] + [Route("ModifyEquipAlarmLevel")] + public Result ModifyEquipAlarmLevel([FromBody] ModifyEquipAlarmLevelReq eqmFaultLevelReq) + { + var config = new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap()); + IMapper mapper = config.CreateMapper(); + EquipAlarmLevel baseEqmFaultLevel = mapper.Map(eqmFaultLevelReq); + + if (equipAlarmLevelService.Update(baseEqmFaultLevel)) + { + return Result.Success("更改成功"); + } + else + { + return Result.Fail("更改失败"); + } + } + + /// + /// 删除故障等级信息 + /// + /// 自增id数组 + /// + [HttpPost] + [Route("RemoveEquipAlarmLevel")] + public Result RemoveEquipAlarmLevel([FromBody] int[] ids) + { + if (equipAlarmLevelService.DeleteByIds(ids)) + { + return Result.Success("删除成功"); + } + else + { + return Result.Fail("删除失败"); + } + } + +} \ No newline at end of file diff --git a/WebStarter/Controllers/SwapOrderStepController.cs b/WebStarter/Controllers/SwapOrderStepController.cs new file mode 100644 index 0000000..2dd6278 --- /dev/null +++ b/WebStarter/Controllers/SwapOrderStepController.cs @@ -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; + +/// +/// 换电状态订单信息 +/// +[ApiController] +[Route("api/[controller]")] +public class SwapOrderStepController : ControllerBase +{ + + private readonly SwapOrderStepService swapOrderStepService; + + public SwapOrderStepController(SwapOrderStepService swapOrderStepService) + { + this.swapOrderStepService = swapOrderStepService; + } + + /// + /// 查询换电状态订单信息 + /// + /// 查询参数 + /// + [HttpPost] + [Route("QuerySwapOrderStep")] + public Result> QuerySwapOrderStep([FromBody] QuerySwapOrderStepReq swapOrderStepReq) + { + return Result>.Success(swapOrderStepService.QueryEqmFaultInfo(swapOrderStepReq)); + + } + + + /// + /// 删除换电状态订单信息 + /// + /// 自增id数组 + /// + [HttpPost] + [Route("RemoveSwapOrderStep")] + public Result RemoveSwapOrderStep([FromBody] int[] ids) + { + if (swapOrderStepService.DeleteByIds(ids)) + { + return Result.Success("删除成功"); + } + else + { + return Result.Fail("删除失败"); + } + } + +} \ No newline at end of file diff --git a/WinFormStarter/appsettings.json b/WinFormStarter/appsettings.json index 5acd8e9..01d9b4e 100644 --- a/WinFormStarter/appsettings.json +++ b/WinFormStarter/appsettings.json @@ -2,7 +2,8 @@ "ConnectionStrings": { "DbType": "MySql", //数据库将支持两种模式【SqlServer,MySql】 - "SqlConnection": "server=127.0.0.1;Port=3307;Database=winformdevframework;Uid=root;Pwd=w123ee;Charset=utf8;" + "SqlConnection": "server=127.0.0.1;Port=3306;Database=huanneng_dev;Uid=root;Pwd=123456;Charset=utf8;" + //"SqlConnection": "server=192.168.2.2;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;", }, "Update": { "AutoUpdate": "false",