go项目脚手架
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sorbet/internal/services/system/request/system_log_upsert_request.go

56 lines
1.7 KiB

1 year ago
package request
import (
"sorbet/internal/entities"
)
type SystemLogUpsertRequest struct {
ID uint `json:"id" xml:"id" form:"id" path:"id"`
Table string `json:"table" xml:"table" form:"table"`
RowID uint `json:"row_id" xml:"row_id" form:"row_id"`
Operation string `json:"operation" xml:"operation" form:"operation"`
IP string `json:"ip" xml:"ip" form:"ip"`
Comment string `json:"comment" xml:"comment" form:"comment"`
RequestID string `json:"request_id" xml:"request_id" form:"request_id"`
RequestInfo string `json:"request_info" xml:"request_info" form:"request_info"`
ColumnInfo string `json:"column_info" xml:"column_info" form:"column_info"`
UserID int64 `json:"user_id" xml:"user_id" form:"user_id"`
UserType int64 `json:"user_type" xml:"user_type" form:"user_type"`
}
func (s *SystemLogUpsertRequest) GetID() any {
return s.ID
}
func (s *SystemLogUpsertRequest) ToMap() map[string]any {
return map[string]any{
"id": s.ID,
"table": s.Table,
"row_id": s.RowID,
"operation": s.Operation,
"ip": s.IP,
"comment": s.Comment,
"request_id": s.RequestID,
"request_info": s.RequestInfo,
"column_info": s.ColumnInfo,
"user_id": s.UserID,
"user_type": s.UserType,
}
}
func (s *SystemLogUpsertRequest) ToEntity() any {
return &entities.SystemLog{
ID: s.ID,
Table: s.Table,
RowID: s.RowID,
Operation: s.Operation,
IP: s.IP,
Comment: s.Comment,
RequestID: s.RequestID,
RequestInfo: s.RequestInfo,
ColumnInfo: s.ColumnInfo,
UserID: s.UserID,
UserType: s.UserType,
}
}