map_area_county.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. var MapAreaCounty = &mapAreaCountyConfig{}
  4. func init() {
  5. _allList = append(_allList, MapAreaCounty)
  6. }
  7. type (
  8. MapAreaCountyRow struct {
  9. CountyID int32 `json:"CountyID"` // 县ID
  10. }
  11. mapAreaCountyConfig struct {
  12. baseConfig
  13. list []*MapAreaCountyRow // all list
  14. countyIDUniMaps map[int32]*MapAreaCountyRow // key:countyID
  15. }
  16. )
  17. func (p *mapAreaCountyConfig) Name() string {
  18. return "map_area_county"
  19. }
  20. func (p *mapAreaCountyConfig) Init() {
  21. p.countyIDUniMaps = map[int32]*MapAreaCountyRow{}
  22. }
  23. func (p *mapAreaCountyConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  24. if reload && p.denyLoad {
  25. return 0, nil
  26. }
  27. var list []*MapAreaCountyRow
  28. if err := DecodeData(maps, &list); err != nil {
  29. return 0, err
  30. }
  31. p.list = list
  32. countyIDUniMaps := map[int32]*MapAreaCountyRow{}
  33. for _, row := range list {
  34. countyIDUniMaps[row.CountyID] = row
  35. }
  36. p.countyIDUniMaps = countyIDUniMaps
  37. return len(list), nil
  38. }
  39. // func (p *mapAreaCountyConfig) OnAfterLoad(_ bool) {
  40. // }
  41. func (p *mapAreaCountyConfig) List() []*MapAreaCountyRow {
  42. return p.list
  43. }
  44. func (p *mapAreaCountyConfig) GetByCountyID(countyID int32) (*MapAreaCountyRow, bool) {
  45. value, found := p.countyIDUniMaps[countyID]
  46. return value, found
  47. }
  48. func (p *mapAreaCountyConfig) ContainCountyID(countyID int32) bool {
  49. _, found := p.countyIDUniMaps[countyID]
  50. return found
  51. }