electricity_bill_calc_service/model/park.go

68 lines
2.8 KiB
Go

package model
import (
"time"
"github.com/shopspring/decimal"
)
const (
CATEGORY_TWO_PART int8 = iota
CATEGORY_SINGLE_PV
CATEGORY_SINGLE_NON_PV
)
const (
CUSTOMER_METER_NON_PV int8 = iota
CUSTOMER_METER_PV
)
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:"varchar(70) not null" json:"name"`
Abbr *string `xorm:"varchar(50)" json:"abbr"`
Area decimal.NullDecimal `xorm:"numeric(14,2)" json:"area"`
TenementQuantity decimal.NullDecimal `xorm:"numeric(8,0)" json:"tenement"`
Capacity decimal.NullDecimal `xorm:"numeric(16,2)" json:"capacity"`
Category int8 `xorm:"smallint not null default 0" json:"category"`
SubmeterType int8 `xorm:"'meter_04kv_type' smallint not null default 0" json:"meter04kvType"`
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 not null" json:"enabled"`
}
func (Park) TableName() string {
return "park"
}
type ParkSimplified struct {
Id string `xorm:"varchar(120) pk not null" json:"id"`
UserId string `xorm:"varchar(120) not null" json:"userId"`
Name string `xorm:"varchar(70) not null" json:"name"`
Abbr *string `xorm:"varchar(50)" json:"abbr"`
Area decimal.NullDecimal `xorm:"numeric(14,2)" json:"area"`
TenementQuantity decimal.NullDecimal `xorm:"numeric(8,0)" json:"tenement"`
Capacity decimal.NullDecimal `xorm:"numeric(16,2)" json:"capacity"`
Category int8 `xorm:"smallint not null" json:"category"`
SubmeterType int8 `xorm:"'meter_04kv_type' smallint not null" json:"meter04kvType"`
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"`
}
func (ParkSimplified) TableName() string {
return "park"
}
type ParkPeriodStatistics struct {
Id string `xorm:"varchar(120) not null" json:"id"`
Name string `xorm:"varchar(120) not null" json:"name"`
Period *time.Time `xorm:"date" json:"period" time_format:"simple_date" time_location:"shanghai"`
}