- all db orm use beego orm, don't use gorm anymore.

This commit is contained in:
gazebo
2018-09-08 12:55:39 +08:00
parent 711013fab4
commit 8c130a15a4
28 changed files with 780 additions and 448 deletions

View File

@@ -18,41 +18,50 @@ const (
)
type Store struct {
ModelIDCUO
Name string `gorm:"type:varchar(255);unique_index" json:"name"`
CityCode int `json:"cityCode"` // todo ?
DistrictCode int `json:"districtCode"` // todo ?
Address string `gorm:"type:varchar(255)" json:"address"`
Tel1 string `gorm:"type:varchar(32)" json:"tel1"`
Tel2 string `gorm:"type:varchar(32)" json:"tel2"`
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半用两个的原因是为了支持中午休息1与2的时间段不能交叉为0表示没有
CloseTime1 int16 `json:"closeTime1"` // 格式同上
OpenTime2 int16 `json:"openTime2"` // 格式同上
CloseTime2 int16 `json:"closeTime2"` // 格式同上
Lng int `json:"lng"` // 乘了10的6次方
Lat int `json:"lat"` // 乘了10的6次方
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
DeliveryRange string `gorm:"type:varchar(2048)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon则为逗号分隔坐标分号分隔的坐标点坐标与Lng和Lat一样都是整数比如 121361504,31189308;121420555,31150238。否则为半径单位为米
ModelIDCUL
Name string `orm:"size(255);unique" json:"name"`
CityCode int `orm:"default(0);null" json:"cityCode"` // todo ?
DistrictCode int `orm:"default(0);null" json:"districtCode"` // todo ?
Address string `orm:"size(255)" json:"address"`
Tel1 string `orm:"size(32);index" json:"tel1"`
Tel2 string `orm:"size(32);index" json:"tel2"`
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半用两个的原因是为了支持中午休息1与2的时间段不能交叉为0表示没有
CloseTime1 int16 `json:"closeTime1"` // 格式同上
OpenTime2 int16 `json:"openTime2"` // 格式同上
CloseTime2 int16 `json:"closeTime2"` // 格式同上
Lng int `json:"lng"` // 乘了10的6次方
Lat int `json:"lat"` // 乘了10的6次方
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
DeliveryRange string `orm:"size(2048)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon则为逗号分隔坐标分号分隔的坐标点坐标与Lng和Lat一样都是整数比如 121361504,31189308;121420555,31150238。否则为半径单位为米
Status int `json:"status"`
}
type StoreSub struct {
ModelIDCUO
StoreID int `gorm:"unique_index:unique_index1"`
Index int `gorm:"unique_index:unique_index1"` // 子店序号为0表示主店
Name string `gorm:"type:varchar(255)"`
Address string `gorm:"type:varchar(255)"`
ModelIDCUL
StoreID int `orm:"column(store_id)"`
Index int // 子店序号为0表示主店
Name string `orm:"size(255);index"`
Address string `orm:"size(255)"`
Status int // 取值同Store.Status
Mobile1 string `gorm:"type:varchar(32)"`
Mobile2 string `gorm:"type:varchar(32)"`
Mobile3 string `gorm:"type:varchar(32)"`
Mobile1 string `orm:"size(32)"`
Mobile2 string `orm:"size(32)"`
Mobile3 string `orm:"size(32)"`
}
func (*StoreSub) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "Index"},
}
}
type StoreMap struct {
ModelIDCUO
StoreID int `gorm:"unique_index:storemap1"`
VendorID int `gorm:"unique_index:storemap1"`
VendorStoreID string `gorm:"type:varchar(48);unique_index"`
ModelIDCUL
StoreID int `orm:"column(store_id)"`
VendorID int `orm:"column(vendor_id)"`
VendorStoreID string `orm:"column(vendor_store_id);size(48)"`
Status int // 取值同Store.Status
AutoPickup int8 // 是否自动拣货
@@ -60,10 +69,25 @@ type StoreMap struct {
DeliveryCompetition int8 // 是否支持配送竞争
}
func (*StoreMap) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "VendorID"},
[]string{"VendorStoreID", "VendorID"},
}
}
type StoreCourierMap struct {
ModelIDCUO
StoreID int `gorm:"unique_index:storemap1"`
VendorID int `gorm:"unique_index:storemap1"`
VendorStoreID string `gorm:"type:varchar(48);unique_index"`
ModelIDCUL
StoreID int `orm:"column(store_id)"`
VendorID int `orm:"column(vendor_id)"`
VendorStoreID string `orm:"column(vendor_store_id);size(48)"`
Status int
}
func (*StoreCourierMap) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "VendorID"},
[]string{"VendorStoreID", "VendorID"},
}
}