partner_info.go
2.0 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
package domain
import (
"time"
)
// 状态(1:启用或者0:禁用)
const (
PARTNER_STATUS_NO int = 0
PARTNER_STATUS_YES int = 1
)
//合伙类别 (1.事业合伙人 2.业务合伙人 3.研发合伙人)
const (
PARTNER_CATEGORY_1 int = 1
PARTNER_CATEGORY_2 int = 2
PARTNER_CATEGORY_3 int = 3
PARTNER_CATEGORY_4 int = 4
)
//partnerCategoryMap 合伙类别键值对 (只读,请勿在运行时修改)
var partnerCategoryMap = map[int]string{
PARTNER_CATEGORY_1: "事业合伙人",
PARTNER_CATEGORY_2: "业务合伙人",
PARTNER_CATEGORY_3: "研发合伙人",
PARTNER_CATEGORY_4: "业务-产品应用合伙人",
}
type PartnerInfo struct {
Partner Partner `json:"partner"`
//合伙类别
PartnerCategory int `json:"partnerCategory"`
// 登录密码
Password string `json:"password"`
// 状态(1:启用或者0:禁用)
Status int `json:"status"`
//创建时间
CreateAt time.Time `json:"createAt"`
//更新时间
UpdateAt time.Time `json:"updateAt"`
//合作时间
CooperateTime time.Time `json:"cooperateTime"`
//关联业务员//所属区域信息
RegionInfo *RegionInfo `json:"regionInfo"`
Salesman []Salesman `json:"salesman"`
}
func (p *PartnerInfo) GetPartnerCategory() map[int]string {
categoryMap := map[int]string{}
if v, ok := partnerCategoryMap[p.PartnerCategory]; ok {
categoryMap[p.PartnerCategory] = v
}
return categoryMap
}
func (p *PartnerInfo) IsUsable() bool {
return p.Status == PARTNER_STATUS_YES
}
type PartnerFindOneQuery struct {
UserId int64
AccountEqual string
}
type PartnerFindQuery struct {
Offset int
Limit int
PartnerCategory []int //合伙人类型
RegionInfo *RegionInfo //区域
PartnerName string //合伙人姓名
}
type PartnerInfoRepository interface {
Save(dm PartnerInfo) (*PartnerInfo, error)
FindOne(queryOptions PartnerFindOneQuery) (*PartnerInfo, error)
Find(queryOptions PartnerFindQuery) ([]PartnerInfo, error)
CountAll(queryOptions PartnerFindQuery) (int, error)
}