match.go 4 KB
Newer Older
haoyanbin's avatar
1  
haoyanbin committed
1 2
package dto

haoyanbin's avatar
haoyanbin committed
3 4
import "gorm.io/gorm"

haoyanbin's avatar
1  
haoyanbin committed
5
type PageMatchInfo struct {
haoyanbin's avatar
haoyanbin committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
	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 {
haoyanbin's avatar
haoyanbin committed
27
	WonderfulId    string `json:"wonderfulId" comment:"精彩时刻id"`
haoyanbin's avatar
haoyanbin committed
28 29
	WonderfulUrl   string `json:"wonderfulUrl" comment:"精彩时刻url"`
	WonderfulTitle string `json:"wonderfulTitle" comment:"精彩时刻标题"`
haoyanbin's avatar
haoyanbin committed
30
	FileId         string `json:"fileId" comment:"文件id"`
haoyanbin's avatar
1  
haoyanbin committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
}

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 {
haoyanbin's avatar
haoyanbin committed
46 47 48
	PlayerName     string `json:"player_name" comment:"球员名称"`
	PlayerNumber   string `json:"player_number" comment:"球员号码"`
	Position       string `json:"position" comment:"场上位置"`
haoyanbin's avatar
1  
haoyanbin committed
49 50 51 52 53 54 55 56 57 58 59 60 61
	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分进球数量"`
}
haoyanbin's avatar
haoyanbin committed
62 63 64 65 66 67 68 69 70 71 72 73

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)
	}
}
haoyanbin's avatar
haoyanbin committed
74 75 76 77 78 79 80 81 82 83 84
func SetWhereNE(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)
	}
}
haoyanbin's avatar
haoyanbin committed
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108

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 + ")")
	}
}