| | |
| | | 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 |
| | | } |