list_interval.go
1.2 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
package domain
import (
"time"
)
// 排行榜时间
type ListInterval struct {
ListIntervalId int `json:"listIntervalId"` // 排行榜时间id
CompanyId int `json:"companyId"` // 公司id
IntervalStartTime time.Time `json:"intervalStartTime"` // 排行榜开始时间
IntervalEndTime time.Time `json:"intervalEndTime"` // 排行榜结束时间
}
type ListIntervalRepository interface {
Save(listInterval *ListInterval) (*ListInterval, error)
Remove(listInterval *ListInterval) (*ListInterval, error)
FindOne(queryOptions map[string]interface{}) (*ListInterval, error)
Find(queryOptions map[string]interface{}) (int64, []*ListInterval, error)
FindAll(queryOptions map[string]interface{}) (int64, []*ListInterval, error)
}
func (listInterval *ListInterval) Identify() interface{} {
if listInterval.ListIntervalId == 0 {
return nil
}
return listInterval.ListIntervalId
}
func (listInterval *ListInterval) Update(data map[string]interface{}) error {
if listIntervalStartTime, ok := data["listIntervalStartTime"]; ok {
listInterval.IntervalStartTime = listIntervalStartTime.(time.Time)
}
if listIntervalEndTime, ok := data["listIntervalEndTime"]; ok {
listInterval.IntervalEndTime = listIntervalEndTime.(time.Time)
}
return nil
}