// Copyright 2017 utimes.cc. All rights reserved. // Use of this source code is governed by utimes.cc. package dbmodel import ( "encoding/json" "github.com/astaxie/beego/orm" ) type Action struct { Id int64 `orm:"auto,column(id)"` Uid int64 `orm:"column(uid)"` Modules string `orm:"column(modules)"` Func string `orm:"column(func)"` Name string `orm:"column(name)"` Before string `orm:"column(before)"` After string `orm:"column(after)"` CreatedAt string `orm:"column(created_at)"` } func (p *Action) TableName() string { return "t_gd_admin_action_log" } func (p Action) String() string { vals, _ := json.Marshal(p) return string(vals) } func (p *Action) Create(db orm.Ormer) (int64, error) { return db.Insert(p) } func (p *Action) FetchAll(db orm.Ormer, mapFilter map[string]interface{}, cols []string) (lists []Action, err error) { qa := db.QueryTable(p.TableName()) for k, v := range mapFilter { qa = qa.Filter(k, v) } _, err = qa.All(&lists, cols...) return }