waybill_logistics.go 1.5 KB

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