waybill_logistics.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 waybillNo query string true "运单号"
  19. // @Param status query string false "状态"
  20. // @Success 200 {object} response.Response{data=response.Page{list=[]model.WaybillLogistics}} "{"code": 200, "data": [...]}"
  21. // @Router /api/waybill [get]
  22. // @Security Bearer
  23. func (e WaybillLogisticsController) GetPage(c *gin.Context) {
  24. s := service.WaybillLogistics{}
  25. req := dto.WaybillLogisticsGetPageReq{}
  26. err := e.MakeContext(c).
  27. MakeOrm().
  28. Bind(&req, binding.Query).
  29. MakeService(&s.Service).
  30. Errors
  31. if err != nil {
  32. e.Logger.Error(err)
  33. e.Error(500, err, err.Error())
  34. return
  35. }
  36. list := make([]model.WaybillLogistics, 0)
  37. var count int64
  38. err = s.GetPage(&req, &list, &count)
  39. if err != nil {
  40. e.Error(500, err, err.Error())
  41. return
  42. }
  43. e.PageOK(list, int(count), 0, 0, "查询成功")
  44. }