Skip to content

Commit

Permalink
page改为pagequery查询
Browse files Browse the repository at this point in the history
baowk committed Nov 9, 2023
1 parent 1cc28cd commit cd736ef
Showing 8 changed files with 411 additions and 350 deletions.
3 changes: 2 additions & 1 deletion docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ go 1.20
require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
github.com/aws/aws-sdk-go v1.44.319
github.com/baowk/dilu-core v0.1.5
github.com/baowk/dilu-core v0.1.8
github.com/fsnotify/fsnotify v1.6.0
github.com/gin-gonic/gin v1.9.1
github.com/golang-jwt/jwt/v5 v5.0.0
2 changes: 1 addition & 1 deletion modules/sys/apis/sys_opera_log.go
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ func (e *SysOperaLogApi) QueryPage(c *gin.Context) {
req.SortOrder = "desc"
}

if err := service.SerSysOperaLog.Page(req, &list, &total, req.GetSize(), req.GetOffset()); err != nil {
if err := service.SerSysOperaLog.QueryPage(req, &list, &total, req.GetSize(), req.GetOffset()); err != nil {
e.Error(c, err)
return
}
60 changes: 28 additions & 32 deletions modules/sys/models/sys_opera_log.go
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
package models

import (

"time"

"time"
)

//操作日志
// 操作日志
type SysOperaLog struct {

Id int `json:"id" gorm:"type:int unsigned;primaryKey;autoIncrement;comment:主键"` //主键
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` //操作模块
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` //操作类型
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` //BusinessTypes
Method string `json:"method" gorm:"type:varchar(128);comment:函数"` //函数
RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式 GET POST PUT DELETE"` //请求方式 GET POST PUT DELETE
OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"` //操作类型
OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"` //操作者
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"` //部门名称
OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"` //访问地址
OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"` //客户端ip
OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"` //访问位置
OperParam string `json:"operParam" gorm:"type:longtext;comment:请求参数"` //请求参数
Status int `json:"status" gorm:"type:tinyint;comment:操作状态 1:成功 2:失败"` //操作状态 1:成功 2:失败
OperTime time.Time `json:"operTime" gorm:"type:datetime(3);comment:操作时间"` //操作时间
JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"` //返回数据
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //备注
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` //耗时
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` //ua
CreatedAt time.Time `json:"createdAt" gorm:"type:datetime(3);comment:创建时间"` //创建时间
UpdatedAt time.Time `json:"updatedAt" gorm:"type:datetime(3);comment:最后更新时间"` //最后更新时间
CreateBy int `json:"createBy" gorm:"type:int unsigned;comment:创建者"` //创建者
UpdateBy int `json:"updateBy" gorm:"type:int unsigned;comment:更新者"` //更新者
Id int `json:"id" gorm:"type:int unsigned;primaryKey;autoIncrement;comment:主键"` //主键
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` //操作模块
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` //操作类型
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` //BusinessTypes
Method string `json:"method" gorm:"type:varchar(128);comment:函数"` //函数
RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式 GET POST PUT DELETE"` //请求方式 GET POST PUT DELETE
OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"` //操作类型
OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"` //操作者
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"` //部门名称
OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"` //访问地址
OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"` //客户端ip
OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"` //访问位置
OperParam string `json:"operParam" gorm:"type:longtext;comment:请求参数"` //请求参数
Status int `json:"status" gorm:"type:tinyint;comment:操作状态 1:成功 2:失败"` //操作状态 1:成功 2:失败
OperTime time.Time `json:"operTime" gorm:"type:datetime(3);comment:操作时间"` //操作时间
JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"` //返回数据
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //备注
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` //耗时
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` //ua
CreatedAt time.Time `json:"createdAt" gorm:"type:datetime(3);comment:创建时间"` //创建时间
UpdatedAt time.Time `json:"updatedAt" gorm:"type:datetime(3);comment:最后更新时间"` //最后更新时间
CreateBy int `json:"createBy" gorm:"type:int unsigned;comment:创建者"` //创建者
UpdateBy int `json:"updateBy" gorm:"type:int unsigned;comment:更新者"` //更新者
}

const TBSysOperaLog = "sys_opera_log"

func (SysOperaLog) TableName() string {
return TBSysOperaLog
return TBSysOperaLog
}

func NewSysOperaLog() *SysOperaLog{
return &SysOperaLog{}
func NewSysOperaLog() *SysOperaLog {
return &SysOperaLog{}
}

25 changes: 11 additions & 14 deletions modules/sys/service/dto/sys_api.go
Original file line number Diff line number Diff line change
@@ -5,21 +5,18 @@ import (
)

type SysApiGetPageReq struct {
base.ReqPage `search:"-"`
Status int `form:"status" search:"type:exact;column:status;table:sys_api" comment:"状态 3 DEF 2 OK 1 del"` //状态 3 DEF 2 OK 1 del
base.ReqPage `query:"-"`
Status int `form:"status" query:"type:eq;column:status;table:sys_api"` //状态 3 DEF 2 OK 1 del
}

//接口列表
// 接口列表
type SysApiDto struct {
base.Model

Title string `json:"title"` //标题
Method string `json:"method"` //请求类型
Path string `json:"path"` //请求地址
Type string `json:"type"` //接口类型
PermType string `json:"permType"` //权限类型(n:无需任何认证 t:须token p:须权限)
Status int `json:"status"` //状态 3 DEF 2 OK 1 del
}


base.Model

Title string `json:"title"` //标题
Method string `json:"method"` //请求类型
Path string `json:"path"` //请求地址
Type string `json:"type"` //接口类型
PermType string `json:"permType"` //权限类型(n:无需任何认证 t:须token p:须权限)
Status int `json:"status"` //状态 3 DEF 2 OK 1 del
}
4 changes: 2 additions & 2 deletions resources/config.dev.yaml
Original file line number Diff line number Diff line change
@@ -27,15 +27,15 @@ cache: # 缓存配置
db: 5 # Redis数据库索引
dbcfg: # 数据库配置
driver: mysql
dns: root:12345678@tcp(127.0.0.1:3306)/dilu-db?charset=utf8&parseTime=True&loc=Local&timeout=1000ms # 数据库连接字符串
dns: root:123456@tcp(127.0.0.1:3306)/dilu-db?charset=utf8&parseTime=True&loc=Local&timeout=1000ms # 数据库连接字符串
log-mode: info #日志类型 GORM 定义了这些日志级别:silent、error、warn、info
#slow-threshold: 200 #慢日志
#max-idle-conns: 20 #最大空闲连接数 默认10
#max-open-conns: 60 #最大打开数
# prefix: 日志前缀
dbs:
- dental: #子配置会继承父配置
dns: root:12345678@tcp(127.0.0.1:3306)/dental-db?charset=utf8&parseTime=True&loc=Local&timeout=1000ms # 数据库连接字符串
dns: root:123456@tcp(127.0.0.1:3306)/dental-db?charset=utf8&parseTime=True&loc=Local&timeout=1000ms # 数据库连接字符串
# disable: true
# driver: mysql
# prefix: 日志前缀
Loading

0 comments on commit cd736ef

Please sign in to comment.