vo.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package carsrv
  2. import (
  3. "Cold_Logistic/internal/pkg/common/constant"
  4. "Cold_Logistic/internal/pkg/common/global"
  5. "Cold_Logistic/internal/server/infra/models"
  6. validation "github.com/go-ozzo/ozzo-validation/v4"
  7. "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core"
  8. )
  9. type CarPageReqVO struct {
  10. Page core.Page `json:"page"`
  11. Search struct {
  12. CarNumber string `json:"carNumber"`
  13. SnCode string `json:"snCode"`
  14. DriverAccountUuid string `json:"driverAccountUuid"`
  15. } `json:"search"`
  16. }
  17. type CarIdRespVO struct {
  18. CarId int `json:"carId"`
  19. }
  20. type AddCarReqVO struct {
  21. CarNumber string `json:"carNumber"`
  22. SnCode string `json:"snCode"`
  23. Driver global.ClodAccount `json:"driver"`
  24. CarType string `json:"carType"`
  25. Enable int `json:"enable"`
  26. }
  27. func (r *AddCarReqVO) Validate() error {
  28. return validation.ValidateStruct(r,
  29. validation.Field(&r.CarNumber, validation.Required, validation.RuneLength(1, 30)),
  30. validation.Field(&r.SnCode, validation.Required, validation.RuneLength(1, 100)),
  31. validation.Field(&r.Driver),
  32. validation.Field(&r.CarType, validation.Required),
  33. validation.Field(&r.Enable, validation.In(constant.YES, constant.NO)),
  34. )
  35. }
  36. type UpdateCarReqVO struct {
  37. CarId int `json:"carId"`
  38. AddCarReqVO
  39. }
  40. func (r *UpdateCarReqVO) Validate() error {
  41. return validation.ValidateStruct(r,
  42. validation.Field(&r.CarId, validation.Required),
  43. validation.Field(&r.AddCarReqVO),
  44. )
  45. }
  46. type DriverLogReqVO struct {
  47. CarId int `json:"carId"`
  48. }
  49. func (r *DriverLogReqVO) Validate() error {
  50. return validation.ValidateStruct(r, validation.Field(&r.CarId, validation.Required))
  51. }
  52. type DriverLogRespVO struct {
  53. AccountId int `json:"accountId"`
  54. Name string `json:"name"`
  55. UseTime models.MyTime `json:"useTime"`
  56. HandoverTime models.MyTime `json:"handoverTime"`
  57. }