exchange_cash_person_list.go 1.7 KB
package domain

// 参与兑换现金人员
type ExchangeCashPersonList struct {
	ExchangeCashPersonListId int64     `json:"exchangeCashPersonListId"`        // 兑换人员ID
	//CompanyId                int64     `json:"companyId"`          				// 公司id
	EmployeeInfo *EmployeeInfo 			`json:"employeeInfo"`
	//PersonId 				 int64     `json:"personId"`          				// 兑换人员uid
	//ExchangeCashPersonName   string    `json:"exchangeCashPersonName"`       	// 兑换人员名称
	ExchangeCashActivityId   int64     `json:"exchangeActivityId"` 				// 参与的兑换活动id
	ExchangedSuMoney         float64   `json:"suMoney"`            				// 已兑换的素币
	ExchangedCash            float64   `json:"cash"`               				// 已兑换的现金
}

type ExchangeCashPersonListRepository interface {
	Save(exchangeCashPersonList *ExchangeCashPersonList) (*ExchangeCashPersonList, error)
	Remove(exchangeCashPersonList *ExchangeCashPersonList) (*ExchangeCashPersonList, error)
	FindOne(queryOptions map[string]interface{}) (*ExchangeCashPersonList, error)
	Find(queryOptions map[string]interface{}) (int64, []*ExchangeCashPersonList, error)
}

func (exchangeCashPersonList *ExchangeCashPersonList) Identity() interface{} {
	if exchangeCashPersonList.ExchangeCashPersonListId == 0 {
		return nil
	}
	return exchangeCashPersonList.ExchangeCashPersonListId
}

func (exchangeCashPersonList *ExchangeCashPersonList) Update(data map[string]interface{}) error {
	if exchangedSuMoney, ok := data["exchangedSuMoney"]; ok && exchangedSuMoney != 0 {
		exchangeCashPersonList.ExchangedSuMoney = exchangedSuMoney.(float64)
	}
	if exchangedCash, ok := data["exchangedCash"]; ok && exchangedCash != 0 {
		exchangeCashPersonList.ExchangedCash = exchangedCash.(float64)
	}
	return nil
}