mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-03-22 18:05:38 +08:00
refactor: interface{} -> any
feat: 新增外链菜单
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type AuthCert interface {
|
||||
GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
Save(ac *entity.AuthCert)
|
||||
|
||||
@@ -29,7 +29,7 @@ type authCertAppImpl struct {
|
||||
authCertRepo repository.AuthCert
|
||||
}
|
||||
|
||||
func (a *authCertAppImpl) GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (a *authCertAppImpl) GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
return a.authCertRepo.GetPageList(condition, pageParam, toEntity)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ type Machine interface {
|
||||
GetById(id uint64, cols ...string) *entity.Machine
|
||||
|
||||
// 分页获取机器信息列表
|
||||
GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
// 获取机器连接
|
||||
GetCli(id uint64) *machine.Cli
|
||||
@@ -52,7 +52,7 @@ type machineAppImpl struct {
|
||||
}
|
||||
|
||||
// 分页获取机器信息列表
|
||||
func (m *machineAppImpl) GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (m *machineAppImpl) GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
return m.machineRepo.GetMachineList(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
|
||||
type MachineFile interface {
|
||||
// 分页获取机器文件信息列表
|
||||
GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
// 根据条件获取
|
||||
GetMachineFile(condition *entity.MachineFile, cols ...string) error
|
||||
@@ -67,7 +67,7 @@ type machineFileAppImpl struct {
|
||||
}
|
||||
|
||||
// 分页获取机器脚本信息列表
|
||||
func (m *machineFileAppImpl) GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (m *machineFileAppImpl) GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
return m.machineFileRepo.GetPageList(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
type MachineScript interface {
|
||||
// 分页获取机器脚本信息列表
|
||||
GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
// 根据条件获取
|
||||
GetMachineScript(condition *entity.MachineScript, cols ...string) error
|
||||
@@ -40,7 +40,7 @@ const Common_Script_Machine_Id = 9999999
|
||||
// machineScriptRepo: persistence.MachineScriptDao}
|
||||
|
||||
// 分页获取机器脚本信息列表
|
||||
func (m *machineScriptAppImpl) GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (m *machineScriptAppImpl) GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
return m.machineScriptRepo.GetPageList(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type AuthCert interface {
|
||||
GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
Insert(ac *entity.AuthCert)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type Machine interface {
|
||||
// 分页获取机器信息列表
|
||||
GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
Count(condition *entity.MachineQuery) int64
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type MachineFile interface {
|
||||
// 分页获取机器脚本信息列表
|
||||
GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
// 根据条件获取
|
||||
GetMachineFile(condition *entity.MachineFile, cols ...string) error
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type MachineScript interface {
|
||||
// 分页获取机器脚本信息列表
|
||||
GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
// 根据条件获取
|
||||
GetMachineScript(condition *entity.MachineScript, cols ...string) error
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type MachineTaskConfig interface {
|
||||
GetPageList(condition *entity.MachineTaskConfig, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
GetPageList(condition *entity.MachineTaskConfig, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult
|
||||
|
||||
// 根据条件获取
|
||||
GetBy(condition *entity.MachineTaskConfig, cols ...string) error
|
||||
|
||||
@@ -140,7 +140,7 @@ func (c *Cli) GetMachine() *Info {
|
||||
// 机器客户端连接缓存,指定时间内没有访问则会被关闭
|
||||
var cliCache = cache.NewTimedCache(constant.MachineConnExpireTime, 5*time.Second).
|
||||
WithUpdateAccessTime(true).
|
||||
OnEvicted(func(_, value interface{}) {
|
||||
OnEvicted(func(_, value any) {
|
||||
value.(*Cli).Close()
|
||||
})
|
||||
|
||||
@@ -172,7 +172,7 @@ func DeleteCli(id uint64) {
|
||||
|
||||
// 从缓存中获取客户端信息,不存在则回调获取机器信息函数,并新建
|
||||
func GetCli(machineId uint64, getMachine func(uint64) *Info) (*Cli, error) {
|
||||
cli, err := cliCache.ComputeIfAbsent(machineId, func(_ interface{}) (interface{}, error) {
|
||||
cli, err := cliCache.ComputeIfAbsent(machineId, func(_ any) (any, error) {
|
||||
me := getMachine(machineId)
|
||||
err := IfUseSshTunnelChangeIpPort(me, getMachine)
|
||||
if err != nil {
|
||||
|
||||
@@ -68,7 +68,7 @@ func TestTemplateRev(t *testing.T) {
|
||||
//next := temp[ei:]
|
||||
//key := temp[index+1 : ei-1]
|
||||
//value := SubString(str, index, UnicodeIndex(str, next))
|
||||
res := make(map[string]interface{})
|
||||
res := make(map[string]any)
|
||||
utils.ReverStrTemplate(temp, str, res)
|
||||
fmt.Println(res)
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func (rec *Recorder) WriteHeader(height, width int) {
|
||||
}
|
||||
|
||||
func (rec *Recorder) WriteData(rectype RecType, data string) {
|
||||
recData := make([]interface{}, 3)
|
||||
recData := make([]any, 3)
|
||||
recData[0] = float64(time.Since(rec.StartTime).Microseconds()) / float64(1000000)
|
||||
recData[1] = rectype
|
||||
recData[2] = data
|
||||
|
||||
@@ -13,7 +13,7 @@ func newAuthCertRepo() repository.AuthCert {
|
||||
return new(authCertRepoImpl)
|
||||
}
|
||||
|
||||
func (m *authCertRepoImpl) GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (m *authCertRepoImpl) GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
return model.GetPage(pageParam, condition, condition, toEntity)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ func newMachineRepo() repository.Machine {
|
||||
}
|
||||
|
||||
// 分页获取机器信息列表
|
||||
func (m *machineRepoImpl) GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (m *machineRepoImpl) GetMachineList(condition *entity.MachineQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
sql := "SELECT m.* FROM t_machine m WHERE 1 = 1 "
|
||||
|
||||
values := make([]interface{}, 0)
|
||||
values := make([]any, 0)
|
||||
if condition.Ip != "" {
|
||||
sql = sql + " AND m.ip LIKE ?"
|
||||
values = append(values, "%"+condition.Ip+"%")
|
||||
@@ -40,7 +40,7 @@ func (m *machineRepoImpl) GetMachineList(condition *entity.MachineQuery, pagePar
|
||||
}
|
||||
|
||||
func (m *machineRepoImpl) Count(condition *entity.MachineQuery) int64 {
|
||||
where := make(map[string]interface{})
|
||||
where := make(map[string]any)
|
||||
if len(condition.TagIds) > 0 {
|
||||
where["tag_id"] = condition.TagIds
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ func newMachineFileRepo() repository.MachineFile {
|
||||
}
|
||||
|
||||
// 分页获取机器文件信息列表
|
||||
func (m *machineFileRepoImpl) GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (m *machineFileRepoImpl) GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
return model.GetPage(pageParam, condition, condition, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ func newMachineScriptRepo() repository.MachineScript {
|
||||
}
|
||||
|
||||
// 分页获取机器信息列表
|
||||
func (m *machineScriptRepoImpl) GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
||||
func (m *machineScriptRepoImpl) GetPageList(condition *entity.MachineScript, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult {
|
||||
return model.GetPage(pageParam, condition, condition, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user