diff --git a/model/end_user_detail.go b/model/end_user_detail.go index 9f5b3bd..ca2e251 100644 --- a/model/end_user_detail.go +++ b/model/end_user_detail.go @@ -6,34 +6,34 @@ type EndUserDetail struct { CreatedAndModified `xorm:"extends"` ReportId string `xorm:"varchar(120) pk notnull" json:"-"` MeterId string `xorm:"meter_04kv_id varchar(120) pk notnull" json:"meterId"` - LastPeriodCritical decimal.NullDecimal `xorm:"decimal(14,2)" json:"lastPeriodCritical"` - LastPeriodPeek decimal.NullDecimal `xorm:"decimal(14,2)" json:"lastPeriodPeek"` - LastPeriodFlat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"lastPeriodFlat"` - LastPeriodValley decimal.NullDecimal `xorm:"decimal(14,2)" json:"lastPeriodValley"` - CurrentPeriodCritical decimal.NullDecimal `xorm:"decimal(14,2)" json:"currentPeriodCritical"` - CurrentPeriodPeek decimal.NullDecimal `xorm:"decimal(14,2)" json:"currentPeriodPeek"` - CurrentPeriodFlat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"currentPeriodFlat"` - CurrentPeriodValley decimal.NullDecimal `xorm:"decimal(14,2)" json:"currentPeriodValley"` - AdjustCritical decimal.NullDecimal `xorm:"decimal(14,2)" json:"adjustCritical"` - AdjustPeek decimal.NullDecimal `xorm:"decimal(14,2)" json:"adjustPeek"` - AdjustFlat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"adjustFlat"` - AdjustValley decimal.NullDecimal `xorm:"decimal(14,2)" json:"adjustValley"` - Critical decimal.NullDecimal `xorm:"decimal(14,2)" json:"critical"` - CriticalFee decimal.NullDecimal `xorm:"decimal(18,8)" json:"criticalFee"` - Peek decimal.NullDecimal `xorm:"decimal(14,2)" json:"peek"` - PeekFee decimal.NullDecimal `xorm:"decimal(18,8)" json:"peekFee"` - Flat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"flat"` - FlatFee decimal.Decimal `xorm:"decimal(18,8) notnull" json:"flatFee"` - Valley decimal.NullDecimal `xorm:"decimal(14,2)" json:"valley"` - ValleyFee decimal.NullDecimal `xorm:"decimal(18,8)" json:"valleyFee"` - BasicFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"basicFeeDiluted"` - AdjustFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"adjustFeeDiluted"` - LossDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"lossDiluted"` - LossFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"lossFeeDiluted"` - MaintenanceFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"maintenanceFeeDiluted"` - PublicConsumptionDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"publicConsumptionDiluted"` - ServiceFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"serviceFeeDiluted"` - FinalCharge decimal.NullDecimal `xorm:"decimal(14,2)" json:"finalCharge"` + LastPeriodCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodCritical"` + LastPeriodPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodPeek"` + LastPeriodFlat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"lastPeriodFlat"` + LastPeriodValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodValley"` + CurrentPeriodCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodCritical"` + CurrentPeriodPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodPeek"` + CurrentPeriodFlat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"currentPeriodFlat"` + CurrentPeriodValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodValley"` + AdjustCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustCritical"` + AdjustPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustPeek"` + AdjustFlat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"adjustFlat"` + AdjustValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustValley"` + Critical decimal.NullDecimal `xorm:"numeric(14,2)" json:"critical"` + CriticalFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"criticalFee"` + Peek decimal.NullDecimal `xorm:"numeric(14,2)" json:"peek"` + PeekFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"peekFee"` + Flat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"flat"` + FlatFee decimal.Decimal `xorm:"numeric(18,8) notnull" json:"flatFee"` + Valley decimal.NullDecimal `xorm:"numeric(14,2)" json:"valley"` + ValleyFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"valleyFee"` + BasicFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"basicFeeDiluted"` + AdjustFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"adjustFeeDiluted"` + LossDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"lossDiluted"` + LossFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"lossFeeDiluted"` + MaintenanceFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"maintenanceFeeDiluted"` + PublicConsumptionDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"publicConsumptionDiluted"` + ServiceFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"serviceFeeDiluted"` + FinalCharge decimal.NullDecimal `xorm:"numeric(14,2)" json:"finalCharge"` } func (EndUserDetail) TableName() string { diff --git a/model/maintenance_fee.go b/model/maintenance_fee.go index 81e9cd1..dcf774a 100644 --- a/model/maintenance_fee.go +++ b/model/maintenance_fee.go @@ -9,7 +9,7 @@ type MaintenanceFee struct { Id string `xorm:"varchar(120) pk notnull" json:"id"` ParkId string `xorm:"varchar(120) notnull" json:"parkId"` Name string `xorm:"varchar(50) notnull" json:"name"` - Fee decimal.Decimal `xorm:"decimal(8,2) notnull" json:"fee"` + Fee decimal.Decimal `xorm:"numeric(8,2) notnull" json:"fee"` Memo string `xorm:"text" json:"memo"` Enabled bool `xorm:"bool notnull" json:"enabled"` } diff --git a/model/meter_04kv.go b/model/meter_04kv.go index 4d73753..4227a97 100644 --- a/model/meter_04kv.go +++ b/model/meter_04kv.go @@ -12,10 +12,10 @@ type Meter04KV struct { CustomerName string `xorm:"varchar(100)" json:"customerName"` ContactName string `xorm:"varchar(70)" json:"contactName"` ContactPhone string `xorm:"varchar(50)" json:"contactPhone"` - Ratio decimal.Decimal `xorm:"decimal(8,4) notnull" json:"ratio"` - IsPublicMeter bool `xorm:"'public_meter' bool notnull" json:"isPublicMeter"` - WillDilute bool `xorm:"'dilute' bool notnull" json:"willDilute"` - Enabled bool `xorm:"bool notnull" json:"enabled"` + Ratio decimal.Decimal `xorm:"numeric(8,4) notnull default(1)" json:"ratio"` + IsPublicMeter bool `xorm:"'public_meter' bool notnull default(false)" json:"isPublicMeter"` + WillDilute bool `xorm:"'dilute' bool notnull default(false)" json:"willDilute"` + Enabled bool `xorm:"bool notnull default(true)" json:"enabled"` } func (Meter04KV) TableName() string { diff --git a/model/park.go b/model/park.go index c20f46d..90b28dc 100644 --- a/model/park.go +++ b/model/park.go @@ -10,9 +10,9 @@ type Park struct { UserId string `xorm:"varchar(120) notnull" json:"userId"` Name string `xorm:"vachar(70) notnull" json:"name"` Abbr string `xorm:"varchar(50)" json:"abbr"` - Area decimal.NullDecimal `xorm:"decimal(14,2)" json:"area"` - TenementQuantity decimal.NullDecimal `xorm:"decimal(8,0)" json:"tenementQuantity"` - Capacity decimal.NullDecimal `xorm:"decimal(16,2)" json:"capacity"` + Area decimal.NullDecimal `xorm:"numeric(14,2)" json:"area"` + TenementQuantity decimal.NullDecimal `xorm:"numeric(8,0)" json:"tenementQuantity"` + Capacity decimal.NullDecimal `xorm:"numeric(16,2)" json:"capacity"` Category int8 `xorm:"smallint notnull" json:"category"` Region string `xorm:"varchar(10)" json:"region"` Address string `xorm:"varchar(120)" json:"address"` diff --git a/model/report_summary.go b/model/report_summary.go index 582623d..b9e07a4 100644 --- a/model/report_summary.go +++ b/model/report_summary.go @@ -4,33 +4,33 @@ import "github.com/shopspring/decimal" type ReportSummary struct { ReportId string `xorm:"varchar(120) pk notnull" json:"-"` - Overall decimal.Decimal `xorm:"decimal(14,2) notnull" json:"overall"` - OverallFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"overallFee"` - OverallPrice decimal.Decimal `xorm:"decimal(16,8)" json:"overallPrice"` - Critical decimal.Decimal `xorm:"decimal(14,2) notnull" json:"critial"` - CriticalFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"criticalFee"` - CriticalPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"criticalPrice"` - Peek decimal.Decimal `xorm:"decimal(14,2) notnull" json:"peek"` - PeekFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"peekFee"` - PeekPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"peekPrice"` - Flat decimal.NullDecimal `xorm:"decimal(14,2)" json:"flat"` - FlatFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"flatFee"` - FlatPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"flatPrice"` - Valley decimal.Decimal `xorm:"decimal(14,2) notnull" json:"valley"` - ValleyFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"valleyFee"` - ValleyPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"valleyPrice"` - Loss decimal.NullDecimal `xorm:"decimal(14,2)" json:"loss"` - LossFee decimal.NullDecimal `xorm:"decimal(16,2)" json:"lossFee"` - PublicConsumption decimal.NullDecimal `xorm:"decimal(14,2)" json:"publicConsumption"` - PublicConsumptionFee decimal.NullDecimal `xorm:"decimal(14,2)" json:"publicConsumptionFee"` - BasicFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"basicFee"` - BasicDilutedPrice decimal.NullDecimal `xorm:"decimal(18,8)" json:"basicDilutedPrice"` - AdjustFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"adjustFee"` - AdjustDilutedPrice decimal.NullDecimal `xorm:"decimal(18,8)" json:"adjustDilutedPrice"` - MaintenanceDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"maintencanceDilutedPrice"` - LossDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"lossDilutedPrice"` - PublicConsumptionDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"publicConsumptionDilutedPrice"` - ServiceDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"serviceDilutedPrice"` + Overall decimal.Decimal `xorm:"numeric(14,2) notnull" json:"overall"` + OverallFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"overallFee"` + OverallPrice decimal.Decimal `xorm:"numeric(16,8)" json:"overallPrice"` + Critical decimal.Decimal `xorm:"numeric(14,2) notnull" json:"critial"` + CriticalFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"criticalFee"` + CriticalPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"criticalPrice"` + Peek decimal.Decimal `xorm:"numeric(14,2) notnull" json:"peek"` + PeekFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"peekFee"` + PeekPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"peekPrice"` + Flat decimal.NullDecimal `xorm:"numeric(14,2)" json:"flat"` + FlatFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"flatFee"` + FlatPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"flatPrice"` + Valley decimal.Decimal `xorm:"numeric(14,2) notnull" json:"valley"` + ValleyFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"valleyFee"` + ValleyPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"valleyPrice"` + Loss decimal.NullDecimal `xorm:"numeric(14,2)" json:"loss"` + LossFee decimal.NullDecimal `xorm:"numeric(16,2)" json:"lossFee"` + PublicConsumption decimal.NullDecimal `xorm:"numeric(14,2)" json:"publicConsumption"` + PublicConsumptionFee decimal.NullDecimal `xorm:"numeric(14,2)" json:"publicConsumptionFee"` + BasicFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"basicFee"` + BasicDilutedPrice decimal.NullDecimal `xorm:"numeric(18,8)" json:"basicDilutedPrice"` + AdjustFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"adjustFee"` + AdjustDilutedPrice decimal.NullDecimal `xorm:"numeric(18,8)" json:"adjustDilutedPrice"` + MaintenanceDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"maintencanceDilutedPrice"` + LossDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"lossDilutedPrice"` + PublicConsumptionDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"publicConsumptionDilutedPrice"` + ServiceDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"serviceDilutedPrice"` } func (ReportSummary) TableName() string { diff --git a/model/user_charges.go b/model/user_charges.go index e7c7969..2a53f96 100644 --- a/model/user_charges.go +++ b/model/user_charges.go @@ -11,9 +11,9 @@ type UserCharge struct { Seq int64 `xorm:"bigint pk notnull " json:"seq"` CreatedAt time.Time `xorm:"timestampz notnull" json:"createdAt"` UserId string `xorm:"varchar(120) notnull" json:"userId"` - Fee decimal.Decimal `xorm:"decimal(12,2) notnull" json:"fee"` - Discount decimal.Decimal `xorm:"decimal(5,4) notnull" json:"discount"` - Amount decimal.Decimal `xorm:"decimal(12,2) notnull" json:"amount"` + Fee decimal.Decimal `xorm:"numeric(12,2) notnull" json:"fee"` + Discount decimal.Decimal `xorm:"numeric(5,4) notnull" json:"discount"` + Amount decimal.Decimal `xorm:"numeric(12,2) notnull" json:"amount"` Settled bool `xorm:"bool notnull" json:"settled"` SettledAt *time.Time `xorm:"timestampz" json:"settledAt"` } diff --git a/model/user_detail.go b/model/user_detail.go index 151eb51..8396e30 100644 --- a/model/user_detail.go +++ b/model/user_detail.go @@ -15,7 +15,7 @@ type UserDetail struct { Address string `xorm:"varchar(120)" json:"address"` Contact string `xorm:"varchar(100)" json:"contact"` Phone string `xorm:"varchar(50)" json:"phone"` - UnitServiceFee decimal.Decimal `xorm:"decimal(8,2) notnull" json:"unitServiceFee"` + UnitServiceFee decimal.Decimal `xorm:"numeric(8,2) notnull" json:"unitServiceFee"` ServiceExpiration time.Time `xorm:"date notnull" json:"serviceExpiration"` } diff --git a/model/will_diluted_fee.go b/model/will_diluted_fee.go index 6f60287..ae06248 100644 --- a/model/will_diluted_fee.go +++ b/model/will_diluted_fee.go @@ -7,7 +7,7 @@ type WillDilutedFee struct { Id string `xorm:"varchar(120) pk notnull" json:"id"` ReportId string `xorm:"varchar(120) notnull" json:"reportId"` Name string `xorm:"varchar(50) notnull" json:"name"` - Fee decimal.Decimal `xorm:"decimal(8,2) notnull" json:"fee"` + Fee decimal.Decimal `xorm:"numeric(8,2) notnull" json:"fee"` Memo string `xorm:"text" json:"memo"` }