safe.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package viewmodels
  2. /*
  3. * @description: 安全巡检
  4. * @Author: LanJianRong
  5. * @Date: 2020-11-18
  6. * @FilePath: \construction_management\web\viewmodels\project.go
  7. */
  8. import (
  9. validation "github.com/go-ozzo/ozzo-validation/v3"
  10. "go.mod/models"
  11. )
  12. type Safe struct {
  13. Id string `form:"id" json:"id" `
  14. BidsectionId string `form:"bidsectionId" json:"bidsectionId"`
  15. Uid string `form:"uid" json:"uid" `
  16. Code string `form:"code" json:"code"`
  17. CreateTime string `form:"createTime" json:"createTime"`
  18. EndTime string `form:"endTime" json:"endTime"`
  19. Position string `form:"position" json:"position"`
  20. Inspection string `form:"inspection" json:"inspection"`
  21. InspectionDetail string `form:"inspectionDetail" json:"inspectionDetail"`
  22. Demand string `form:"demand" json:"demand"`
  23. Status int `form:"status" json:"status"`
  24. }
  25. type SafeList struct {
  26. Id string `form:"id" json:"id" `
  27. Code string `form:"code" json:"code"`
  28. CreateTime string `form:"createTime" json:"createTime"`
  29. Position string `form:"position" json:"position"`
  30. Inspection string `form:"inspection" json:"inspection"`
  31. InspectionDetail string `form:"inspectionDetail" json:"inspectionDetail"`
  32. Demand string `form:"demand" json:"demand"`
  33. Status int `form:"status" json:"status"`
  34. AuditName string `form:"auditName" json:"auditName"`
  35. FileCounts int64 `from:"fileCounts" json:"fileCounts"`
  36. }
  37. type SafeDetail struct {
  38. Id string `form:"id" json:"id" `
  39. BidsectionId string `form:"bidsectionId" json:"bidsectionId"`
  40. Code string `form:"code" json:"code"`
  41. CreateTime string `form:"createTime" json:"createTime"`
  42. Position string `form:"position" json:"position"`
  43. Inspection string `form:"inspection" json:"inspection"`
  44. InspectionDetail string `form:"inspectionDetail" json:"inspectionDetail"`
  45. Demand string `form:"demand" json:"demand"`
  46. Status int `form:"status" json:"status"`
  47. AuditName string `form:"auditName" json:"auditName"`
  48. FileList []models.CmSafeFile `form:"files" json:"files"`
  49. Auditors []Auditors `form:"auditors" json:"auditors"`
  50. auditorHistory []models.CmSafeAudit `form:"auditorHistory" json:"auditorHistory"`
  51. }
  52. type Auditors struct {
  53. Name string
  54. }
  55. type SafeListAuditRecord struct {
  56. Name string `form:"name" json:"name"`
  57. CreateTime string `form:"create_time" json:"create_time"`
  58. }
  59. func (l Safe) ValidateList() error {
  60. return validation.ValidateStruct(&l,
  61. validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
  62. )
  63. }
  64. func (l Safe) ValidateCreate() error {
  65. return validation.ValidateStruct(&l,
  66. validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
  67. validation.Field(&l.CreateTime, validation.Required.Error("日期不能为空")),
  68. validation.Field(&l.Code, validation.Required.Error("编号不能为空")),
  69. validation.Field(&l.Position, validation.Required.Error("检查部位不能为空")),
  70. validation.Field(&l.Inspection, validation.Required.Error("检查项目不能为空")),
  71. )
  72. }
  73. func (l Safe) ValidateDelete() error {
  74. return validation.ValidateStruct(&l,
  75. validation.Field(&l.Id, validation.Required.Error("检查项目不能为空")),
  76. )
  77. }