business_checker_entity.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package wf_business_checker
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table wf_business_checker.
  10. type Entity struct {
  11. Id uint64 `orm:"id,primary" json:"id"` // 主键
  12. FromTable string `orm:"from_table" json:"from_table"` // 业务表名
  13. FromId uint64 `orm:"from_id" json:"from_id"` // 业务id
  14. UserId string `orm:"user_id" json:"user_id"` // 用户id
  15. DepartmentId string `orm:"department_id" json:"department_id"` // 部门id
  16. }
  17. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  18. // the data and where attributes for empty values.
  19. func (r *Entity) OmitEmpty() *arModel {
  20. return Model.Data(r).OmitEmpty()
  21. }
  22. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  23. func (r *Entity) Insert() (result sql.Result, err error) {
  24. return Model.Data(r).Insert()
  25. }
  26. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  27. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  28. return Model.Data(r).InsertIgnore()
  29. }
  30. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  31. // If there's already another same record in the table (it checks using primary key or unique index),
  32. // it deletes it and insert this one.
  33. func (r *Entity) Replace() (result sql.Result, err error) {
  34. return Model.Data(r).Replace()
  35. }
  36. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  37. // It updates the record if there's already another same record in the table
  38. // (it checks using primary key or unique index).
  39. func (r *Entity) Save() (result sql.Result, err error) {
  40. return Model.Data(r).Save()
  41. }
  42. // Update does "UPDATE...WHERE..." statement for updating current object from 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) Update() (result sql.Result, err error) {
  46. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  47. }
  48. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  49. func (r *Entity) Delete() (result sql.Result, err error) {
  50. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  51. }