project.go 3.5 KB

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