fix(model):增加对于可空字符串的数据结构处理。

This commit is contained in:
徐涛 2022-08-11 08:24:22 +08:00
parent a056915e1a
commit 668ae9fbd2
7 changed files with 22 additions and 22 deletions

View File

@ -10,7 +10,7 @@ type MaintenanceFee struct {
ParkId string `xorm:"varchar(120) notnull" json:"parkId"`
Name string `xorm:"varchar(50) notnull" json:"name"`
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"`
}

View File

@ -8,10 +8,10 @@ type Meter04KV struct {
CreatedAndModified `xorm:"extends"`
Code string `xorm:"varchar(120) pk notnull" json:"code"`
ParkId string `xorm:"varchar(120) notnull" json:"parkId"`
Address string `xorm:"varchar(100)" json:"address"`
CustomerName string `xorm:"varchar(100)" json:"customerName"`
ContactName string `xorm:"varchar(70)" json:"contactName"`
ContactPhone string `xorm:"varchar(50)" json:"contactPhone"`
Address *string `xorm:"varchar(100)" json:"address"`
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:"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"`

View File

@ -9,15 +9,15 @@ type Park struct {
Id string `xorm:"varchar(120) pk notnull" json:"id"`
UserId string `xorm:"varchar(120) notnull" json:"userId"`
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:"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"`
Contact string `xorm:"varchar(100)" json:"contact"`
Phone string `xorm:"varchar(50)" json:"phone"`
Region *string `xorm:"varchar(10)" json:"region"`
Address *string `xorm:"varchar(120)" json:"address"`
Contact *string `xorm:"varchar(100)" json:"contact"`
Phone *string `xorm:"varchar(50)" json:"phone"`
Enabled bool `xorm:"bool notnull" json:"enabled"`
}

View File

@ -8,7 +8,7 @@ type Report struct {
ParkId string `xorm:"varchar(120) notnull" json:"parkId"`
Period time.Time `xorm:"date notnull" json:"period"`
Published bool `xorm:"bool notnull default(false)" json:"published"`
PublishedAt time.Time `xorm:"timestampz" json:"publishedAt"`
PublishedAt *time.Time `xorm:"timestampz" json:"publishedAt"`
Withdraw byte `xorm:"smallint notnull default(0)" json:"withdraw"`
LastWithdrawAppliedAt *time.Time `xorm:"timestampz" json:"lastWithdrawAppliedAt"`
LastWithdrawAuditAt *time.Time `xorm:"timestampz" json:"lastWithdrawAuditAt"`

View File

@ -8,7 +8,7 @@ type Created struct {
type CreatedWithUser struct {
Created `xorm:"extends"`
CreatedBy string `xorm:"varchar(100)" json:"createdBy"`
CreatedBy *string `xorm:"varchar(100)" json:"createdBy"`
}
type CreatedAndModified struct {
@ -18,6 +18,6 @@ type CreatedAndModified struct {
type CreatedAndModifiedWithUser struct {
CreatedAndModified `xorm:"extends"`
CreatedBy string `xorm:"varchar(100)" json:"createdBy"`
LastModifiedBy string `xorm:"varchar(100)" json:"lastModifiedBy"`
CreatedBy *string `xorm:"varchar(100)" json:"createdBy"`
LastModifiedBy *string `xorm:"varchar(100)" json:"lastModifiedBy"`
}

View File

@ -9,12 +9,12 @@ import (
type UserDetail struct {
CreatedAndModifiedWithUser `xorm:"extends"`
Id string `xorm:"varchar(120) pk notnull" json:"id"`
Name string `xorm:"varchar(100)" json:"name"`
Abbr string `xorm:"varchar(50)" json:"abbr"`
Region string `xorm:"varchar(10)" json:"region"`
Address string `xorm:"varchar(120)" json:"address"`
Contact string `xorm:"varchar(100)" json:"contact"`
Phone string `xorm:"varchar(50)" json:"phone"`
Name *string `xorm:"varchar(100)" json:"name"`
Abbr *string `xorm:"varchar(50)" json:"abbr"`
Region *string `xorm:"varchar(10)" json:"region"`
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:"numeric(8,2) notnull" json:"unitServiceFee"`
ServiceExpiration time.Time `xorm:"date notnull" json:"serviceExpiration"`
}

View File

@ -8,7 +8,7 @@ type WillDilutedFee struct {
ReportId string `xorm:"varchar(120) notnull" json:"reportId"`
Name string `xorm:"varchar(50) notnull" json:"name"`
Fee decimal.Decimal `xorm:"numeric(8,2) notnull" json:"fee"`
Memo string `xorm:"text" json:"memo"`
Memo *string `xorm:"text" json:"memo"`
}
func (WillDilutedFee) TableName() string {