exchange_cash_person_list.go
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package domain
import (
"fmt"
"strconv"
)
// 参与兑换现金人员
type ExchangeCashPersonList struct {
ListId int64 `json:"listId"` // 清单id
EmployeeInfo *EmployeeInfo `json:"employeeInfo"` // 兑换人信息
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)
FindAll(queryOptions map[string]interface{}) (int64, []*ExchangeCashPersonList, error)
FindById(queryOptions map[string]interface{}) (int64, []*ExchangeCashPersonList, error)
}
func (exchangeCashPersonList *ExchangeCashPersonList) Identity() interface{} {
if exchangeCashPersonList.ListId == 0 {
return nil
}
return exchangeCashPersonList.ListId
}
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, _ = strconv.ParseFloat(fmt.Sprintf("%.2F", exchangedCash.(float64)), 64)
}
return nil
}