sys_opera_log.go 4.3 KB

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