1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package model
- import (
- "github.com/jinzhu/gorm"
- "time"
- )
- type ProjectInfo struct {
- ID int64 `gorm:"column:ID;PRIMARY_KEY" json:"ID" form:"id"`
- Code string `gorm:"column:Code" json:"Code" form:"code"`
- Name string `gorm:"column:Name" json:"Name" form:"name"`
- Safetyno string `gorm:"column:SafetyNo" json:"SafetyNo" form:"safetyno"`
- Prjcode string `gorm:"column:PrjCode" json:"PrjCode" form:"prjcode"`
- Description string `gorm:"column:Description" json:"Description" form:"description"`
- Category uint32 `gorm:"column:Category" json:"Category" form:"category"`
- Constructtype uint32 `gorm:"column:ConstructType" json:"ConstructType" form:"constructtype"`
- InvestType string `gorm:"column:InvestType" json:"InvestType" form:"investtype"`
- Areacode string `gorm:"column:AreaCode" json:"AreaCode" form:"areacode"`
- Address string `gorm:"column:Address" json:"Address" form:"address"`
- Buildingarea float64 `gorm:"column:BuildingArea" json:"BuildingArea" form:"buildingarea"`
- Buildinglength float64 `gorm:"column:BuildingLength" json:"BuildingLength" form:"buildinglength"`
- Invest float64 `gorm:"column:Invest" json:"Invest" form:"invest"`
- Scale string `gorm:"column:Scale" json:"Scale" form:"scale"`
- Startdate time.Time `gorm:"column:StartDate" json:"StartDate" form:"startdate"`
- Enddate time.Time `gorm:"column:EndDate" json:"EndDate" form:"enddate"`
- Lng float64 `gorm:"column:Lng" json:"Lng" form:"lng"`
- Lat float64 `gorm:"column:Lat" json:"Lat" form:"lat"`
- Thirdpartyprojectcode string `gorm:"column:ThirdpartyProjectCode" json:"ThirdpartyProjectCode" form:"thirdpartyprojectcode"`
- Prjstatus uint32 `gorm:"column:PrjStatus" json:"PrjStatus" form:"prjstatus"`
- Effectpic string `gorm:"column:EffectPic" json:"EffectPic" form:"effectpic"`
- Planpic string `gorm:"column:PlanPic" json:"PlanPic" form:"planpic"`
- Createdat time.Time `gorm:"column:CreatedAt" json:"CreatedAt" form:"createdat"`
- Updatedat time.Time `gorm:"column:UpdatedAt" json:"UpdatedAt" form:"updatedat"`
- Cid int64 `gorm:"column:Cid" json:"cid"`
- }
- func (ProjectInfo) TableName() string {
- return "db_smart_v2.ProjectInfo"
- }
- func (p *ProjectInfo) Find(db *gorm.DB, where map[string]interface{}) error {
- cond, val, err := whereBuild(where)
- if err != nil {
- return err
- }
- return db.Table(p.TableName()).Where(cond, val...).First(p).Error
- }
|