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"`
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 {

View File

@ -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"`
}

View File

@ -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 {

View File

@ -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"`

View File

@ -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 {

View File

@ -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"`
}

View File

@ -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"`
}

View File

@ -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"`
}