project.go 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package model
  2. import (
  3. "github.com/jinzhu/gorm"
  4. "time"
  5. )
  6. type ProjectInfo struct {
  7. ID int64 `gorm:"column:ID;PRIMARY_KEY" json:"ID" form:"id"`
  8. Code string `gorm:"column:Code" json:"Code" form:"code"`
  9. Name string `gorm:"column:Name" json:"Name" form:"name"`
  10. Safetyno string `gorm:"column:SafetyNo" json:"SafetyNo" form:"safetyno"`
  11. Prjcode string `gorm:"column:PrjCode" json:"PrjCode" form:"prjcode"`
  12. Description string `gorm:"column:Description" json:"Description" form:"description"`
  13. Category uint32 `gorm:"column:Category" json:"Category" form:"category"`
  14. Constructtype uint32 `gorm:"column:ConstructType" json:"ConstructType" form:"constructtype"`
  15. InvestType string `gorm:"column:InvestType" json:"InvestType" form:"investtype"`
  16. Areacode string `gorm:"column:AreaCode" json:"AreaCode" form:"areacode"`
  17. Address string `gorm:"column:Address" json:"Address" form:"address"`
  18. Buildingarea float64 `gorm:"column:BuildingArea" json:"BuildingArea" form:"buildingarea"`
  19. Buildinglength float64 `gorm:"column:BuildingLength" json:"BuildingLength" form:"buildinglength"`
  20. Invest float64 `gorm:"column:Invest" json:"Invest" form:"invest"`
  21. Scale string `gorm:"column:Scale" json:"Scale" form:"scale"`
  22. Startdate time.Time `gorm:"column:StartDate" json:"StartDate" form:"startdate"`
  23. Enddate time.Time `gorm:"column:EndDate" json:"EndDate" form:"enddate"`
  24. Lng float64 `gorm:"column:Lng" json:"Lng" form:"lng"`
  25. Lat float64 `gorm:"column:Lat" json:"Lat" form:"lat"`
  26. Thirdpartyprojectcode string `gorm:"column:ThirdpartyProjectCode" json:"ThirdpartyProjectCode" form:"thirdpartyprojectcode"`
  27. Prjstatus uint32 `gorm:"column:PrjStatus" json:"PrjStatus" form:"prjstatus"`
  28. Effectpic string `gorm:"column:EffectPic" json:"EffectPic" form:"effectpic"`
  29. Planpic string `gorm:"column:PlanPic" json:"PlanPic" form:"planpic"`
  30. Createdat time.Time `gorm:"column:CreatedAt" json:"CreatedAt" form:"createdat"`
  31. Updatedat time.Time `gorm:"column:UpdatedAt" json:"UpdatedAt" form:"updatedat"`
  32. Cid int64 `gorm:"column:Cid" json:"cid"`
  33. }
  34. func (ProjectInfo) TableName() string {
  35. return "db_smart_v2.ProjectInfo"
  36. }
  37. func (p *ProjectInfo) Find(db *gorm.DB, where map[string]interface{}) error {
  38. cond, val, err := whereBuild(where)
  39. if err != nil {
  40. return err
  41. }
  42. return db.Table(p.TableName()).Where(cond, val...).First(p).Error
  43. }