package service import ( "cold-logistics/app/admin/model" "cold-logistics/app/admin/service/dto" cDto "cold-logistics/common/dto" "cold-logistics/common/global" "gogs.baozhida.cn/zoie/OAuth-core/service" ) type WaybillLogistics struct { service.Service } // GetPage 获取WaybillLogistics列表 func (e *WaybillLogistics) GetPage(c *dto.WaybillLogisticsGetPageReq, list *[]model.WaybillLogistics, count *int64) error { var err error var data model.WaybillLogistics status := []int{ model.WaybillStatusTruck, model.WaybillStatusStorage, model.WaybillStatusTruckOut, model.WaybillStatusStorageOut, model.WaybillStatusVanning, model.WaybillStatusVanningOut, model.WaybillStatusReceipt, } err = e.Orm.Model(&data). Scopes( cDto.MakeCondition(c.GetNeedSearch()), ). Where("status in (?)", status). Preload("User"). Preload("Warehouse.User").Preload("Car.User").Preload("CoolerBox"). Find(list). Count(count).Error if err != nil { e.Log.Errorf("db error: %s", err) return global.GetFailedErr } return nil }