partner_category.go
1.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
package domain
// 合伙人类别 (实体)
type PartnerCategory struct {
// 合伙人类别id
PartnerCategoryId int `json:"partnerCategoryId"`
// 合伙人类别编码
PartnerCategoryCode string `json:"partnerCategoryCode"`
// 合伙人类别名称
PartnerCategoryName string `json:"partnerCategoryName"`
}
type PartnerCategoryRepository interface {
Save(partnerCategory *PartnerCategory) (*PartnerCategory, error)
Remove(partnerCategory *PartnerCategory) (*PartnerCategory, error)
FindOne(queryOptions map[string]interface{}) (*PartnerCategory, error)
Find(queryOptions map[string]interface{}) (int64, []*PartnerCategory, error)
}
func (partnerCategory *PartnerCategory) Identify() interface{} {
if partnerCategory.PartnerCategoryId == 0 {
return nil
}
return partnerCategory.PartnerCategoryId
}
func (partnerCategory *PartnerCategory) Update(data map[string]interface{}) error {
if partnerCategoryId, ok := data["partnerCategoryId"]; ok {
partnerCategory.PartnerCategoryId = partnerCategoryId.(int)
}
if partnerCategoryCode, ok := data["partnerCategoryCode"]; ok {
partnerCategory.PartnerCategoryCode = partnerCategoryCode.(string)
}
if partnerCategoryName, ok := data["partnerCategoryName"]; ok {
partnerCategory.PartnerCategoryName = partnerCategoryName.(string)
}
return nil
}