tenantCodeDao.go 783 B

123456789101112131415161718192021
  1. package dao
  2. type TenantCode struct {
  3. ID int `gorm:"primary_key" json:"id" COMMENT "编号"`
  4. TenantId string `gorm:"varchar(12)" json:"tenantId" COMMENT "租户ID"`
  5. CityCode string `gorm:"varchar(6)" json:"cityCode" COMMENT "城市行政编码"`
  6. CityName string `gorm:"varchar(255)" json:"cityName" COMMENT "城市名称"`
  7. CityLng float64 `gorm:"double(18,14)" json:"cityLng" COMMENT "经度"`
  8. CityLat float64 `gorm:"double(18,14)" json:"cityLat" COMMENT "纬度"`
  9. }
  10. func (TenantCode) TableName() string {
  11. return "tenant_code"
  12. }
  13. //根据租户得到位置记录
  14. func (c *TenantCode) GetTenantCode() (TenantCode, error) {
  15. var tenantCode TenantCode
  16. err := Db.Model(&c).Where(" tenant_id = ?", c.TenantId).Find(&tenantCode).Error
  17. return tenantCode, err
  18. }