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.

111 lines
3.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace Entity.DbModel.Station
{
///<summary>
///电价模型详情
///</summary>
[SugarTable("elec_price_model_version_detail")]
public partial class ElecPriceModelVersionDetail : BaseModel
{
public ElecPriceModelVersionDetail(){
}
/// <summary>
/// Desc:id
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="id")]
public int Id {get;set;}
/// <summary>
/// Desc:版本号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="version")]
public int Version {get;set;}
/// <summary>
/// 开始时间:小时
/// </summary>
[SugarColumn(ColumnName = "start_hour")]
public int StartHour { get; set; }
/// <summary>
/// 开始时间:分组
/// </summary>
[SugarColumn(ColumnName = "start_minute")]
public int StartMinute { get; set; }
/// <summary>
/// 开始时间:秒
/// </summary>
[SugarColumn(ColumnName = "start_second")]
public int StartSecond { get; set; }
/// <summary>
/// 结束时间:小时
/// </summary>
[SugarColumn(ColumnName = "end_hour")]
public int EndHour { get; set; }
/// <summary>
/// 结束时间:分钟
/// </summary>
[SugarColumn(ColumnName = "end_minute")]
public int EndMinute { get; set; }
/// <summary>
/// 结束时间:秒
/// </summary>
[SugarColumn(ColumnName = "end_second")]
public int EndSecond { get; set; }
private double _price;
/// <summary>
/// Desc:价格;以分为单位存储
/// Default:
/// Nullable:True
/// </summary>
// [SugarColumn(ColumnName="price")]
public double Price
{
get => _price;
set
{
if (value < 0)
{
throw new ArgumentException("电价不能为负数");
}
_price = Math.Round(value, 4);
}
}
/// <summary>
/// Desc:尖峰平谷类型;1-尖2-峰3-平4-谷
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="type")]
public int? Type {get;set;}
/// <summary>
/// 判断一个时间段是否包含另一个时间段(包括开始和结束时间的秒数)
/// </summary>
/// <param name="other"></param>
/// <returns></returns>
public bool Contains(ElecPriceModelVersionDetail other)
{
return (other.StartHour < EndHour ||
(other.StartHour == EndHour && other.StartMinute < EndMinute) ||
(other.StartHour == EndHour && other.StartMinute == EndMinute && other.StartSecond <= EndSecond)) &&
(other.EndHour > StartHour ||
(other.EndHour == StartHour && other.EndMinute > StartMinute) ||
(other.EndHour == StartHour && other.EndMinute == StartMinute && other.EndSecond >= StartSecond));
}
}
}