1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package dbmodel
- import (
- "encoding/json"
- "fmt"
- "github.com/astaxie/beego/orm"
- )
- type CallbackOut struct {
- Id int `json:"id" orm:"column(id);auto" description:"增长id"`
- ServiceType int `json:"service_type" orm:"column(service_type)" description:"业务类型,101:维保记录"`
- MerchantId int `json:"merchant_id" orm:"column(merchant_id)" description:"下游商户id"`
- ObjectId string `json:"object_id" orm:"column(object_id)" description:"关联的对象id,如:order_no"`
- RequestCode int `json:"request_code" orm:"column(request_code)" description:"请求结果码,同request_params.code,0表示生成报告成功`
- RequestParams string `json:"request_params" orm:"column(request_params)" description:"请求参数`
- ResponseParams string `json:"response_params" orm:"column(response_params)" description:"响应参数`
- Elapsed float64 `json:"elapsed" orm:"column(elapsed)" description:"调用耗时,单位:秒"`
- AddTime int64 `json:"add_time" orm:"column(add_time)" description:"生成时间戳"`
- IsReuse int `json:"is_reuse" orm:"column(is_reuse)" description:"是否复用,1:是,0:否"`
- Search string `json:"search" orm:"column(search)" description:"搜索条件,维保业务时的值代表VIN码"`
- }
- func (p *CallbackOut) DbName() string {
- return "db_gd_service"
- }
- func (p *CallbackOut) TableName() string {
- return "t_gd_callback_out_log"
- }
- func (p CallbackOut) String() string {
- vals, _ := json.Marshal(p)
- return string(vals)
- }
- func (p *CallbackOut) Create(db orm.Ormer) (int64, error) {
- return db.Insert(p)
- }
- func (p *CallbackOut) Update(db orm.Ormer, filters, values map[string]interface{}) (int64, error) {
- if len(values) == 0 {
- return 0, fmt.Errorf("update nil values")
- }
- qs := db.QueryTable(p.TableName())
- for k, v := range filters {
- qs = qs.Filter(k, v)
- }
- return qs.Update(values)
- }
- func (p *CallbackOut) Fetch(db orm.Ormer, filters map[string]interface{}, fields ...string) error {
- qs := db.QueryTable(p.TableName())
- for k, v := range filters {
- qs = qs.Filter(k, v)
- }
- return qs.One(p, fields...)
- }
|