regionController.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package controllers
  2. import (
  3. "rtzh_elec_temperature/rtelec_app_public_lib/service"
  4. )
  5. //区域管理相关服务
  6. type RegionController struct {
  7. BaseController
  8. }
  9. // 获取当前变电站信息
  10. // @Summary 获取当前变电站信息
  11. // @Description 获取当前变电站信息。
  12. // @Tags api
  13. // @Accept x-www-form-urlencoded
  14. // @Produce json
  15. // @Success 200 {object} ApiOK|ApiError 服务访问成功
  16. // @Failure 401 status 认证未通过,一般是未指定token或token已失效
  17. // @Failure 500 status 服务器|后台发生错误
  18. // @router /station [get]
  19. func (c *RegionController) GetStationInfo() {
  20. logObject := new(service.RegionService)
  21. logObject.UserInfo = c.GetCurrentUserInfo_rt()
  22. List, err := logObject.GetStationInfo()
  23. if err != nil {
  24. c.Data["json"] = c.ApiError(err.Error())
  25. } else {
  26. c.Data["json"] = c.ApiOK(List)
  27. }
  28. c.ServeJSON()
  29. }
  30. // 区域列表 godoc
  31. // @Summary 查询区域记录列表
  32. // @Description 查询区域记录列表
  33. // @Tags api
  34. // @Accept x-www-form-urlencoded
  35. // @Produce json
  36. // @Success 200 {object} ApiOK
  37. // @Failure 500 {object} ApiError
  38. // @router /list [get]
  39. func (c *RegionController) List() {
  40. param := map[string]interface{}{}
  41. logObject := new(service.RegionService)
  42. logObject.UserInfo = c.GetCurrentUserInfo_rt()
  43. List, err := logObject.List(param)
  44. if err != nil {
  45. c.Data["json"] = c.ApiError(err.Error())
  46. } else {
  47. c.Data["json"] = c.ApiOK(List)
  48. }
  49. c.ServeJSON()
  50. }