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"` 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:"numeric(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

@ -8,10 +8,10 @@ type Meter04KV struct {
CreatedAndModified `xorm:"extends"` CreatedAndModified `xorm:"extends"`
Code string `xorm:"varchar(120) pk notnull" json:"code"` Code string `xorm:"varchar(120) pk notnull" json:"code"`
ParkId string `xorm:"varchar(120) notnull" json:"parkId"` ParkId string `xorm:"varchar(120) notnull" json:"parkId"`
Address string `xorm:"varchar(100)" json:"address"` Address *string `xorm:"varchar(100)" json:"address"`
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:"numeric(8,4) notnull default(1)" json:"ratio"` Ratio decimal.Decimal `xorm:"numeric(8,4) notnull default(1)" json:"ratio"`
IsPublicMeter bool `xorm:"'public_meter' bool notnull default(false)" json:"isPublicMeter"` IsPublicMeter bool `xorm:"'public_meter' bool notnull default(false)" json:"isPublicMeter"`
WillDilute bool `xorm:"'dilute' bool notnull default(false)" json:"willDilute"` 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"` Id string `xorm:"varchar(120) pk notnull" json:"id"`
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:"numeric(14,2)" json:"area"` Area decimal.NullDecimal `xorm:"numeric(14,2)" json:"area"`
TenementQuantity decimal.NullDecimal `xorm:"numeric(8,0)" json:"tenementQuantity"` TenementQuantity decimal.NullDecimal `xorm:"numeric(8,0)" json:"tenementQuantity"`
Capacity decimal.NullDecimal `xorm:"numeric(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"`
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"`
Enabled bool `xorm:"bool notnull" json:"enabled"` Enabled bool `xorm:"bool notnull" json:"enabled"`
} }

View File

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

View File

@ -3,12 +3,12 @@ package model
import "time" import "time"
type Created struct { type Created struct {
CreatedAt time.Time `xorm:"timestampz notnull created" json:"createdAt"` CreatedAt time.Time `xorm:"timestampz notnull created" json:"createdAt"`
} }
type CreatedWithUser struct { type CreatedWithUser struct {
Created `xorm:"extends"` Created `xorm:"extends"`
CreatedBy string `xorm:"varchar(100)" json:"createdBy"` CreatedBy *string `xorm:"varchar(100)" json:"createdBy"`
} }
type CreatedAndModified struct { type CreatedAndModified struct {
@ -18,6 +18,6 @@ type CreatedAndModified struct {
type CreatedAndModifiedWithUser struct { type CreatedAndModifiedWithUser struct {
CreatedAndModified `xorm:"extends"` CreatedAndModified `xorm:"extends"`
CreatedBy string `xorm:"varchar(100)" json:"createdBy"` CreatedBy *string `xorm:"varchar(100)" json:"createdBy"`
LastModifiedBy string `xorm:"varchar(100)" json:"lastModifiedBy"` LastModifiedBy *string `xorm:"varchar(100)" json:"lastModifiedBy"`
} }

View File

@ -9,12 +9,12 @@ import (
type UserDetail struct { type UserDetail struct {
CreatedAndModifiedWithUser `xorm:"extends"` CreatedAndModifiedWithUser `xorm:"extends"`
Id string `xorm:"varchar(120) pk notnull" json:"id"` Id string `xorm:"varchar(120) pk notnull" json:"id"`
Name string `xorm:"varchar(100)" json:"name"` Name *string `xorm:"varchar(100)" json:"name"`
Abbr string `xorm:"varchar(50)" json:"abbr"` Abbr *string `xorm:"varchar(50)" json:"abbr"`
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"`
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:"numeric(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

@ -8,7 +8,7 @@ type WillDilutedFee struct {
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:"numeric(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"`
} }
func (WillDilutedFee) TableName() string { func (WillDilutedFee) TableName() string {