lampPoleController.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package controller
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "iot_manager_service/app/model"
  5. "iot_manager_service/app/service"
  6. "iot_manager_service/app/utils"
  7. "net/http"
  8. "strconv"
  9. )
  10. // 灯杆基本信息管理对象
  11. var LampPole = new(lampPoleCtl)
  12. type lampPoleCtl struct{}
  13. func (c *lampPoleCtl) Detail(ctx *gin.Context) {
  14. id, e := strconv.Atoi(ctx.Query("id"))
  15. if e != nil {
  16. ctx.JSON(http.StatusOK, utils.ParamsInvalidResponse(e.Error(), nil))
  17. return
  18. }
  19. device, err := service.LampPoleService.Get(id)
  20. if err != nil {
  21. ctx.JSON(http.StatusOK, err)
  22. return
  23. }
  24. ctx.JSON(http.StatusOK, utils.SuccessResponse(utils.Succeeded, device))
  25. }
  26. func (c *lampPoleCtl) CreateOrUpdate(ctx *gin.Context) {
  27. var req *model.ReqLampPoleSubmit
  28. if err := ctx.ShouldBindJSON(&req); err != nil {
  29. ctx.JSON(http.StatusOK, utils.ParamsInvalidResponse(err.Error(), nil))
  30. return
  31. }
  32. err := service.LampPoleService.CreateOrUpdate(req)
  33. ctx.JSON(http.StatusOK, err)
  34. }
  35. func (c *lampPoleCtl) List(ctx *gin.Context) {
  36. }
  37. func (c *lampPoleCtl) GetRelevanceDetail(ctx *gin.Context) {
  38. }
  39. func (c *lampPoleCtl) Remove(ctx *gin.Context) {
  40. }
  41. func (c *lampPoleCtl) ImportExcel(ctx *gin.Context) {
  42. }
  43. func (c *lampPoleCtl) ExportExcel(ctx *gin.Context) {
  44. }
  45. func (c *lampPoleCtl) ExportTemplate(ctx *gin.Context) {
  46. }
  47. func (c *lampPoleCtl) GetList(ctx *gin.Context) {
  48. }