fix(model):修正对于Xorm来说的数值类型定义。

This commit is contained in:
徐涛 2022-08-10 22:56:40 +08:00
parent 70ac949478
commit a056915e1a
8 changed files with 68 additions and 68 deletions

View File

@ -6,34 +6,34 @@ type EndUserDetail struct {
CreatedAndModified `xorm:"extends"` CreatedAndModified `xorm:"extends"`
ReportId string `xorm:"varchar(120) pk notnull" json:"-"` ReportId string `xorm:"varchar(120) pk notnull" json:"-"`
MeterId string `xorm:"meter_04kv_id varchar(120) pk notnull" json:"meterId"` MeterId string `xorm:"meter_04kv_id varchar(120) pk notnull" json:"meterId"`
LastPeriodCritical decimal.NullDecimal `xorm:"decimal(14,2)" json:"lastPeriodCritical"` LastPeriodCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodCritical"`
LastPeriodPeek decimal.NullDecimal `xorm:"decimal(14,2)" json:"lastPeriodPeek"` LastPeriodPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodPeek"`
LastPeriodFlat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"lastPeriodFlat"` LastPeriodFlat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"lastPeriodFlat"`
LastPeriodValley decimal.NullDecimal `xorm:"decimal(14,2)" json:"lastPeriodValley"` LastPeriodValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"lastPeriodValley"`
CurrentPeriodCritical decimal.NullDecimal `xorm:"decimal(14,2)" json:"currentPeriodCritical"` CurrentPeriodCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodCritical"`
CurrentPeriodPeek decimal.NullDecimal `xorm:"decimal(14,2)" json:"currentPeriodPeek"` CurrentPeriodPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodPeek"`
CurrentPeriodFlat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"currentPeriodFlat"` CurrentPeriodFlat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"currentPeriodFlat"`
CurrentPeriodValley decimal.NullDecimal `xorm:"decimal(14,2)" json:"currentPeriodValley"` CurrentPeriodValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"currentPeriodValley"`
AdjustCritical decimal.NullDecimal `xorm:"decimal(14,2)" json:"adjustCritical"` AdjustCritical decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustCritical"`
AdjustPeek decimal.NullDecimal `xorm:"decimal(14,2)" json:"adjustPeek"` AdjustPeek decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustPeek"`
AdjustFlat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"adjustFlat"` AdjustFlat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"adjustFlat"`
AdjustValley decimal.NullDecimal `xorm:"decimal(14,2)" json:"adjustValley"` AdjustValley decimal.NullDecimal `xorm:"numeric(14,2)" json:"adjustValley"`
Critical decimal.NullDecimal `xorm:"decimal(14,2)" json:"critical"` Critical decimal.NullDecimal `xorm:"numeric(14,2)" json:"critical"`
CriticalFee decimal.NullDecimal `xorm:"decimal(18,8)" json:"criticalFee"` CriticalFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"criticalFee"`
Peek decimal.NullDecimal `xorm:"decimal(14,2)" json:"peek"` Peek decimal.NullDecimal `xorm:"numeric(14,2)" json:"peek"`
PeekFee decimal.NullDecimal `xorm:"decimal(18,8)" json:"peekFee"` PeekFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"peekFee"`
Flat decimal.Decimal `xorm:"decimal(14,2) notnull" json:"flat"` Flat decimal.Decimal `xorm:"numeric(14,2) notnull" json:"flat"`
FlatFee decimal.Decimal `xorm:"decimal(18,8) notnull" json:"flatFee"` FlatFee decimal.Decimal `xorm:"numeric(18,8) notnull" json:"flatFee"`
Valley decimal.NullDecimal `xorm:"decimal(14,2)" json:"valley"` Valley decimal.NullDecimal `xorm:"numeric(14,2)" json:"valley"`
ValleyFee decimal.NullDecimal `xorm:"decimal(18,8)" json:"valleyFee"` ValleyFee decimal.NullDecimal `xorm:"numeric(18,8)" json:"valleyFee"`
BasicFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"basicFeeDiluted"` BasicFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"basicFeeDiluted"`
AdjustFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"adjustFeeDiluted"` AdjustFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"adjustFeeDiluted"`
LossDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"lossDiluted"` LossDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"lossDiluted"`
LossFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"lossFeeDiluted"` LossFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"lossFeeDiluted"`
MaintenanceFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"maintenanceFeeDiluted"` MaintenanceFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"maintenanceFeeDiluted"`
PublicConsumptionDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"publicConsumptionDiluted"` PublicConsumptionDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"publicConsumptionDiluted"`
ServiceFeeDiluted decimal.NullDecimal `xorm:"decimal(18,8)" json:"serviceFeeDiluted"` ServiceFeeDiluted decimal.NullDecimal `xorm:"numeric(18,8)" json:"serviceFeeDiluted"`
FinalCharge decimal.NullDecimal `xorm:"decimal(14,2)" json:"finalCharge"` FinalCharge decimal.NullDecimal `xorm:"numeric(14,2)" json:"finalCharge"`
} }
func (EndUserDetail) TableName() string { func (EndUserDetail) TableName() string {

View File

@ -9,7 +9,7 @@ type MaintenanceFee struct {
Id string `xorm:"varchar(120) pk notnull" json:"id"` Id string `xorm:"varchar(120) pk notnull" json:"id"`
ParkId string `xorm:"varchar(120) notnull" json:"parkId"` ParkId string `xorm:"varchar(120) notnull" json:"parkId"`
Name string `xorm:"varchar(50) notnull" json:"name"` 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"` Memo string `xorm:"text" json:"memo"`
Enabled bool `xorm:"bool notnull" json:"enabled"` Enabled bool `xorm:"bool notnull" json:"enabled"`
} }

View File

@ -12,10 +12,10 @@ type Meter04KV struct {
CustomerName string `xorm:"varchar(100)" json:"customerName"` CustomerName string `xorm:"varchar(100)" json:"customerName"`
ContactName string `xorm:"varchar(70)" json:"contactName"` ContactName string `xorm:"varchar(70)" json:"contactName"`
ContactPhone string `xorm:"varchar(50)" json:"contactPhone"` ContactPhone string `xorm:"varchar(50)" json:"contactPhone"`
Ratio decimal.Decimal `xorm:"decimal(8,4) notnull" json:"ratio"` Ratio decimal.Decimal `xorm:"numeric(8,4) notnull default(1)" json:"ratio"`
IsPublicMeter bool `xorm:"'public_meter' bool notnull" json:"isPublicMeter"` IsPublicMeter bool `xorm:"'public_meter' bool notnull default(false)" json:"isPublicMeter"`
WillDilute bool `xorm:"'dilute' bool notnull" json:"willDilute"` WillDilute bool `xorm:"'dilute' bool notnull default(false)" json:"willDilute"`
Enabled bool `xorm:"bool notnull" json:"enabled"` Enabled bool `xorm:"bool notnull default(true)" json:"enabled"`
} }
func (Meter04KV) TableName() string { func (Meter04KV) TableName() string {

View File

@ -10,9 +10,9 @@ type Park struct {
UserId string `xorm:"varchar(120) notnull" json:"userId"` UserId string `xorm:"varchar(120) notnull" json:"userId"`
Name string `xorm:"vachar(70) notnull" json:"name"` Name string `xorm:"vachar(70) notnull" json:"name"`
Abbr string `xorm:"varchar(50)" json:"abbr"` Abbr string `xorm:"varchar(50)" json:"abbr"`
Area decimal.NullDecimal `xorm:"decimal(14,2)" json:"area"` Area decimal.NullDecimal `xorm:"numeric(14,2)" json:"area"`
TenementQuantity decimal.NullDecimal `xorm:"decimal(8,0)" json:"tenementQuantity"` TenementQuantity decimal.NullDecimal `xorm:"numeric(8,0)" json:"tenementQuantity"`
Capacity decimal.NullDecimal `xorm:"decimal(16,2)" json:"capacity"` Capacity decimal.NullDecimal `xorm:"numeric(16,2)" json:"capacity"`
Category int8 `xorm:"smallint notnull" json:"category"` Category int8 `xorm:"smallint notnull" json:"category"`
Region string `xorm:"varchar(10)" json:"region"` Region string `xorm:"varchar(10)" json:"region"`
Address string `xorm:"varchar(120)" json:"address"` Address string `xorm:"varchar(120)" json:"address"`

View File

@ -4,33 +4,33 @@ import "github.com/shopspring/decimal"
type ReportSummary struct { type ReportSummary struct {
ReportId string `xorm:"varchar(120) pk notnull" json:"-"` ReportId string `xorm:"varchar(120) pk notnull" json:"-"`
Overall decimal.Decimal `xorm:"decimal(14,2) notnull" json:"overall"` Overall decimal.Decimal `xorm:"numeric(14,2) notnull" json:"overall"`
OverallFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"overallFee"` OverallFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"overallFee"`
OverallPrice decimal.Decimal `xorm:"decimal(16,8)" json:"overallPrice"` OverallPrice decimal.Decimal `xorm:"numeric(16,8)" json:"overallPrice"`
Critical decimal.Decimal `xorm:"decimal(14,2) notnull" json:"critial"` Critical decimal.Decimal `xorm:"numeric(14,2) notnull" json:"critial"`
CriticalFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"criticalFee"` CriticalFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"criticalFee"`
CriticalPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"criticalPrice"` CriticalPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"criticalPrice"`
Peek decimal.Decimal `xorm:"decimal(14,2) notnull" json:"peek"` Peek decimal.Decimal `xorm:"numeric(14,2) notnull" json:"peek"`
PeekFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"peekFee"` PeekFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"peekFee"`
PeekPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"peekPrice"` PeekPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"peekPrice"`
Flat decimal.NullDecimal `xorm:"decimal(14,2)" json:"flat"` Flat decimal.NullDecimal `xorm:"numeric(14,2)" json:"flat"`
FlatFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"flatFee"` FlatFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"flatFee"`
FlatPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"flatPrice"` FlatPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"flatPrice"`
Valley decimal.Decimal `xorm:"decimal(14,2) notnull" json:"valley"` Valley decimal.Decimal `xorm:"numeric(14,2) notnull" json:"valley"`
ValleyFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"valleyFee"` ValleyFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"valleyFee"`
ValleyPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"valleyPrice"` ValleyPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"valleyPrice"`
Loss decimal.NullDecimal `xorm:"decimal(14,2)" json:"loss"` Loss decimal.NullDecimal `xorm:"numeric(14,2)" json:"loss"`
LossFee decimal.NullDecimal `xorm:"decimal(16,2)" json:"lossFee"` LossFee decimal.NullDecimal `xorm:"numeric(16,2)" json:"lossFee"`
PublicConsumption decimal.NullDecimal `xorm:"decimal(14,2)" json:"publicConsumption"` PublicConsumption decimal.NullDecimal `xorm:"numeric(14,2)" json:"publicConsumption"`
PublicConsumptionFee decimal.NullDecimal `xorm:"decimal(14,2)" json:"publicConsumptionFee"` PublicConsumptionFee decimal.NullDecimal `xorm:"numeric(14,2)" json:"publicConsumptionFee"`
BasicFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"basicFee"` BasicFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"basicFee"`
BasicDilutedPrice decimal.NullDecimal `xorm:"decimal(18,8)" json:"basicDilutedPrice"` BasicDilutedPrice decimal.NullDecimal `xorm:"numeric(18,8)" json:"basicDilutedPrice"`
AdjustFee decimal.Decimal `xorm:"decimal(14,2) notnull" json:"adjustFee"` AdjustFee decimal.Decimal `xorm:"numeric(14,2) notnull" json:"adjustFee"`
AdjustDilutedPrice decimal.NullDecimal `xorm:"decimal(18,8)" json:"adjustDilutedPrice"` AdjustDilutedPrice decimal.NullDecimal `xorm:"numeric(18,8)" json:"adjustDilutedPrice"`
MaintenanceDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"maintencanceDilutedPrice"` MaintenanceDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"maintencanceDilutedPrice"`
LossDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"lossDilutedPrice"` LossDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"lossDilutedPrice"`
PublicConsumptionDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"publicConsumptionDilutedPrice"` PublicConsumptionDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"publicConsumptionDilutedPrice"`
ServiceDilutedPrice decimal.NullDecimal `xorm:"decimal(16,8)" json:"serviceDilutedPrice"` ServiceDilutedPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"serviceDilutedPrice"`
} }
func (ReportSummary) TableName() string { func (ReportSummary) TableName() string {

View File

@ -11,9 +11,9 @@ type UserCharge struct {
Seq int64 `xorm:"bigint pk notnull " json:"seq"` Seq int64 `xorm:"bigint pk notnull " json:"seq"`
CreatedAt time.Time `xorm:"timestampz notnull" json:"createdAt"` CreatedAt time.Time `xorm:"timestampz notnull" json:"createdAt"`
UserId string `xorm:"varchar(120) notnull" json:"userId"` UserId string `xorm:"varchar(120) notnull" json:"userId"`
Fee decimal.Decimal `xorm:"decimal(12,2) notnull" json:"fee"` Fee decimal.Decimal `xorm:"numeric(12,2) notnull" json:"fee"`
Discount decimal.Decimal `xorm:"decimal(5,4) notnull" json:"discount"` Discount decimal.Decimal `xorm:"numeric(5,4) notnull" json:"discount"`
Amount decimal.Decimal `xorm:"decimal(12,2) notnull" json:"amount"` Amount decimal.Decimal `xorm:"numeric(12,2) notnull" json:"amount"`
Settled bool `xorm:"bool notnull" json:"settled"` Settled bool `xorm:"bool notnull" json:"settled"`
SettledAt *time.Time `xorm:"timestampz" json:"settledAt"` SettledAt *time.Time `xorm:"timestampz" json:"settledAt"`
} }

View File

@ -15,7 +15,7 @@ type UserDetail struct {
Address string `xorm:"varchar(120)" json:"address"` Address string `xorm:"varchar(120)" json:"address"`
Contact string `xorm:"varchar(100)" json:"contact"` Contact string `xorm:"varchar(100)" json:"contact"`
Phone string `xorm:"varchar(50)" json:"phone"` 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"` ServiceExpiration time.Time `xorm:"date notnull" json:"serviceExpiration"`
} }

View File

@ -7,7 +7,7 @@ type WillDilutedFee struct {
Id string `xorm:"varchar(120) pk notnull" json:"id"` Id string `xorm:"varchar(120) pk notnull" json:"id"`
ReportId string `xorm:"varchar(120) notnull" json:"reportId"` ReportId string `xorm:"varchar(120) notnull" json:"reportId"`
Name string `xorm:"varchar(50) notnull" json:"name"` 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"` Memo string `xorm:"text" json:"memo"`
} }