forked from free-lancers/electricity_bill_calc_service
		
	fix(model):增加对于可空字符串的数据结构处理。
This commit is contained in:
		| @@ -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"` | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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"` | ||||
|   | ||||
| @@ -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"` | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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"` | ||||
|   | ||||
| @@ -3,12 +3,12 @@ package model | ||||
| import "time" | ||||
|  | ||||
| type Created struct { | ||||
| 	CreatedAt time.Time `xorm:"timestampz  notnull created" json:"createdAt"` | ||||
| 	CreatedAt time.Time `xorm:"timestampz notnull created" json:"createdAt"` | ||||
| } | ||||
|  | ||||
| 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"` | ||||
| } | ||||
|   | ||||
| @@ -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"` | ||||
| } | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user