chance_check_result.go
1.4 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
package models
import (
"time"
"github.com/astaxie/beego/orm"
)
type ChanceCheckResult struct {
Id int `orm:"column(id);pk"`
ChanceId int64 `orm:"column(chance_id)"`
GroupId int64 `orm:"column(group_id);null"`
Pid int64 `orm:"column(pid)"`
CheckItem string `orm:"column(check_item);size(20);null" description:"检查项"`
Answer string `orm:"column(answer);size(50);null" description:"回答"`
Reason string `orm:"column(reason);size(200);null" description:"理由"`
UserCompanyId int64 `orm:"column(user_company_id);null"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);null"`
}
func (t *ChanceCheckResult) TableName() string {
return "chance_check_result"
}
func init() {
orm.RegisterModel(new(ChanceCheckResult))
}
// GetChanceCheckResultById retrieves ChanceCheckResult by Id. Returns error if
// Id doesn't exist
func GetChanceCheckResultById(id int) (v *ChanceCheckResult, err error) {
o := orm.NewOrm()
v = &ChanceCheckResult{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
}
func GetChanceCheckResultByChancce(chanceId int64) ([]ChanceCheckResult, error) {
var (
err error
data []ChanceCheckResult
)
o := orm.NewOrm()
_, err = o.QueryTable(&ChanceCheckResult{}).
Filter("chance_id", chanceId).
All(&data)
return data, err
}