go-common/app/admin/main/esports/model/team_map.go

34 lines
681 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package model
import (
"fmt"
"strings"
)
const _teamMapInsertSQL = "INSERT INTO es_teams_map(tid,aid) VALUES %s"
// TeamMap .
type TeamMap struct {
ID int64 `json:"id"`
Tid int64 `json:"tid"`
Aid int64 `json:"aid"`
IsDeleted int `json:"is_deleted"`
}
// TableName es_teams_map.
func (t TeamMap) TableName() string {
return "es_teams_map"
}
// BatchAddTeamMapSQL .
func BatchAddTeamMapSQL(data []*TeamMap) string {
if len(data) == 0 {
return ""
}
var rowStrings []string
for _, v := range data {
rowStrings = append(rowStrings, fmt.Sprintf("(%d,%d)", v.Tid, v.Aid))
}
return fmt.Sprintf(_teamMapInsertSQL, strings.Join(rowStrings, ","))
}