su_money_transaction_record.go 1.6 KB
package domain

import "time"

const (
	SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE = iota + 1 //兑换
	SU_MONEY_TRANSACTION_RECORD_TYPE_AWARD               //任务奖励
	SU_MONEY_TRANSACTION_RECORD_TYPE_INCREASE            //增加
	SU_MONEY_TRANSACTION_RECORD_TYPE_DEDUCT              //扣除
)

// 素币事务记录
type SuMoneyTransactionRecord struct {
	// 素币事务记录ID
	SuMoneyTransactionRecordId int64 `json:"suMoneyTransactionRecordId"`
	// 记录类型
	RecordType int `json:"recordType"`
	// 记录关联员工
	Employee *EmployeeInfo `json:"employee"`
	// 事务处理前素币值
	SuMoneyBeforeTransaction float64 `json:"suMoneyBeforeTransaction"`
	// 当前素币值
	CurrentSuMoney float64 `json:"currentSuMoney"`
	// 事务素币值
	SuMoney float64 `json:"suMoney"`
	// 操作人
	Operator *EmployeeInfo `json:"operator"`
	// 素币事务记录描述
	RecordDescription string `json:"recordDescription"`
	// 创建时间
	CreateTime time.Time `json:"createTime"`
}

type SuMoneyTransactionRecordRepository interface {
	Save(suMoneyTransactionRecord *SuMoneyTransactionRecord) (*SuMoneyTransactionRecord, error)
	Remove(suMoneyTransactionRecord *SuMoneyTransactionRecord) (*SuMoneyTransactionRecord, error)
	FindOne(queryOptions map[string]interface{}) (*SuMoneyTransactionRecord, error)
	Find(queryOptions map[string]interface{}) (int64, []*SuMoneyTransactionRecord, error)
}

func (suMoneyTransactionRecord *SuMoneyTransactionRecord) Identify() interface{} {
	if suMoneyTransactionRecord.SuMoneyTransactionRecordId == 0 {
		return nil
	}
	return suMoneyTransactionRecord.SuMoneyTransactionRecordId
}