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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package dto
import "gorm.io/gorm"
type PageMatchInfo struct {
Id string `json:"id"`
MatchId string `json:"matchId"`
LeagueName string `json:"leagueName"`
DivisionName string `json:"divisionName"`
SeasonId string `json:"seasonId"`
SeasonName string `json:"seasonName"`
Rounds string `json:"rounds"`
ClubName string `json:"clubName"`
TeamId string `json:"teamId"`
TeamName string `json:"teamName"`
PlayerId string `json:"playerId"`
PlayerName string `json:"playerName"`
PlayerNumber string `json:"playerNumber"`
Position string `json:"position"`
Content string `json:"content"`
EvaluateId string `json:"evaluateId" comment:"精彩时刻id"`
TeamAName string `json:"team_a_name" comment:"a队名"`
TeamBName string `json:"team_b_name" comment:"b队名"`
}
type Wonderful struct {
Id string `json:"精彩时刻id"`
WonderfulUrl string `json:"wonderfulUrl" comment:"精彩时刻url"`
WonderfulTitle string `json:"wonderfulTitle" comment:"精彩时刻标题"`
}
type TotalScoring struct {
Scoring string `json:"scoring" comment:"得分"`
Rebound string `json:"rebound" comment:"篮板"`
Assist string `json:"assist" comment:"助攻"`
Steal string `json:"steal" comment:"抢断"`
FreeThrow string `json:"freeThrow" comment:"罚球"`
BlockShot string `json:"blockShot" comment:"盖帽"`
Foul string `json:"foul" comment:"犯规"`
TwoPointShot string `json:"twoPointShot" comment:"2分进球数量"`
ThreePointShot string `json:"threePointShot" comment:"3分进球数量"`
}
type RoundsScoring struct {
PlayerName string `json:"player_name" comment:"球员名称"`
PlayerNumber string `json:"player_number" comment:"球员号码"`
Position string `json:"position" comment:"场上位置"`
Rounds string `json:"rounds" comment:"轮次"`
Grouping string `json:"grouping" comment:"分组"`
OtherTeam string `json:"otherTeam" comment:"对方球队"`
Scoring string `json:"scoring" comment:"得分"`
Rebound string `json:"rebound" comment:"篮板"`
Assist string `json:"assist" comment:"助攻"`
Steal string `json:"steal" comment:"抢断"`
FreeThrow string `json:"freeThrow" comment:"罚球"`
BlockShot string `json:"blockShot" comment:"盖帽"`
Foul string `json:"foul" comment:"犯规"`
TwoPointShot string `json:"twoPointShot" comment:"2分进球数量"`
ThreePointShot string `json:"threePointShot" comment:"3分进球数量"`
}
func SetWhere(tableName string, fieldName string, fieldValue string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
if fieldValue == "0" || fieldValue == "" {
return db
}
if tableName == "" {
return db.Where(fieldName+" = ?", fieldValue)
}
return db.Where(tableName+"."+fieldName+" = ?", fieldValue)
}
}
func SetWhereIn(tableName string, fieldName string, fieldValue string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
if fieldValue == "0" || fieldValue == "" {
return db
}
if tableName == "" {
return db.Where(fieldName + " in (" + fieldValue + ")")
}
return db.Where(tableName + "." + fieldName + " in (" + fieldValue + ")")
}
}
func SetWhereNotIn(tableName string, fieldName string, fieldValue string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
if fieldValue == "0" || fieldValue == "" {
return db
}
if tableName == "" {
return db.Where(fieldName + " not in (" + fieldValue + ")")
}
return db.Where(tableName + "." + fieldName + " not in (" + fieldValue + ")")
}
}