mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-11 20:00:26 +08:00
refactor: 新增base.Repo与base.App,重构repo与app层代码
This commit is contained in:
@@ -3,7 +3,6 @@ package persistence
|
||||
import (
|
||||
"mayfly-go/internal/machine/domain/entity"
|
||||
"mayfly-go/internal/machine/domain/repository"
|
||||
"mayfly-go/pkg/biz"
|
||||
"mayfly-go/pkg/gormx"
|
||||
"mayfly-go/pkg/model"
|
||||
)
|
||||
@@ -15,7 +14,7 @@ func newMachineFileRepo() repository.MachineFile {
|
||||
}
|
||||
|
||||
// 分页获取机器文件信息列表
|
||||
func (m *machineFileRepoImpl) GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult[any] {
|
||||
func (m *machineFileRepoImpl) GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
|
||||
qd := gormx.NewQuery(condition).WithCondModel(condition).WithOrderBy(orderBy...)
|
||||
return gormx.PageQuery(qd, pageParam, toEntity)
|
||||
}
|
||||
@@ -35,14 +34,14 @@ func (m *machineFileRepoImpl) GetById(id uint64, cols ...string) *entity.Machine
|
||||
}
|
||||
|
||||
// 根据id获取
|
||||
func (m *machineFileRepoImpl) Delete(id uint64) {
|
||||
biz.ErrIsNil(gormx.DeleteById(new(entity.MachineFile), id), "删除失败")
|
||||
func (m *machineFileRepoImpl) Delete(id uint64) error {
|
||||
return gormx.DeleteById(new(entity.MachineFile), id)
|
||||
}
|
||||
|
||||
func (m *machineFileRepoImpl) Create(entity *entity.MachineFile) {
|
||||
biz.ErrIsNil(gormx.Insert(entity), "新增机器文件配置失败")
|
||||
func (m *machineFileRepoImpl) Create(entity *entity.MachineFile) error {
|
||||
return gormx.Insert(entity)
|
||||
}
|
||||
|
||||
func (m *machineFileRepoImpl) UpdateById(entity *entity.MachineFile) {
|
||||
biz.ErrIsNil(gormx.UpdateById(entity), "更新机器文件失败")
|
||||
func (m *machineFileRepoImpl) UpdateById(entity *entity.MachineFile) error {
|
||||
return gormx.UpdateById(entity)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user