waybill_logistics.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package controller
  2. import (
  3. "cold-delivery/app/admin/model"
  4. "cold-delivery/app/admin/service"
  5. "cold-delivery/app/admin/service/dto"
  6. "github.com/gin-gonic/gin"
  7. "github.com/gin-gonic/gin/binding"
  8. "gogs.baozhida.cn/zoie/OAuth-core/api"
  9. _ "gogs.baozhida.cn/zoie/OAuth-core/pkg/response"
  10. )
  11. type WaybillLogisticsController struct {
  12. api.Api
  13. }
  14. // GetPage 获取运单列表
  15. // @Summary 获取运单列表
  16. // @Description 获取运单列表
  17. // @Tags 运单
  18. // @Param no query string false "运单号"
  19. // @Param pageSize query int false "页条数"
  20. // @Param page query int false "页码"
  21. // @Success 200 {object} response.Response{data=response.Page{list=[]model.WaybillLogistics}} "{"code": 200, "data": [...]}"
  22. // @Router /api/waybill [get]
  23. // @Security Bearer
  24. func (e WaybillLogisticsController) GetPage(c *gin.Context) {
  25. s := service.WaybillLogistics{}
  26. req := dto.WaybillLogisticsGetPageReq{}
  27. err := e.MakeContext(c).
  28. MakeOrm().
  29. Bind(&req, binding.Query).
  30. MakeService(&s.Service).
  31. Errors
  32. if err != nil {
  33. e.Logger.Error(err)
  34. e.Error(500, err, err.Error())
  35. return
  36. }
  37. list := make([]model.WaybillLogistics, 0)
  38. var count int64
  39. err = s.GetPage(&req, &list, &count)
  40. if err != nil {
  41. e.Error(500, err, err.Error())
  42. return
  43. }
  44. //e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
  45. e.PageOK(list, int(count), 0, 0, "查询成功")
  46. }