annex.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * @description:附件相关
  3. * @Author: LanJianRong
  4. * @Date: 2020-12-04 16:00:19
  5. * @FilePath: \construction_management\web\viewmodels\annex.go
  6. */
  7. package viewmodels
  8. import (
  9. "time"
  10. validation "github.com/go-ozzo/ozzo-validation/v3"
  11. )
  12. type Annex struct {
  13. Id string `form:"id" json:"id"`
  14. DataType string `form:"dataType" json:"dataType"`
  15. DataId string `form:"dataId" json:"dataId"`
  16. Name string `form:"name" json:"name"`
  17. OssUrl string `form:"OSSUrl" json:"OSSUrl"`
  18. AccountId string `form:"accoundId" json:"accoundId"`
  19. CreateTime time.Time `form:"createTime" json:"createTime"`
  20. UpdateTime time.Time `form:"updateTime" json:"updateTime"`
  21. }
  22. type AnnexList struct {
  23. Name string `form:"name" json:"name"`
  24. OssUrl string `form:"OSSUrl" json:"OSSUrl"`
  25. CreateTime time.Time `form:"createTime" json:"createTime"`
  26. }
  27. type AnnexListView struct {
  28. FileName string `from:"filename" json:"filename"`
  29. FilePath string `from:"filepath" json:"filepath"`
  30. AccountName string `from:"account_name" json:"acountName"`
  31. AccountId string `from:"account_id" json:"acountId"`
  32. CreateTime time.Time `from:"create_time" json:"createTime"`
  33. }
  34. func (l Annex) Validate() error {
  35. return validation.ValidateStruct(&l,
  36. validation.Field(&l.DataType, validation.Required.Error("存储类型不能为空")),
  37. validation.Field(&l.DataId, validation.Required.Error("存储ID不能为空")),
  38. validation.Field(&l.AccountId, validation.Required.Error("账号ID不能为空")),
  39. )
  40. }
  41. func (l Annex) ValidateGet() error {
  42. return validation.ValidateStruct(&l,
  43. validation.Field(&l.DataType, validation.Required.Error("存储类型不能为空")),
  44. validation.Field(&l.DataId, validation.Required.Error("存储ID不能为空")),
  45. )
  46. }