log_entity.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package log
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table sys_log.
  10. type Entity struct {
  11. Id int `orm:"id,primary" json:"id"` // 主键
  12. LogType int `orm:"log_type" json:"logType"` // 类型
  13. OperObject string `orm:"oper_object" json:"operObject"` // 操作对象
  14. OperTable string `orm:"oper_table" json:"operTable"` // 操作表
  15. OperId int `orm:"oper_id" json:"operId"` // 操作主键
  16. OperType string `orm:"oper_type" json:"operType"` // 操作类型
  17. OperRemark string `orm:"oper_remark" json:"operRemark"` // 操作备注
  18. Enable int `orm:"enable" json:"enable"` // 是否启用//radio/1,启用,2,禁用
  19. UpdateTime string `orm:"update_time" json:"updateTime"` // 更新时间
  20. UpdateId int `orm:"update_id" json:"updateId"` // 更新人
  21. CreateTime string `orm:"create_time" json:"createTime"` // 创建时间
  22. CreateId int `orm:"create_id" json:"createId"` // 创建者
  23. UpdateName string `json:"updateName,omitempty" gconv:"updateName,omitempty"`
  24. CreateName string `json:"createName,omitempty" gconv:"createName,omitempty"`
  25. }
  26. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  27. // the data and where attributes for empty values.
  28. func (r *Entity) OmitEmpty() *arModel {
  29. return Model.Data(r).OmitEmpty()
  30. }
  31. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  32. func (r *Entity) Insert() (result sql.Result, err error) {
  33. return Model.Data(r).Insert()
  34. }
  35. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  36. // If there's already another same record in the table (it checks using primary key or unique index),
  37. // it deletes it and insert this one.
  38. func (r *Entity) Replace() (result sql.Result, err error) {
  39. return Model.Data(r).Replace()
  40. }
  41. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  42. // It updates the record if there's already another same record in the table
  43. // (it checks using primary key or unique index).
  44. func (r *Entity) Save() (result sql.Result, err error) {
  45. return Model.Data(r).Save()
  46. }
  47. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  48. // It updates the record if there's already another same record in the table
  49. // (it checks using primary key or unique index).
  50. func (r *Entity) Update() (result sql.Result, err error) {
  51. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  52. }
  53. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  54. func (r *Entity) Delete() (result sql.Result, err error) {
  55. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  56. }