sys_oper_log.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/v2/database/gdb"
  8. "github.com/gogf/gf/v2/frame/g"
  9. )
  10. // SysOperLogDao is the data access object for table sys_oper_log.
  11. type SysOperLogDao struct {
  12. table string // table is the underlying table name of the DAO.
  13. group string // group is the database configuration group name of current DAO.
  14. columns SysOperLogColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // SysOperLogColumns defines and stores column names for table sys_oper_log.
  17. type SysOperLogColumns struct {
  18. OperId string // 日志主键
  19. Title string // 模块标题
  20. BusinessType string // 业务类型(0其它 1新增 2修改 3删除)
  21. Method string // 方法名称
  22. RequestMethod string // 请求方式
  23. OperatorType string // 操作类别(0其它 1后台用户 2手机端用户)
  24. OperName string // 操作人员
  25. DeptName string // 部门名称
  26. OperUrl string // 请求URL
  27. OperIp string // 主机地址
  28. OperLocation string // 操作地点
  29. OperParam string // 请求参数
  30. ErrorMsg string // 错误消息
  31. OperTime string // 操作时间
  32. }
  33. // sysOperLogColumns holds the columns for table sys_oper_log.
  34. var sysOperLogColumns = SysOperLogColumns{
  35. OperId: "oper_id",
  36. Title: "title",
  37. BusinessType: "business_type",
  38. Method: "method",
  39. RequestMethod: "request_method",
  40. OperatorType: "operator_type",
  41. OperName: "oper_name",
  42. DeptName: "dept_name",
  43. OperUrl: "oper_url",
  44. OperIp: "oper_ip",
  45. OperLocation: "oper_location",
  46. OperParam: "oper_param",
  47. ErrorMsg: "error_msg",
  48. OperTime: "oper_time",
  49. }
  50. // NewSysOperLogDao creates and returns a new DAO object for table data access.
  51. func NewSysOperLogDao() *SysOperLogDao {
  52. return &SysOperLogDao{
  53. group: "default",
  54. table: "sys_oper_log",
  55. columns: sysOperLogColumns,
  56. }
  57. }
  58. // DB retrieves and returns the underlying raw database management object of current DAO.
  59. func (dao *SysOperLogDao) DB() gdb.DB {
  60. return g.DB(dao.group)
  61. }
  62. // Table returns the table name of current dao.
  63. func (dao *SysOperLogDao) Table() string {
  64. return dao.table
  65. }
  66. // Columns returns all column names of current dao.
  67. func (dao *SysOperLogDao) Columns() SysOperLogColumns {
  68. return dao.columns
  69. }
  70. // Group returns the configuration group name of database of current dao.
  71. func (dao *SysOperLogDao) Group() string {
  72. return dao.group
  73. }
  74. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  75. func (dao *SysOperLogDao) Ctx(ctx context.Context) *gdb.Model {
  76. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  77. }
  78. // Transaction wraps the transaction logic using function f.
  79. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  80. // It commits the transaction and returns nil if function f returns nil.
  81. //
  82. // Note that, you should not Commit or Rollback the transaction in function f
  83. // as it is automatically handled by this function.
  84. func (dao *SysOperLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  85. return dao.Ctx(ctx).Transaction(ctx, f)
  86. }