• haoyanbin's avatar
    1 · c65e78f1
    haoyanbin authored
    c65e78f1
org_match.go 8.68 KB
package dto

import (
	"go-admin/app/operate/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
	"time"
)

type OrgMatchGetPageReq struct {
	dto.Pagination `search:"-"`
	LeagueId       string `form:"leagueId"  search:"type:exact;column:league_id;table:om" comment:""`
	DivisionId     string `form:"divisionId"  search:"type:exact;column:division_id;table:om" comment:""`
	SeasonId       string `form:"seasonId"  search:"type:exact;column:season_id;table:om" comment:""`
	Rounds         string `form:"rounds"  search:"type:exact;column:rounds;table:om" comment:""`
	Grouping       string `form:"grouping"  search:"type:exact;column:grouping;table:om" comment:""`
	Status         string `form:"status"  search:"type:exact;column:status;table:om" comment:"比赛状态 1 未开始 2 比赛中 3 已结束"`
	MatchStartTime string `form:"matchStartTime"  search:"type:gte;column:match_start_time;table:om" comment:"比赛开始时间"`
	MatchEndTime   string `form:"matchEndTime"  search:"type:lte;column:match_end_time;table:om" comment:"比赛结束时间"`
}

type OrgMatchGetPageReply struct {
	Id             string    `json:"id"`
	LeagueName     string    `json:"leagueName"`
	DivisionName   string    `json:"divisionName"`
	SeasonName     string    `json:"seasonName"`
	Rounds         string    `json:"rounds"`
	Grouping       string    `json:"grouping"`
	TeamAName      string    `json:"team_a_name"`
	TeamBName      string    `json:"team_b_name"`
	TeamAId        string    `json:"teamAId"`
	TeamBId        string    `json:"teamBId"`
	MatchStartTime time.Time `json:"matchStartTime"`
	MatchEndTime   time.Time `json:"matchEndTime"`
	Status         string    `json:"status"`
}

type OrgMatchGetInfoReq struct {
	Id int `form:"id" json:"id"`
}

type OrgMatchGetInfoReply struct {
	OrgMatch        models.OrgMatch         `form:"orgMatch"`
	OrgLeagueList   []models.OrgLeague      `form:"orgLeagueList"`
	OrgSeasonList   []OrgSeasonGetPageReply `form:"orgSeasonList"`
	OrgDivisionList []models.OrgDivision    `form:"orgDivisionList"`
	OrgTeamList     []OrgTeamGetPageReply   `form:"orgTeamList"`
}

type OrgMatchOrder struct {
	Id             int       `form:"idOrder"  search:"type:order;column:id;table:org_match"`
	LeagueId       string    `form:"leagueIdOrder"  search:"type:order;column:league_id;table:org_match"`
	DivisionId     string    `form:"divisionIdOrder"  search:"type:order;column:division_id;table:org_match"`
	SeasonId       string    `form:"seasonIdOrder"  search:"type:order;column:season_id;table:org_match"`
	ClubId         string    `form:"clubIdOrder"  search:"type:order;column:club_id;table:org_match"`
	TeamId         string    `form:"teamIdOrder"  search:"type:order;column:team_id;table:org_match"`
	Status         string    `form:"statusOrder"  search:"type:order;column:status;table:org_match"`
	Rounds         string    `form:"roundsOrder"  search:"type:order;column:rounds;table:org_match"`
	Grouping       string    `form:"groupingOrder"  search:"type:order;column:grouping;table:org_match"`
	MatchStartTime time.Time `form:"matchStartTimeOrder"  search:"type:order;column:match_start_time;table:org_match"`
	MatchEndTime   time.Time `form:"matchEndTimeOrder"  search:"type:order;column:match_end_time;table:org_match"`
	TeamAId        string    `form:"teamAIdOrder"  search:"type:order;column:team_a_id;table:org_match"`
	TeamBId        string    `form:"teamBIdOrder"  search:"type:order;column:team_b_id;table:org_match"`
	TeamAScore     string    `form:"teamAScoreOrder"  search:"type:order;column:team_a_score;table:org_match"`
	TeamBScore     string    `form:"teamBScoreOrder"  search:"type:order;column:team_b_score;table:org_match"`
	TeamAIntegral  string    `form:"teamAIntegralOrder"  search:"type:order;column:team_a_integral;table:org_match"`
	TeamBIntegral  string    `form:"teamBIntegralOrder"  search:"type:order;column:team_b_integral;table:org_match"`
	CreateBy       string    `form:"createByOrder"  search:"type:order;column:create_by;table:org_match"`
	UpdateBy       string    `form:"updateByOrder"  search:"type:order;column:update_by;table:org_match"`
	CreatedAt      time.Time `form:"createdAtOrder"  search:"type:order;column:created_at;table:org_match"`
	UpdatedAt      time.Time `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:org_match"`
	DeletedAt      time.Time `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:org_match"`
}

