notice_personal.go
2.7 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
85
86
87
88
89
90
91
92
93
94
95
96
package domain
import "time"
const (
NoticePersonalIsNotRead = 1
NoticePersonalIsRead = 2
)
// 个人消息通知内容
type NoticePersonal struct {
// 编号id
NoticePersonalId int64 `json:"noticePersonalId"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
// 发送通知时的扩展参数
Extend string `json:"extend"`
// 公司id
CompanyId int64 `json:"companyId"`
// 内容模板
Content string `json:"content"`
// 是否已读【1:未读】【2:已读】
IsRead int `json:"isRead"`
// 消息对应的业务模块
Module string `json:"module"`
// 业务环节
ModuleAction string `json:"moduleAction"`
//账号id
UserBaseId int64 `json:"userBaseId"`
// 组织id
OrgId int64 `json:"orgId"`
// 接收方用户id
UserId int64 `json:"userId"`
}
type NoticePersonalRepository interface {
Save(noticePersonal *NoticePersonal) (*NoticePersonal, error)
Remove(noticePersonal *NoticePersonal) (*NoticePersonal, error)
FindOne(queryOptions map[string]interface{}) (*NoticePersonal, error)
Find(queryOptions map[string]interface{}) (int64, []*NoticePersonal, error)
}
func (noticePersonal *NoticePersonal) Identify() interface{} {
if noticePersonal.NoticePersonalId == 0 {
return nil
}
return noticePersonal.NoticePersonalId
}
func (noticePersonal *NoticePersonal) Update(data map[string]interface{}) error {
if createdAt, ok := data["createdAt"]; ok {
noticePersonal.CreatedAt = createdAt.(time.Time)
}
if deletedAt, ok := data["deletedAt"]; ok {
noticePersonal.DeletedAt = deletedAt.(time.Time)
}
if updatedAt, ok := data["updatedAt"]; ok {
noticePersonal.UpdatedAt = updatedAt.(time.Time)
}
if extend, ok := data["extend"]; ok {
noticePersonal.Extend = extend.(string)
}
if companyId, ok := data["companyId"]; ok {
noticePersonal.CompanyId = companyId.(int64)
}
if content, ok := data["content"]; ok {
noticePersonal.Content = content.(string)
}
if isRead, ok := data["isRead"]; ok {
noticePersonal.IsRead = isRead.(int)
}
if module, ok := data["module"]; ok {
noticePersonal.Module = module.(string)
}
if moduleAction, ok := data["moduleAction"]; ok {
noticePersonal.ModuleAction = moduleAction.(string)
}
if noticePersonalId, ok := data["noticePersonalId"]; ok {
noticePersonal.NoticePersonalId = noticePersonalId.(int64)
}
if organizationId, ok := data["organizationId"]; ok {
noticePersonal.OrgId = organizationId.(int64)
}
if userId, ok := data["userId"]; ok {
noticePersonal.UserId = userId.(int64)
}
if userId, ok := data["userBaseId"]; ok {
noticePersonal.UserBaseId = userId.(int64)
}
return nil
}