project.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * @description: 项目展示项
  3. * @Author: CP
  4. * @Date: 2020-09-23 11:01:47
  5. * @FilePath: \construction_management\web\viewmodels\project.go
  6. */
  7. package viewmodels
  8. import (
  9. "fmt"
  10. validation "github.com/go-ozzo/ozzo-validation/v3"
  11. )
  12. type Project struct {
  13. Id string `form:"id" json:"id"`
  14. Code string `form:"code" json:"code"`
  15. Name string `form:"name" json:"name"`
  16. Category string `form:"category" json:"category"`
  17. StaffName string `form:"staffName" json:"staffName"`
  18. CreateTime string `form:"createTime" json:"createTime"`
  19. }
  20. type ProjectInfo struct {
  21. ProjectName string `from:"project_name" json:"projectName"`
  22. Code string `from:"code" json:"code"`
  23. CreateTime int `from:"create_time" json:"createTime"`
  24. Mobile string `from:"mobile" json:"mobile"`
  25. Name string `from:"name" json:"name"`
  26. }
  27. type ProjectPage struct {
  28. Page int `form:"page" json:"page"`
  29. Size int `form:"size" json:"size"`
  30. }
  31. func (l ProjectPage) ValidatePage() error {
  32. return validation.ValidateStruct(&l,
  33. // 字符的4倍
  34. validation.Field(&l.Page, validation.Required.Error("当前页不能为空")),
  35. validation.Field(&l.Size, validation.Required.Error("每页数量不能为空")),
  36. )
  37. }
  38. func (l Project) Validate() error {
  39. return validation.ValidateStruct(&l,
  40. // 字符的4倍
  41. validation.Field(&l.Name, validation.Required.Error("项目名称不能为空"), validation.Length(1, 512).Error("最多 128 个字")),
  42. validation.Field(&l.Code, validation.Required.Error("项目编号不能为空"), validation.Length(12, 128).Error("不得少于 3 个字")),
  43. )
  44. }
  45. func (l Project) ValidateName() error {
  46. fmt.Println(l)
  47. return validation.ValidateStruct(&l,
  48. // 字符的4倍
  49. validation.Field(&l.Name, validation.Required.Error("项目名称不能为空"), validation.Length(1, 512).Error("最多 128 个字")),
  50. )
  51. }
  52. // EnterpriseId int `xorm:"comment('企业id') INT(11)"`
  53. // UserId int `xorm:"comment('管理员id(sso用户)') INT(11)"`
  54. // UserAccount string `xorm:"comment('管理员名字(sso用户名)') VARCHAR(32)"`
  55. // CreateTime int `xorm:"comment('创建时间') INT(11)"`
  56. // MaxUser int `xorm:"comment('最大创建用户数(删除)') TINYINT(4)"`
  57. // Creator int64 `xorm:"comment('创建者') BIGINT(20)"`
  58. // Status int `xorm:"comment('项目状态') TINYINT(1)"`
  59. // Remark string `xorm:"comment('备注') VARCHAR(128)"`
  60. // ManagerId int `xorm:"comment('销售负责人') INT(11)"`
  61. // ManagerOffice int `xorm:"comment('负责人办事处') TINYINT(4)"`
  62. // Office int `xorm:"comment('办事处id(项目所属)') TINYINT(4)"`
  63. // OfficeShare string `xorm:"comment('办事处共享(office id列表') VARCHAR(1024)"`
  64. // BillId string `xorm:"comment('工程量清单id列表') VARCHAR(128)"`
  65. // ChapterId string `xorm:"comment('项目节清单id列表') VARCHAR(128)"`
  66. // StandardId int `xorm:"comment('标准清单id') TINYINT(4)"`
  67. // Valuation string `xorm:"comment('清单规范id列表(删除)') VARCHAR(128)"`
  68. // QrcodeJson string `xorm:"comment('项目二维码信息') TEXT"`
  69. // DealpayJson string `xorm:"TEXT"`
  70. // Custom int `xorm:"comment('是否是定制项目') TINYINT(1)"`
  71. // CanApi int `xorm:"comment('定制项目接口是否可用') TINYINT(1)"`
  72. // Secret string `xorm:"comment('定制项目私钥') VARCHAR(255)"`
  73. // PageShow string `xorm:"comment('前台页面或功能展示与隐藏') VARCHAR(3072)"`
  74. // PagePath string `xorm:"VARCHAR(11)"`