audit_flow_process.go
3.3 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package models
import (
"fmt"
"time"
"github.com/astaxie/beego/orm"
)
type AuditFlowProcess struct {
Id int64 `orm:"column(id);pk" description:"唯一标识"`
ChanceId int64 `orm:"column(chance_id)" description:"实例id,关联chance表id"`
Uid int64 `orm:"column(uid)" description:"用户id(审批人)"`
Level int `orm:"column(level)" description:"审批步骤"`
IsActive int8 `orm:"column(is_active)" description:"是否激活"`
ApproveTime time.Time `orm:"column(approve_time);type(timestamp)" description:"审批时间"`
BasicSorce float64 `orm:"column(basic_sorce);null;digits(4);decimals(1)" description:"基础评分"`
ExtraSorce float64 `orm:"column(extra_sorce);null;digits(4);decimals(1)" description:"附加评分"`
ValueSorce float64 `orm:"column(value_sorce);null;digits(4);decimals(1)" description:"价值评分"`
ReviewStatus int8 `orm:"column(review_status)" description:"审核状态 0:审核中 1:被退回 2:已通过 3.自动通过 "`
AuditFlowType int `orm:"column(audit_flow_type)" description:"审核流类型 1.部门长 2.指定成员 3.指定角色 4.特殊审核人"`
FlowType int `orm:"column(flow_type)" description:"审批类型 1:正常审核 2:特殊审核"`
ActionType int `orm:"column(action_type)" description:"审批执行方式【1:or】【2:and】"`
CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"`
EnableStatus int8 `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 (被驳回以后,未完成的审核置为无效)"`
}
func (t *AuditFlowProcess) TableName() string {
return "audit_flow_process"
}
func init() {
orm.RegisterModel(new(AuditFlowProcess))
}
// AddAuditFlowProcess insert a new AuditFlowProcess into database and returns
// last inserted Id on success.
func AddAuditFlowProcess(m *AuditFlowProcess) (id int64, err error) {
o := orm.NewOrm()
id, err = o.Insert(m)
return
}
// GetAuditFlowProcessById retrieves AuditFlowProcess by Id. Returns error if
// Id doesn't exist
func GetAuditFlowProcessById(id int64) (v *AuditFlowProcess, err error) {
o := orm.NewOrm()
v = &AuditFlowProcess{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
}
// UpdateAuditFlowProcess updates AuditFlowProcess by Id and returns error if
// the record to be updated doesn't exist
func UpdateAuditFlowProcessById(m *AuditFlowProcess) (err error) {
o := orm.NewOrm()
v := AuditFlowProcess{Id: m.Id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
if num, err = o.Update(m); err == nil {
fmt.Println("Number of records updated in database:", num)
}
}
return
}
// DeleteAuditFlowProcess deletes AuditFlowProcess by Id and returns error if
// the record to be deleted doesn't exist
func DeleteAuditFlowProcess(id int64) (err error) {
o := orm.NewOrm()
v := AuditFlowProcess{Id: id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
if num, err = o.Delete(&AuditFlowProcess{Id: id}); err == nil {
fmt.Println("Number of records deleted in database:", num)
}
}
return
}