su_money_transaction_record.go 2.2 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 {
	SuMoneyTransactionRecordId int64    `json:"suMoneyTransactionRecordId"` // 素币事务记录ID
	RecordType int                      `json:"recordType"`                 // 记录类型
	Employee *EmployeeInfo              `json:"employee"`                   // 记录关联员工
	SuMoneyBeforeTransaction float64    `json:"suMoneyBeforeTransaction"`   // 事务处理前素币值
	CurrentSuMoney float64              `json:"currentSuMoney"`             // 当前素币值
	CashPoolBeforeTransaction *CashPool `json:"cashPoolBeforeTransaction"`  // 事务处理前现金池,用于兑换现金操作
	CurrentCashPool *CashPool           `json:"currentCashPool"`            // 当前现金池,用于兑换现金操作
	SuMoney float64                     `json:"suMoney"`                    // 事务素币值
	Cash float64                        `json:"cash"`                       // 事务现金值,用于兑换现金操作
	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
}