Domain.go 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package entity
  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. type Role struct {
  24. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 角色Id,主键,自增长
  25. Name string `json:"name" xorm:"'name' notnull"` // 角色名称,非空
  26. CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  27. UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  28. }
  29. type RoleMenu struct {
  30. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 角色菜单Id,主键,自增长
  31. RoleId int64 `json:"roleId" xorm:"'role_id' notnull"` // 角色Id,非空
  32. MenuId int64 `json:"menuId" xorm:"'menu_id' notnull"` // 菜单Id,非空
  33. CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  34. UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  35. Menu string `json:"menu" xorm:"'menu' notnull"` // 菜单,非空
  36. }
  37. type Menu struct {
  38. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 菜单Id,主键,自增长
  39. Name string `json:"name" xorm:"'name' notnull"` // 菜单名称,非空
  40. Url string `json:"url" xorm:"'url' notnull"` // 菜单URL,非空
  41. CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  42. UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  43. }
  44. //=============| 文件管理 |================
  45. type File struct {
  46. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 文件Id,主键,自增长
  47. Name string `json:"name" xorm:"'name' notnull"` // 文件名,非空
  48. Url string `json:"url" xorm:"'url' notnull"` // 文件URL,非空
  49. Size int64 `json:"size" xorm:"'size' notnull"` // 文件大小,非空
  50. Type string `json:"type" xorm:"'type' notnull"` // 文件类型,非空
  51. MD5 string `json:"md5" xorm:"'md5' notnull"` // 文件MD5,非空
  52. ParentId string `json:"parentId" xorm:"'parent_id' notnull"` // 父级Id,非空
  53. Extension string `json:"extension" xorm:"'extension' notnull"` // 文件扩展名,非空
  54. Access string `json:"access" xorm:"'access' notnull"` // 文件访问权限,非空
  55. CreateUser int64 `json:"createUser" xorm:"'create_user' notnull"` // 创建用户Id,非空
  56. CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  57. UpdateTime int64 `json:"updateTime" xorm:"updated"` // 更新时间,自动填充
  58. }
  59. type FileAccess struct {
  60. Id int64 `json:"id" xorm:"pk autoincr 'id'"` // 文件访问记录Id,主键,自增长
  61. FileId int64 `json:"fileId" xorm:"'file_id' notnull"` // 文件Id,非空
  62. CreateId int64 `json:"createId" xorm:"'create_id' notnull"` // 创建人,非空
  63. AccessReadUserId string `json:"accessReadUserId" xorm:"'access_read_user_id'"` // 可读用户Id
  64. AccessWriteUserId string `json:"accessWriteUserId" xorm:"'access_write_user_id'"` // 可写用户Id
  65. AccessDeleteUserId string `json:"accessDeleteUserId" xorm:"'access_delete_user_id'"` // 可删用户Id
  66. CreateTime int64 `json:"createTime" xorm:"created"` // 创建时间,自动填充
  67. }