sys_opera_log_dto.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package dto
  2. import (
  3. "cold-delivery/common/dto"
  4. common "cold-delivery/common/model"
  5. "time"
  6. "cold-delivery/app/admin/model"
  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. OperaUrl string `form:"operaUrl" search:"type:contains;column:opera_url;table:sys_opera_log" comment:"访问地址"`
  18. OperaIp string `form:"operaIp" search:"type:exact;column:opera_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. OperaName string `json:"operaName" comment:"操作者"`
  39. DeptName string `json:"organName" comment:"机构名称"`
  40. OperaUrl string `json:"operaUrl" comment:"访问地址"`
  41. OperaIp string `json:"operaIp" comment:"客户端ip"`
  42. OperaLocation string `json:"operaLocation" comment:"访问位置"`
  43. OperaParam string `json:"operaParam" comment:"请求参数"`
  44. Status string `json:"status" comment:"操作状态"`
  45. OperaTime time.Time `json:"operaTime" 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() (*model.SysOperaLog, error) {
  52. return &model.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. OperaName: s.OperaName,
  61. DeptName: s.DeptName,
  62. OperaUrl: s.OperaUrl,
  63. OperaIp: s.OperaIp,
  64. OperaLocation: s.OperaLocation,
  65. OperaParam: s.OperaParam,
  66. Status: s.Status,
  67. OperaTime: s.OperaTime,
  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. common.ControlBy `swaggerignore:"true"`
  87. }
  88. func (s *SysOperaLogDeleteReq) GetId() interface{} {
  89. return s.Ids
  90. }