User.go 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package domain
  2. //=============| 用户与权限 |================
  3. type User struct {
  4. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 用户Id,主键,自增长
  5. Name string `json:"name" xorm:"'name' notnull"` // 用户名,非空
  6. Username string `json:"username" xorm:"'username' unique notnull"` // 用户账号,唯一,非空
  7. Password string `json:"password" xorm:"'password' notnull"` // 用户密码,非空
  8. Email string `json:"email" xorm:"'email' notnull"` // 用户邮箱,非空
  9. Phone string `json:"phone" xorm:"'phone' notnull"` // 用户手机,非空
  10. Status int64 `json:"status" xorm:"'status' notnull"` // 用户状态,非空
  11. CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  12. UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  13. Role string `json:"role" xorm:"'role' notnull"` // 用户角色,非空
  14. }
  15. //type UserRole struct {
  16. // Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 用户角色Id,主键,自增长
  17. // UserId int64 `json:"userId" xorm:"'user_id' notnull"` // 用户Id,非空
  18. // RoleId int64 `json:"roleId" xorm:"'role_id' notnull"` // 角色Id,非空
  19. // CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  20. // UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  21. // Role string `json:"role" xorm:"'role' notnull"` // 角色,非空
  22. //}
  23. //
  24. //type Role struct {
  25. // Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 角色Id,主键,自增长
  26. // Name string `json:"name" xorm:"'name' notnull"` // 角色名称,非空
  27. // CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  28. // UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  29. //}
  30. //
  31. //type RoleMenu struct {
  32. // Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 角色菜单Id,主键,自增长
  33. // RoleId int64 `json:"roleId" xorm:"'role_id' notnull"` // 角色Id,非空
  34. // MenuId int64 `json:"menuId" xorm:"'menu_id' notnull"` // 菜单Id,非空
  35. // CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  36. // UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  37. // Menu string `json:"menu" xorm:"'menu' notnull"` // 菜单,非空
  38. //}
  39. //
  40. //type Menu struct {
  41. // Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 菜单Id,主键,自增长
  42. // Name string `json:"name" xorm:"'name' notnull"` // 菜单名称,非空
  43. // Url string `json:"url" xorm:"'url' notnull"` // 菜单URL,非空
  44. // CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  45. // UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  46. //}
  47. //=============| 文件管理 |================
  48. type FileUser struct {
  49. TransactionId string `json:"transactionId" xorm:"pk 'transaction_id'"`
  50. UserId int64 `json:"id" xorm:"pk autoincr 'id'"`
  51. }
  52. type File struct {
  53. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 文件Id,主键,自增长
  54. Name string `json:"name" xorm:"'name' notnull"` // 文件名,非空
  55. Url string `json:"url" xorm:"'url' notnull"` // 文件URL,非空
  56. Size int64 `json:"size" xorm:"'size' notnull"` // 文件大小,非空
  57. Type string `json:"type" xorm:"'type' notnull"` // 文件类型,非空
  58. MD5 string `json:"md5" xorm:"'md5' notnull"` // 文件MD5,非空
  59. TransactionId string `json:"transactionId" xorm:"'transaction_id' notnull"` // 事务Id,非空
  60. Extension string `json:"extension" xorm:"'extension' notnull"` // 文件扩展名,非空
  61. Access FileAccess `json:"access" ` // 文件访问权限,非空 xorm:"'access' notnull"
  62. CreateUser int64 `json:"createUser" xorm:"'create_user' notnull"` // 创建用户Id,非空
  63. CreateTime int64 `json:"createTime" xorm:"create_time"` // 创建时间,自动填充
  64. UpdateTime int64 `json:"updateTime" xorm:"update_time"` // 更新时间,自动填充
  65. AccessTime int64 `json:"accessTime" xorm:"access_time"` // 更新时间,自动填充
  66. Children []File `json:"children"` // 子文件
  67. }
  68. type FileAccess struct {
  69. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 文件访问记录Id,主键,自增长
  70. FileId int64 `json:"fileId" xorm:"'file_id' notnull"` // 文件Id,非空
  71. CreateId int64 `json:"createId" xorm:"'create_id' notnull"` // 创建人,非空
  72. AccessReadUserId string `json:"accessReadUserId" xorm:"'access_read_user_id'"` // 可读用户Id
  73. AccessWriteUserId string `json:"accessWriteUserId" xorm:"'access_write_user_id'"` // 可写用户Id
  74. AccessDeleteUserId string `json:"accessDeleteUserId" xorm:"'access_delete_user_id'"` // 可删用户Id
  75. CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  76. }