village.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package geo
  2. import (
  3. "database/sql"
  4. "zhiyuan/pkg/db"
  5. "github.com/gin-gonic/gin"
  6. )
  7. type Village struct {
  8. Code string `json:"code" type:"string" search:"="`
  9. Name string `json:"name" type:"string" search:"="`
  10. AreaCode string `json:"areaCode" type:"string" search:"="`
  11. CityCode string `json:"cityCode" type:"string" search:"="`
  12. ProvinceCode string `json:"provinceCode" type:"string" search:"="`
  13. StreetCode string `json:"streetCode" type:"string" search:"="`
  14. db.BaseModel
  15. }
  16. func (Village) TableName() string {
  17. return "village"
  18. }
  19. func (Village) DB() *sql.DB {
  20. return db.GeoDB
  21. }
  22. func (Village) PrimaryField() string {
  23. return "code"
  24. }
  25. func (Village) CreatedField() string {
  26. return ""
  27. }
  28. func (Village) UpdatedField() string {
  29. return ""
  30. }
  31. func (Village) DeletedField() string {
  32. return ""
  33. }
  34. func (model Village) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
  35. return true
  36. }
  37. func (Village) OnePrivilege(c *gin.Context, id int64) bool {
  38. return true
  39. }
  40. func (Village) Page() bool {
  41. return false
  42. }
  43. func (Village) Count() bool {
  44. return true
  45. }