waybill_logistics.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package service
  2. import (
  3. "cold-logistics/app/admin/model"
  4. "cold-logistics/app/admin/service/dto"
  5. cDto "cold-logistics/common/dto"
  6. "cold-logistics/common/global"
  7. "gogs.baozhida.cn/zoie/OAuth-core/service"
  8. )
  9. type WaybillLogistics struct {
  10. service.Service
  11. }
  12. // GetPage 获取WaybillLogistics列表
  13. func (e *WaybillLogistics) GetPage(c *dto.WaybillLogisticsGetPageReq, list *[]model.WaybillLogistics, count *int64) error {
  14. var err error
  15. var data model.WaybillLogistics
  16. status := []int{
  17. model.WaybillStatusTruck,
  18. model.WaybillStatusStorage,
  19. model.WaybillStatusTruckOut,
  20. model.WaybillStatusStorageOut,
  21. model.WaybillStatusVanning,
  22. model.WaybillStatusVanningOut,
  23. model.WaybillStatusReceipt,
  24. }
  25. err = e.Orm.Model(&data).
  26. Scopes(
  27. cDto.MakeCondition(c.GetNeedSearch()),
  28. ).
  29. Where("status in (?)", status).
  30. Preload("User").
  31. Preload("Warehouse.User").Preload("Car.User").Preload("CoolerBox").
  32. Find(list).
  33. Count(count).Error
  34. if err != nil {
  35. e.Log.Errorf("db error: %s", err)
  36. return global.GetFailedErr
  37. }
  38. return nil
  39. }