su_money_transaction_record.go 2.3 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              //扣除
	SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE_CASH		 //兑换现金
	SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE_CASH_RESTORE // 兑换现金撤销
)

// 素币事务记录
type SuMoneyTransactionRecord struct {
	SuMoneyTransactionRecordId int64    `json:"suMoneyTransactionRecordId"` // 素币事务记录ID
	RecordType int                      `json:"recordType"`                 // 记录类型
	Employee *EmployeeInfo              `json:"employee"`                   // 记录关联员工
	SuMoneyBeforeTransaction float64    `json:"suMoneyBeforeTransaction"`   // 事务处理前素币值
	CurrentSuMoney float64              `json:"currentSuMoney"`             // 当前素币值
	SuMoney float64                     `json:"suMoney"`                    // 事务素币值
	CashBeforeTransaction float64       `json:"cashBeforeTransaction"`      // 事务处理前现金值
	CurrentCash float64             	`json:"currentCash"` 				// 当前现金值
	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)
	FindById(queryOptions map[string]interface{}) (int64, []*SuMoneyTransactionRecord, error)
}

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