refactor: 新增base.Repo与base.App,重构repo与app层代码

This commit is contained in:
meilin.huang
2023-10-26 17:15:49 +08:00
parent 10f6b03fb5
commit a1303b52eb
115 changed files with 1867 additions and 1696 deletions

View File

@@ -3,26 +3,21 @@ 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 machineCropJobExecRepoImpl struct{}
type machineCropJobExecRepoImpl struct {
base.RepoImpl[*entity.MachineCronJobExec]
}
func newMachineCronJobExecRepo() repository.MachineCronJobExec {
return new(machineCropJobExecRepoImpl)
return &machineCropJobExecRepoImpl{base.RepoImpl[*entity.MachineCronJobExec]{M: new(entity.MachineCronJobExec)}}
}
// 分页获取机器信息列表
func (m *machineCropJobExecRepoImpl) GetPageList(condition *entity.MachineCronJobExec, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult[any] {
func (m *machineCropJobExecRepoImpl) GetPageList(condition *entity.MachineCronJobExec, 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)
}
func (m *machineCropJobExecRepoImpl) Insert(entity *entity.MachineCronJobExec) {
gormx.Insert(entity)
}
func (m *machineCropJobExecRepoImpl) Delete(mcje *entity.MachineCronJobExec) {
gormx.DeleteByCondition(mcje)
}