-
Notifications
You must be signed in to change notification settings - Fork 0
/
fields_weekly_recipe_marge.go
130 lines (116 loc) · 4.06 KB
/
fields_weekly_recipe_marge.go
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package RestaurantWeeklyRecipeMarge
import (
"database/sql/driver"
"encoding/json"
"errors"
"time"
)
// FieldsWeeklyRecipe 每周提交菜谱表头
type FieldsWeeklyRecipe struct {
// ID
ID int64 `db:"id" json:"id" check:"id"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt"`
//更新时间
UpdateAt time.Time `db:"update_at" json:"updateAt"`
//删除时间
DeleteAt time.Time `db:"delete_at" json:"deleteAt"`
//分公司ID
OrgID int64 `db:"org_id" json:"orgID" check:"id"`
//门店ID
StoreID int64 `db:"store_id" json:"storeID" check:"id"`
//提交组织成员ID
SubmitOrgBindID int64 `db:"submit_org_bind_id" json:"submitOrgBindID" check:"id" empty:"true"`
//提交用户ID
// 与组织ID二选一,如果组织成员ID为空,则使用用户ID;如果组织ID不为空,则使用组织成员ID+用户ID
SubmitUserID int64 `db:"submit_user_id" json:"submitUserID" check:"id" empty:"true"`
//提交人姓名
SubmitUserName string `db:"submit_user_name" json:"submitUserName" check:"des" min:"1" max:"300" empty:"true"`
//审核时间
AuditAt time.Time `db:"audit_at" json:"auditAt"`
//审核状态
// 0 未审核; 1 审核通过; 2 审核不通过
AuditStatus int `db:"audit_status" json:"auditStatus" check:"intThan0" empty:"true"`
//审核人ID
AuditOrgBindID int64 `db:"audit_org_bind_id" json:"auditOrgBindID" check:"id" empty:"true"`
//审核用户ID
// 与组织ID二选一,如果组织成员ID为空,则使用用户ID;如果组织ID不为空,则使用组织成员ID+用户ID
AuditUserID int64 `db:"audit_user_id" json:"auditUserID" check:"id" empty:"true"`
//审核人姓名
AuditUserName string `db:"audit_user_name" json:"auditUserName" check:"des" min:"1" max:"300" empty:"true"`
//名称
Name string `db:"name" json:"name" check:"des" min:"1" max:"300" empty:"true"`
//备注
Remark string `db:"remark" json:"remark" check:"des" min:"1" max:"1000" empty:"true"`
//数据包
RawData FieldsWeeklyRecipeHeaders `db:"raw_data" json:"rawData"`
}
type FieldsWeeklyRecipeHeaders []FieldsWeeklyRecipeHeader
// Value sql底层处理器
func (t FieldsWeeklyRecipeHeaders) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsWeeklyRecipeHeaders) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsWeeklyRecipeHeader struct {
// 用餐日期
// 例如:2021-01-01
DiningDate string `db:"dining_date" json:"diningDate"`
//早餐
Breakfast FieldsWeeklyRecipeItemList `json:"breakfast"`
//中餐
Lunch FieldsWeeklyRecipeItemList `json:"lunch"`
//晚餐
Dinner FieldsWeeklyRecipeItemList `json:"dinner"`
}
// Value sql底层处理器
func (t FieldsWeeklyRecipeHeader) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsWeeklyRecipeHeader) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsWeeklyRecipeItemList []FieldsWeeklyRecipeItem
// Value sql底层处理器
func (t FieldsWeeklyRecipeItemList) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsWeeklyRecipeItemList) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsWeeklyRecipeItem struct {
//菜品ID
RecipeID int64 `db:"recipe_id" json:"recipeID" check:"id"`
//菜品名称
Name string `db:"name" json:"name" check:"des" min:"1" max:"300" empty:"true"`
//售价
Price int64 `db:"price" json:"price" check:"int64Than0"`
//数量
Count int `db:"count" json:"count" check:"intThan0"`
//单位
Unit string `db:"unit" json:"unit" check:"des" min:"1" max:"300" empty:"true"`
}
// Value sql底层处理器
func (t FieldsWeeklyRecipeItem) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsWeeklyRecipeItem) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}