forked from free-lancers/electricity_bill_calc_service
		
	enhance(model):调整数据模型设计。
This commit is contained in:
		| @@ -6,6 +6,8 @@ type EndUserDetail struct { | ||||
| 	CreatedAndModified       `xorm:"extends"` | ||||
| 	ReportId                 string              `xorm:"varchar(120) pk not null" json:"-"` | ||||
| 	MeterId                  string              `xorm:"meter_04kv_id varchar(120) pk not null" json:"meterId"` | ||||
| 	Seq                      int64               `xorm:"bigint not null" json:"seq"` | ||||
| 	Ratio                    decimal.Decimal     `xorm:"numeric(8,4) not null" json:"ratio"` | ||||
| 	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) not null" json:"lastPeriodFlat"` | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import ( | ||||
|  | ||||
| type MaintenanceFee struct { | ||||
| 	CreatedAndModified `xorm:"extends"` | ||||
| 	Deleted            `xorm:"extends"` | ||||
| 	Id                 string          `xorm:"varchar(120) pk not null" json:"id"` | ||||
| 	ParkId             string          `xorm:"varchar(120) not null" json:"parkId"` | ||||
| 	Name               string          `xorm:"varchar(50) not null" json:"name"` | ||||
|   | ||||
| @@ -12,10 +12,11 @@ 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:"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"` | ||||
| 	Ratio              decimal.Decimal `xorm:"numeric(8,4) not null default 1" json:"ratio"` | ||||
| 	Seq                int64           `xorm:"bigint not null" json:"seq"` | ||||
| 	IsPublicMeter      bool            `xorm:"'public_meter' bool not null default false" json:"isPublicMeter"` | ||||
| 	WillDilute         bool            `xorm:"'dilute' bool not null default false" json:"willDilute"` | ||||
| 	Enabled            bool            `xorm:"bool not null default true" json:"enabled"` | ||||
| } | ||||
|  | ||||
| func (Meter04KV) TableName() string { | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import ( | ||||
|  | ||||
| type Park struct { | ||||
| 	CreatedAndModified `xorm:"extends"` | ||||
| 	Deleted            `xorm:"extends"` | ||||
| 	Id                 string              `xorm:"varchar(120) pk not null" json:"id"` | ||||
| 	UserId             string              `xorm:"varchar(120) not null" json:"userId"` | ||||
| 	Name               string              `xorm:"vachar(70) not null" json:"name"` | ||||
|   | ||||
| @@ -4,12 +4,13 @@ import "time" | ||||
|  | ||||
| type Report struct { | ||||
| 	CreatedAndModified    `xorm:"extends"` | ||||
| 	Deleted               `xorm:"extends"` | ||||
| 	Id                    string     `xorm:"varchar(120) pk not null" json:"id"` | ||||
| 	ParkId                string     `xorm:"varchar(120) not null" json:"parkId"` | ||||
| 	Period                time.Time  `xorm:"date not null" json:"period"` | ||||
| 	Published             bool       `xorm:"bool notnull default(false)" json:"published"` | ||||
| 	Published             bool       `xorm:"bool not null default false" json:"published"` | ||||
| 	PublishedAt           *time.Time `xorm:"timestampz" json:"publishedAt"` | ||||
| 	Withdraw              byte       `xorm:"smallint notnull default(0)" json:"withdraw"` | ||||
| 	Withdraw              byte       `xorm:"smallint not null default 0" json:"withdraw"` | ||||
| 	LastWithdrawAppliedAt *time.Time `xorm:"timestampz" json:"lastWithdrawAppliedAt"` | ||||
| 	LastWithdrawAuditAt   *time.Time `xorm:"timestampz" json:"lastWithdrawAuditAt"` | ||||
| } | ||||
|   | ||||
| @@ -11,6 +11,15 @@ type CreatedWithUser struct { | ||||
| 	CreatedBy *string `xorm:"varchar(100)" json:"createdBy"` | ||||
| } | ||||
|  | ||||
| type Deleted struct { | ||||
| 	DeletedAt *time.Time `xorm:"timestampz deleted" json:"deletedAt"` | ||||
| } | ||||
|  | ||||
| type DeletedWithUser struct { | ||||
| 	Deleted   `xorm:"extends"` | ||||
| 	DeletedBy *string `xorm:"varchar(120)" json:"deletedBy"` | ||||
| } | ||||
|  | ||||
| type CreatedAndModified struct { | ||||
| 	Created        `xorm:"extends"` | ||||
| 	LastModifiedAt *time.Time `xorm:"timestampz updated" json:"lastModifiedAt"` | ||||
|   | ||||
| @@ -14,8 +14,10 @@ type UserCharge struct { | ||||
| 	Fee        decimal.Decimal `xorm:"numeric(12,2) not null" json:"fee"` | ||||
| 	Discount   decimal.Decimal `xorm:"numeric(5,4) not null" json:"discount"` | ||||
| 	Amount     decimal.Decimal `xorm:"numeric(12,2) not null" json:"amount"` | ||||
| 	Settled   bool            `xorm:"bool notnull" json:"settled"` | ||||
| 	Settled    bool            `xorm:"bool not null default false" json:"settled"` | ||||
| 	SettledAt  *time.Time      `xorm:"timestampz" json:"settledAt"` | ||||
| 	Refunded   bool            `xorm:"bool not null default false" json:"refunded"` | ||||
| 	RefundedAt *time.Time      `xorm:"timestampz" json:"refundedAt"` | ||||
| } | ||||
|  | ||||
| func (UserCharge) TableName() string { | ||||
|   | ||||
| @@ -8,6 +8,7 @@ import ( | ||||
|  | ||||
| type UserDetail struct { | ||||
| 	CreatedAndModifiedWithUser `xorm:"extends"` | ||||
| 	DeletedWithUser            `xorm:"extends"` | ||||
| 	Id                         string          `xorm:"varchar(120) pk not null" json:"id"` | ||||
| 	Name                       *string         `xorm:"varchar(100)" json:"name"` | ||||
| 	Abbr                       *string         `xorm:"varchar(50)" json:"abbr"` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user