package dao

type TenantCode struct {
	ID       int     `gorm:"primary_key" json:"id" COMMENT "编号"`
	TenantId string  `gorm:"varchar(12)"  json:"tenantId" COMMENT "租户ID"`
	CityCode string  `gorm:"varchar(6)" json:"cityCode"  COMMENT "城市行政编码"`
	CityName string  `gorm:"varchar(255)" json:"cityName"  COMMENT "城市名称"`
	CityLng  float64 `gorm:"double(18,14)" json:"cityLng"  COMMENT "经度"`
	CityLat  float64 `gorm:"double(18,14)" json:"cityLat" COMMENT "纬度"`
}

func (TenantCode) TableName() string {
	return "tenant_code"
}

//根据租户得到位置记录
func (c *TenantCode) GetTenantCode() (TenantCode, error) {
	var tenantCode TenantCode
	err := Db.Debug().Model(&c).Where(" tenant_id = ?", c.TenantId).Find(&tenantCode).Error
	return tenantCode, err
}
