team_map.go 681 B

123456789101112131415161718192021222324252627282930313233
  1. package model
  2. import (
  3. "fmt"
  4. "strings"
  5. )
  6. const _teamMapInsertSQL = "INSERT INTO es_teams_map(tid,aid) VALUES %s"
  7. // TeamMap .
  8. type TeamMap struct {
  9. ID int64 `json:"id"`
  10. Tid int64 `json:"tid"`
  11. Aid int64 `json:"aid"`
  12. IsDeleted int `json:"is_deleted"`
  13. }
  14. // TableName es_teams_map.
  15. func (t TeamMap) TableName() string {
  16. return "es_teams_map"
  17. }
  18. // BatchAddTeamMapSQL .
  19. func BatchAddTeamMapSQL(data []*TeamMap) string {
  20. if len(data) == 0 {
  21. return ""
  22. }
  23. var rowStrings []string
  24. for _, v := range data {
  25. rowStrings = append(rowStrings, fmt.Sprintf("(%d,%d)", v.Tid, v.Aid))
  26. }
  27. return fmt.Sprintf(_teamMapInsertSQL, strings.Join(rowStrings, ","))
  28. }