partner_category.go 1.3 KB
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
}