liuxiaolong
2020-08-13 83414efff580cd4168e7cbc2e1e3288895444fff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package models
 
import (
    "github.com/astaxie/beego/orm"
)
 
type Restriction struct {
    Date         string         `orm:"pk;size(50);column(date)" json:"date"`
    Week         string         `orm:"size(50);column(week)" json:"week"`
    CityName     string      `orm:"size(50);column(cityName)" json:"cityName"`
    IsXianXing    int         `orm:"size(8);column(isXianXing)" json:"isXianXing"`
    WeiHao         string         `orm:"size(50);column(weiHao)" json:"weiHao"`
}
 
func (r *Restriction) TableName() string {
    return "sys_restriction"
}
 
func (r *Restriction) Insert() (int64,error) {
    o := orm.NewOrm()
    return o.Insert(r)
}
 
func (r *Restriction) SelectByDate(date string) error {
    o := orm.NewOrm()
    err := o.QueryTable(r.TableName()).Filter("date", date).One(r)
    return err
}