tree_contract.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * @description:合同目录视图模型
  3. * @Author: CP
  4. * @Date: 2020-10-27 17:07:50
  5. * @FilePath: \construction_management\web\viewmodels\tree_contract.go
  6. */
  7. package viewmodels
  8. import validation "github.com/go-ozzo/ozzo-validation/v3"
  9. type TreeContract struct {
  10. Id string `form:"id" json:"id" `
  11. Name string `form:"name" json:"name"`
  12. ProjectId string `form:"projectId" json:"projectId"`
  13. BidsectionId string `form:"bidsectionId" json:"bidsectionId"`
  14. ParentId string `form:"parentId" json:"parentId"`
  15. Depth int `form:"depth" json:"depth"`
  16. Serial string `form:"serial" json:"serial"`
  17. Attribution string `form:"attribution" json:"attribution"`
  18. Isfolder int `form:"isfolder" json:"isfolder"`
  19. CreateTime string `form:"createTime" json:"createTime"`
  20. UpdateTime string `form:"updateTime" json:"updateTime"`
  21. TargetFolderId string `form:"targetFolderId" json:"targetFolderId"`
  22. Ancounts int `form:"ancounts" json:"ancounts"`
  23. Csrf string `form:"csrf" json:"csrf"`
  24. // Leaf bool `json:"leaf" `
  25. HasFolder bool `json:"hasFolder" `
  26. IsBid bool `json:"isBid" `
  27. IsEnd bool `json:"isEnd"`
  28. ChildsTotal int `json:"childsTotal"`
  29. Children []*TreeContract `json:"children"`
  30. }
  31. func (l TreeContract) Validate() error {
  32. return validation.ValidateStruct(&l,
  33. validation.Field(&l.Id, validation.Required.Error("文件夹ID不能为空")),
  34. validation.Field(&l.Name, validation.Required.Error("文件夹名称不能为空"), validation.Length(1, 60).Error("最多 15 个字符")),
  35. )
  36. }