liuxiaolong
2020-09-08 2b77ad0e1f407903d85c3b7bdaae0022c4ec9bc3
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
29
30
31
32
33
34
35
36
37
package models
 
import (
    "github.com/astaxie/beego/orm"
)
 
type Restriction struct {
    Id             int         `orm:"pk;size(8);column(id)" json:"id"`
    Holidays     string         `orm:"size(2000);column(holidays)" json:"holidays"` //法定节假日
    Setting     string      `orm:"size(2000);column(setting)" json:"setting"`
}
 
type SetWeiHao struct {
    StartTime     string      `json:"startTime"`
    EndTime        string         `json:"endTime"`
    XianXing     []DayRes     `json:"xianXing"`
}
 
type DayRes struct {
    Day     int         `json:"day"`  //从周一到周五分别是1,2,3,4,5
    WeiHao     []int         `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) GetOne() error {
    o := orm.NewOrm()
    err := o.QueryTable(r.TableName()).One(r)
    return err
}