feat: 机器列表新增运行状态 & refactor: 登录账号信息存储与context

This commit is contained in:
meilin.huang
2023-11-07 21:05:21 +08:00
parent d9adf0fd25
commit eddda41291
74 changed files with 915 additions and 652 deletions

View File

@@ -3,14 +3,17 @@ package persistence
import (
"mayfly-go/internal/machine/domain/entity"
"mayfly-go/internal/machine/domain/repository"
"mayfly-go/pkg/base"
"mayfly-go/pkg/gormx"
"mayfly-go/pkg/model"
)
type machineFileRepoImpl struct{}
type machineFileRepoImpl struct {
base.RepoImpl[*entity.MachineFile]
}
func newMachineFileRepo() repository.MachineFile {
return new(machineFileRepoImpl)
return &machineFileRepoImpl{base.RepoImpl[*entity.MachineFile]{M: new(entity.MachineFile)}}
}
// 分页获取机器文件信息列表
@@ -18,30 +21,3 @@ func (m *machineFileRepoImpl) GetPageList(condition *entity.MachineFile, pagePar
qd := gormx.NewQuery(condition).WithCondModel(condition).WithOrderBy(orderBy...)
return gormx.PageQuery(qd, pageParam, toEntity)
}
// 根据条件获取账号信息
func (m *machineFileRepoImpl) GetMachineFile(condition *entity.MachineFile, cols ...string) error {
return gormx.GetBy(condition, cols...)
}
// 根据id获取
func (m *machineFileRepoImpl) GetById(id uint64, cols ...string) *entity.MachineFile {
ms := new(entity.MachineFile)
if err := gormx.GetById(ms, id, cols...); err != nil {
return nil
}
return ms
}
// 根据id获取
func (m *machineFileRepoImpl) Delete(id uint64) error {
return gormx.DeleteById(new(entity.MachineFile), id)
}
func (m *machineFileRepoImpl) Create(entity *entity.MachineFile) error {
return gormx.Insert(entity)
}
func (m *machineFileRepoImpl) UpdateById(entity *entity.MachineFile) error {
return gormx.UpdateById(entity)
}