match.go 3.59 KB
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 + ")")
	}
}