func (m *OrgMatchGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type OrgMatchInsertReq struct {
	Id             int    `json:"-" comment:""` //
	LeagueId       string `json:"leagueId" comment:""`
	DivisionId     string `json:"divisionId" comment:""`
	SeasonId       string `json:"seasonId" comment:""`
	ClubId         string `json:"clubId" comment:""`
	TeamId         string `json:"teamId" comment:""`
	Status         string `json:"status" comment:"比赛状态 1 未开始 2 比赛中 3 已结束"`
	Rounds         string `json:"rounds" comment:"轮次"`
	Grouping       string `json:"grouping" comment:"分组"`
	MatchStartTime string `json:"matchStartTime" comment:"比赛开始时间"`
	MatchEndTime   string `json:"matchEndTime" comment:"比赛结束时间"`
	TeamAId        string `json:"teamAId" comment:"a队id"`
	TeamBId        string `json:"teamBId" comment:"b队id"`
	TeamAScore     string `json:"teamAScore" comment:"a队比分"`
	TeamBScore     string `json:"teamBScore" comment:"b队比分"`
	TeamAIntegral  string `json:"teamAIntegral" comment:"a队积分"`
	TeamBIntegral  string `json:"teamBIntegral" comment:"a队积分"`
	common.ControlBy
}

func (s *OrgMatchInsertReq) Generate(model *models.OrgMatch) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}

	model.LeagueId = s.LeagueId
	model.DivisionId = s.DivisionId
	model.SeasonId = s.SeasonId
	model.ClubId = s.ClubId
	model.TeamId = s.TeamId
	model.Status = s.Status
	model.Rounds = s.Rounds
	model.Grouping = s.Grouping
	model.MatchStartTime, _ = time.Parse("2006-01-02 15:04:05", s.MatchStartTime)
	model.MatchEndTime, _ = time.Parse("2006-01-02 15:04:05", s.MatchEndTime)
	model.TeamAId = s.TeamAId
	model.TeamBId = s.TeamBId
	model.TeamAScore = s.TeamAScore
	model.TeamBScore = s.TeamBScore
	model.TeamAIntegral = s.TeamAIntegral
	model.TeamBIntegral = s.TeamBIntegral
}

func (s *OrgMatchInsertReq) GetId() interface{} {
	return s.Id
}

type OrgMatchUpdateReq struct {
	Id             int    `uri:"id" comment:""` //
	LeagueId       string `json:"leagueId" comment:""`
	DivisionId     string `json:"divisionId" comment:""`
	SeasonId       string `json:"seasonId" comment:""`
	ClubId         string `json:"clubId" comment:""`
	TeamId         string `json:"teamId" comment:""`
	Status         string `json:"status" comment:"比赛状态 1 未开始 2 比赛中 3 已结束"`
	Rounds         string `json:"rounds" comment:"轮次"`
	Grouping       string `json:"grouping" comment:"分组"`
	MatchStartTime string `json:"matchStartTime" comment:"比赛开始时间"`
	MatchEndTime   string `json:"matchEndTime" comment:"比赛结束时间"`
	TeamAId        string `json:"teamAId" comment:"a队id"`
	TeamBId        string `json:"teamBId" comment:"b队id"`
	TeamAScore     string `json:"teamAScore" comment:"a队比分"`
	TeamBScore     string `json:"teamBScore" comment:"b队比分"`
	TeamAIntegral  string `json:"teamAIntegral" comment:"a队积分"`
	TeamBIntegral  string `json:"teamBIntegral" comment:"a队积分"`
	common.ControlBy
}

func (s *OrgMatchUpdateReq) Generate(model *models.OrgMatch) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.LeagueId = s.LeagueId
	model.DivisionId = s.DivisionId
	model.SeasonId = s.SeasonId
	model.ClubId = s.ClubId
	model.TeamId = s.TeamId
	model.Status = s.Status
	model.Rounds = s.Rounds
	model.Grouping = s.Grouping
	model.MatchStartTime, _ = time.Parse("2006-01-02 15:04:05", s.MatchStartTime)
	model.MatchEndTime, _ = time.Parse("2006-01-02 15:04:05", s.MatchEndTime)
	model.TeamAId = s.TeamAId
	model.TeamBId = s.TeamBId
	model.TeamAScore = s.TeamAScore
	model.TeamBScore = s.TeamBScore
	model.TeamAIntegral = s.TeamAIntegral
	model.TeamBIntegral = s.TeamBIntegral
}

func (s *OrgMatchUpdateReq) GetId() interface{} {
	return s.Id
}

// OrgMatchGetReq 功能获取请求参数
type OrgMatchGetReq struct {
	Id int `uri:"id"`
}
type OrgMatchGetReply struct {
	OrgMatch            models.OrgMatch             `form:"orgMatch" json:"orgMatch"`
	OrgMatchTeamAPlayer []models.OrgMatchTeamPlayer `form:"orgMatchTeamAPlayer" json:"orgMatchTeamAPlayer"`
	OrgMatchTeamBPlayer []models.OrgMatchTeamPlayer `form:"orgMatchTeamBPlayer" json:"orgMatchTeamBPlayer"`
}

func (s *OrgMatchGetReq) GetId() interface{} {
	return s.Id
}

// OrgMatchDeleteReq 功能删除请求参数
type OrgMatchDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *OrgMatchDeleteReq) GetId() interface{} {
	return s.Ids
}