message_system.go
1.8 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
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
type MessageSystem struct {
Id int64 // 唯一标识
CompanyId int64 `json:"companyId"` // 公司ID
RecipientId int64 `json:"recipientId"` // 接收者ID
Type MsgSystemType `json:"type"` // 系统分类(0待定、1业务正常通知、2业务异常通知)
Title string `json:"title"` // 标题
Content string `json:"content"` // 内容
CreatedAt int64 `json:",omitempty"`
UpdatedAt int64 `json:",omitempty"`
DeletedAt int64 `json:",omitempty"`
Version int `json:",omitempty"`
}
type MsgSystemType int
const (
MsgTypeNormal MsgSystemType = 1 //1 业务正常通知(帖子定性)
MsgTypeAbnormal MsgSystemType = 2 //2 业务异常通知(评论删除)
MsgTypeDeleted MsgSystemType = 3 //3 帖子删除通知(帖子删除)
MsgTypeIllegal MsgSystemType = 4 //4 内容违规
)
type MessageSystemRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *MessageSystem) (*MessageSystem, error)
Update(ctx context.Context, conn transaction.Conn, dm *MessageSystem) (*MessageSystem, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *MessageSystem) (*MessageSystem, error)
Delete(ctx context.Context, conn transaction.Conn, dm *MessageSystem) (*MessageSystem, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*MessageSystem, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*MessageSystem, error)
}
func (m *MessageSystem) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}