menu_entity.go 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package menu
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table sys_menu.
  10. type Entity struct {
  11. Id int `orm:"id,primary" json:"id"` // 主键
  12. ParentId int `orm:"parent_id" json:"parentId"` // 父id
  13. Name string `orm:"name" json:"name"` // 名称/11111
  14. Icon string `orm:"icon" json:"icon"` // 菜单图标
  15. Urlkey string `orm:"urlkey" json:"urlkey"` // 菜单key
  16. Url string `orm:"url" json:"url"` // 链接地址
  17. Perms string `orm:"perms" json:"perms"` // 授权(多个用逗号分隔,如:user:list,user:create)
  18. Status int `orm:"status" json:"status"` // 状态//radio/2,隐藏,1,显示
  19. Type int `orm:"type" json:"type"` // 类型//select/1,目录,2,菜单,3,按钮
  20. Sort int `orm:"sort" json:"sort"` // 排序
  21. Level int `orm:"level" json:"level"` // 级别
  22. Enable int `orm:"enable" json:"enable"` // 是否启用//radio/1,启用,2,禁用
  23. UpdateTime string `orm:"update_time" json:"updateTime"` // 更新时间
  24. UpdateId int `orm:"update_id" json:"updateId"` // 更新人
  25. CreateTime string `orm:"create_time" json:"createTime"` // 创建时间
  26. CreateId int `orm:"create_id" json:"createId"` // 创建者
  27. UpdateName string `json:"updateName,omitempty" gconv:"updateName,omitempty"`
  28. CreateName string `json:"createName,omitempty" gconv:"createName,omitempty"`
  29. }
  30. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  31. // the data and where attributes for empty values.
  32. func (r *Entity) OmitEmpty() *arModel {
  33. return Model.Data(r).OmitEmpty()
  34. }
  35. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  36. func (r *Entity) Insert() (result sql.Result, err error) {
  37. return Model.Data(r).Insert()
  38. }
  39. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  40. // If there's already another same record in the table (it checks using primary key or unique index),
  41. // it deletes it and insert this one.
  42. func (r *Entity) Replace() (result sql.Result, err error) {
  43. return Model.Data(r).Replace()
  44. }
  45. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  46. // It updates the record if there's already another same record in the table
  47. // (it checks using primary key or unique index).
  48. func (r *Entity) Save() (result sql.Result, err error) {
  49. return Model.Data(r).Save()
  50. }
  51. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  52. // It updates the record if there's already another same record in the table
  53. // (it checks using primary key or unique index).
  54. func (r *Entity) Update() (result sql.Result, err error) {
  55. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  56. }
  57. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  58. func (r *Entity) Delete() (result sql.Result, err error) {
  59. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  60. }