user_entity.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package user
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table sys_user.
  10. type Entity struct {
  11. Id int `orm:"id,primary" json:"id"` // 主键
  12. Uuid string `orm:"uuid" json:"uuid"` // UUID
  13. Username string `orm:"username,unique" json:"username"` // 登录名/11111
  14. Password string `orm:"password" json:"password"` // 密码
  15. Salt string `orm:"salt" json:"salt"` // 密码盐
  16. RealName string `orm:"real_name" json:"realName"` // 真实姓名
  17. DepartId int `orm:"depart_id" json:"departId"` // 部门/11111/dict
  18. UserType int `orm:"user_type" json:"userType"` // 类型//select/1,管理员,2,普通用户,3,前台用户,4,第三方用户,5,API用户
  19. Status int `orm:"status" json:"status"` // 状态
  20. Thirdid string `orm:"thirdid" json:"thirdid"` // 第三方ID
  21. Endtime string `orm:"endtime" json:"endtime"` // 结束时间
  22. Email string `orm:"email" json:"email"` // email
  23. Tel string `orm:"tel" json:"tel"` // 手机号
  24. Address string `orm:"address" json:"address"` // 地址
  25. TitleUrl string `orm:"title_url" json:"titleUrl"` // 头像地址
  26. Remark string `orm:"remark" json:"remark"` // 说明
  27. Theme string `orm:"theme" json:"theme"` // 主题
  28. BackSiteId int `orm:"back_site_id" json:"backSiteId"` // 后台选择站点ID
  29. CreateSiteId int `orm:"create_site_id" json:"createSiteId"` // 创建站点ID
  30. ProjectId int `orm:"project_id" json:"projectId"` // 项目ID
  31. ProjectName string `orm:"project_name" json:"projectName"` // 项目名称
  32. Enable int `orm:"enable" json:"enable"` // 是否启用//radio/1,启用,2,禁用
  33. UpdateTime string `orm:"update_time" json:"updateTime"` // 更新时间
  34. UpdateId int `orm:"update_id" json:"updateId"` // 更新人
  35. CreateTime string `orm:"create_time" json:"createTime"` // 创建时间
  36. CreateId int `orm:"create_id" json:"createId"` // 创建者
  37. DepartName string `json:"departName" gconv:"departName,omitempty"` // 项目名称
  38. UpdateName string `json:"updateName,omitempty" gconv:"updateName,omitempty"`
  39. CreateName string `json:"createName,omitempty" gconv:"createName,omitempty"`
  40. }
  41. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  42. // the data and where attributes for empty values.
  43. func (r *Entity) OmitEmpty() *arModel {
  44. return Model.Data(r).OmitEmpty()
  45. }
  46. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  47. func (r *Entity) Insert() (result sql.Result, err error) {
  48. return Model.Data(r).Insert()
  49. }
  50. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  51. // If there's already another same record in the table (it checks using primary key or unique index),
  52. // it deletes it and insert this one.
  53. func (r *Entity) Replace() (result sql.Result, err error) {
  54. return Model.Data(r).Replace()
  55. }
  56. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  57. // It updates the record if there's already another same record in the table
  58. // (it checks using primary key or unique index).
  59. func (r *Entity) Save() (result sql.Result, err error) {
  60. return Model.Data(r).Save()
  61. }
  62. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  63. // It updates the record if there's already another same record in the table
  64. // (it checks using primary key or unique index).
  65. func (r *Entity) Update() (result sql.Result, err error) {
  66. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  67. }
  68. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  69. func (r *Entity) Delete() (result sql.Result, err error) {
  70. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  71. }