sys_dept_entity.go 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package sys_dept
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. "github.com/gogf/gf/os/gtime"
  9. )
  10. // Entity is the golang structure for table sys_dept.
  11. type Entity struct {
  12. DeptId int64 `orm:"dept_id,primary" json:"dept_id"` // 部门id
  13. ParentId int64 `orm:"parent_id" json:"parent_id"` // 父部门id
  14. Ancestors string `orm:"ancestors" json:"ancestors"` // 祖级列表
  15. DeptName string `orm:"dept_name" json:"dept_name"` // 部门名称
  16. OrderNum int `orm:"order_num" json:"order_num"` // 显示顺序
  17. Leader string `orm:"leader" json:"leader"` // 负责人
  18. Phone string `orm:"phone" json:"phone"` // 联系电话
  19. Email string `orm:"email" json:"email"` // 邮箱
  20. Status string `orm:"status" json:"status"` // 部门状态(0正常 1停用)
  21. DelFlag string `orm:"del_flag" json:"del_flag"` // 删除标志(0代表存在 2代表删除)
  22. CreateBy string `orm:"create_by" json:"create_by"` // 创建者
  23. CreateTime *gtime.Time `orm:"create_time" json:"create_time"` // 创建时间
  24. UpdateBy string `orm:"update_by" json:"update_by"` // 更新者
  25. UpdateTime *gtime.Time `orm:"update_time" json:"update_time"` // 更新时间
  26. }
  27. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  28. // the data and where attributes for empty values.
  29. func (r *Entity) OmitEmpty() *arModel {
  30. return Model.Data(r).OmitEmpty()
  31. }
  32. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  33. func (r *Entity) Insert() (result sql.Result, err error) {
  34. return Model.Data(r).Insert()
  35. }
  36. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  37. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  38. return Model.Data(r).InsertIgnore()
  39. }
  40. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  41. // If there's already another same record in the table (it checks using primary key or unique index),
  42. // it deletes it and insert this one.
  43. func (r *Entity) Replace() (result sql.Result, err error) {
  44. return Model.Data(r).Replace()
  45. }
  46. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  47. // It updates the record if there's already another same record in the table
  48. // (it checks using primary key or unique index).
  49. func (r *Entity) Save() (result sql.Result, err error) {
  50. return Model.Data(r).Save()
  51. }
  52. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  53. // It updates the record if there's already another same record in the table
  54. // (it checks using primary key or unique index).
  55. func (r *Entity) Update() (result sql.Result, err error) {
  56. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  57. }
  58. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  59. func (r *Entity) Delete() (result sql.Result, err error) {
  60. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  61. }