customer_value.go 945 字节
package domain

// 客户价值
type CustomerValue struct {
	// 客户价值ID
	CustomerValueId int `json:"customerValueId"`
	// 客户价值名称
	CustomerValueName string `json:"customerValueName"`
	// 公司ID
	CompanyId int64 `json:"companyId"`
}

type CustomerValueRepository interface {
	Save(customerValue *CustomerValue) (*CustomerValue, error)
	Remove(customerValue *CustomerValue) (*CustomerValue, error)
	FindOne(queryOptions map[string]interface{}) (*CustomerValue, error)
	Find(queryOptions map[string]interface{}) (int64, []*CustomerValue, error)
}

func (customerValue *CustomerValue) Identify() interface{} {
	if customerValue.CustomerValueId == 0 {
		return nil
	}
	return customerValue.CustomerValueId
}

func (customerValue *CustomerValue) Update(data map[string]interface{}) error {
	if customerValueName, ok := data["customerValueName"]; ok {
		customerValue.CustomerValueName = customerValueName.(string)
	}
	return nil
}