2021-07-28 18:03:19 +08:00
|
|
|
package persistence
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"mayfly-go/base/biz"
|
|
|
|
|
"mayfly-go/base/model"
|
|
|
|
|
"mayfly-go/server/devops/domain/entity"
|
|
|
|
|
"mayfly-go/server/devops/domain/repository"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type projectRepo struct{}
|
|
|
|
|
|
|
|
|
|
var ProjectRepo repository.Project = &projectRepo{}
|
|
|
|
|
|
|
|
|
|
func (p *projectRepo) GetPageList(condition *entity.Project, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
|
|
|
|
|
return model.GetPage(pageParam, condition, toEntity, orderBy...)
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-11 14:04:09 +08:00
|
|
|
func (p *projectRepo) Count(condition *entity.Project) int64 {
|
|
|
|
|
return model.CountBy(condition)
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-28 18:03:19 +08:00
|
|
|
func (p *projectRepo) GetByIdIn(ids []uint64, toEntity interface{}, orderBy ...string) {
|
|
|
|
|
model.GetByIdIn(new(entity.Project), toEntity, ids, orderBy...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (p *projectRepo) Save(project *entity.Project) {
|
|
|
|
|
biz.ErrIsNil(model.Insert(project), "保存项目失败")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (p *projectRepo) Update(project *entity.Project) {
|
|
|
|
|
biz.ErrIsNil(model.UpdateById(project), "更新项目信息")
|
|
|
|
|
}
|
2021-08-18 17:57:33 +08:00
|
|
|
|
|
|
|
|
func (p *projectRepo) Delete(id uint64) {
|
|
|
|
|
model.DeleteById(new(entity.Project), id)
|
|
|
|
|
}
|