sys_post_entity.go 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package sys_post
  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_post.
  11. type Entity struct {
  12. PostId int64 `orm:"post_id,primary" json:"post_id"` // 岗位ID
  13. PostCode string `orm:"post_code" json:"post_code"` // 岗位编码
  14. PostName string `orm:"post_name" json:"post_name"` // 岗位名称
  15. PostSort int `orm:"post_sort" json:"post_sort"` // 显示顺序
  16. Status string `orm:"status" json:"status"` // 状态(0正常 1停用)
  17. CreateBy string `orm:"create_by" json:"create_by"` // 创建者
  18. CreateTime *gtime.Time `orm:"create_time" json:"create_time"` // 创建时间
  19. UpdateBy string `orm:"update_by" json:"update_by"` // 更新者
  20. UpdateTime *gtime.Time `orm:"update_time" json:"update_time"` // 更新时间
  21. Remark string `orm:"remark" json:"remark"` // 备注
  22. }
  23. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  24. // the data and where attributes for empty values.
  25. func (r *Entity) OmitEmpty() *arModel {
  26. return Model.Data(r).OmitEmpty()
  27. }
  28. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  29. func (r *Entity) Insert() (result sql.Result, err error) {
  30. return Model.Data(r).Insert()
  31. }
  32. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  33. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  34. return Model.Data(r).InsertIgnore()
  35. }
  36. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  37. // If there's already another same record in the table (it checks using primary key or unique index),
  38. // it deletes it and insert this one.
  39. func (r *Entity) Replace() (result sql.Result, err error) {
  40. return Model.Data(r).Replace()
  41. }
  42. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  43. // It updates the record if there's already another same record in the table
  44. // (it checks using primary key or unique index).
  45. func (r *Entity) Save() (result sql.Result, err error) {
  46. return Model.Data(r).Save()
  47. }
  48. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  49. // It updates the record if there's already another same record in the table
  50. // (it checks using primary key or unique index).
  51. func (r *Entity) Update() (result sql.Result, err error) {
  52. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  53. }
  54. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  55. func (r *Entity) Delete() (result sql.Result, err error) {
  56. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  57. }