Files
mayfly-go/server/internal/db/api/db_sql_exec.go

29 lines
732 B
Go
Raw Normal View History

package api
import (
2022-09-09 18:26:08 +08:00
"mayfly-go/internal/db/application"
"mayfly-go/internal/db/domain/entity"
"mayfly-go/pkg/biz"
2023-01-14 16:29:52 +08:00
"mayfly-go/pkg/req"
"mayfly-go/pkg/utils/collx"
"mayfly-go/pkg/utils/conv"
"strings"
)
type DbSqlExec struct {
2024-01-21 22:52:20 +08:00
DbSqlExecApp application.DbSqlExec `inject:""`
}
2023-01-14 16:29:52 +08:00
func (d *DbSqlExec) DbSqlExecs(rc *req.Ctx) {
queryCond, page := req.BindQueryAndPage(rc, new(entity.DbSqlExecQuery))
if statusStr := rc.Query("status"); statusStr != "" {
queryCond.Status = collx.ArrayMap[string, int8](strings.Split(statusStr, ","), func(val string) int8 {
return int8(conv.Str2Int(val, 0))
})
}
res, err := d.DbSqlExecApp.GetPageList(queryCond, page, new([]entity.DbSqlExec))
biz.ErrIsNil(err)
rc.ResData = res
}