sys_opera_log.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package dto
  2. import (
  3. "time"
  4. "go-admin/app/admin/models"
  5. "go-admin/common/dto"
  6. common "go-admin/common/models"
  7. )
  8. const (
  9. OperaStatusEnabel = "1" // 状态-正常
  10. OperaStatusDisable = "2" // 状态-关闭
  11. )
  12. type SysOperaLogGetPageReq struct {
  13. dto.Pagination `search:"-"`
  14. Title string `form:"title" search:"type:contains;column:title;table:sys_opera_log" comment:"操作模块"`
  15. Method string `form:"method" search:"type:contains;column:method;table:sys_opera_log" comment:"函数"`
  16. RequestMethod string `form:"requestMethod" search:"type:contains;column:request_method;table:sys_opera_log" comment:"请求方式: GET POST PUT DELETE"`
  17. OperUrl string `form:"operUrl" search:"type:contains;column:oper_url;table:sys_opera_log" comment:"访问地址"`
  18. OperIp string `form:"operIp" search:"type:exact;column:oper_ip;table:sys_opera_log" comment:"客户端ip"`
  19. Status int `form:"status" search:"type:exact;column:status;table:sys_opera_log" comment:"状态 1:正常 2:关闭"`
  20. BeginTime string `form:"beginTime" search:"type:gte;column:created_at;table:sys_opera_log" comment:"创建时间"`
  21. EndTime string `form:"endTime" search:"type:lte;column:created_at;table:sys_opera_log" comment:"更新时间"`
  22. SysOperaLogOrder
  23. }
  24. type SysOperaLogOrder struct {
  25. CreatedAtOrder string `search:"type:order;column:created_at;table:sys_opera_log" form:"createdAtOrder"`
  26. }
  27. func (m *SysOperaLogGetPageReq) GetNeedSearch() interface{} {
  28. return *m
  29. }
  30. type SysOperaLogControl struct {
  31. ID int `uri:"Id" comment:"编码"` // 编码
  32. Title string `json:"title" comment:"操作模块"`
  33. BusinessType string `json:"businessType" comment:"操作类型"`
  34. BusinessTypes string `json:"businessTypes" comment:""`
  35. Method string `json:"method" comment:"函数"`
  36. RequestMethod string `json:"requestMethod" comment:"请求方式"`
  37. OperatorType string `json:"operatorType" comment:"操作类型"`
  38. OperName string `json:"operName" comment:"操作者"`
  39. DeptName string `json:"deptName" comment:"部门名称"`
  40. OperUrl string `json:"operUrl" comment:"访问地址"`
  41. OperIp string `json:"operIp" comment:"客户端ip"`
  42. OperLocation string `json:"operLocation" comment:"访问位置"`
  43. OperParam string `json:"operParam" comment:"请求参数"`
  44. Status string `json:"status" comment:"操作状态"`
  45. OperTime time.Time `json:"operTime" comment:"操作时间"`
  46. JsonResult string `json:"jsonResult" comment:"返回数据"`
  47. Remark string `json:"remark" comment:"备注"`
  48. LatencyTime string `json:"latencyTime" comment:"耗时"`
  49. UserAgent string `json:"userAgent" comment:"ua"`
  50. }
  51. func (s *SysOperaLogControl) Generate() (*models.SysOperaLog, error) {
  52. return &models.SysOperaLog{
  53. Model: common.Model{Id: s.ID},
  54. Title: s.Title,
  55. BusinessType: s.BusinessType,
  56. BusinessTypes: s.BusinessTypes,
  57. Method: s.Method,
  58. RequestMethod: s.RequestMethod,
  59. OperatorType: s.OperatorType,
  60. OperName: s.OperName,
  61. DeptName: s.DeptName,
  62. OperUrl: s.OperUrl,
  63. OperIp: s.OperIp,
  64. OperLocation: s.OperLocation,
  65. OperParam: s.OperParam,
  66. Status: s.Status,
  67. OperTime: s.OperTime,
  68. JsonResult: s.JsonResult,
  69. Remark: s.Remark,
  70. LatencyTime: s.LatencyTime,
  71. UserAgent: s.UserAgent,
  72. }, nil
  73. }
  74. func (s *SysOperaLogControl) GetId() interface{} {
  75. return s.ID
  76. }
  77. type SysOperaLogGetReq struct {
  78. Id int `uri:"id"`
  79. }
  80. func (s *SysOperaLogGetReq) GetId() interface{} {
  81. return s.Id
  82. }
  83. // SysOperaLogDeleteReq 功能删除请求参数
  84. type SysOperaLogDeleteReq struct {
  85. Ids []int `json:"ids"`
  86. }
  87. func (s *SysOperaLogDeleteReq) GetId() interface{} {
  88. return s.Ids
  89. }