mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 08:20:25 +08:00 
			
		
		
		
	feat: 新增机器授权凭证管理与其他优化
This commit is contained in:
		@@ -0,0 +1,49 @@
 | 
			
		||||
package persistence
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"mayfly-go/internal/machine/domain/entity"
 | 
			
		||||
	"mayfly-go/internal/machine/domain/repository"
 | 
			
		||||
	"mayfly-go/pkg/biz"
 | 
			
		||||
	"mayfly-go/pkg/model"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type authCertRepoImpl struct{}
 | 
			
		||||
 | 
			
		||||
func newAuthCertRepo() repository.AuthCert {
 | 
			
		||||
	return new(authCertRepoImpl)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *authCertRepoImpl) GetPageList(condition *entity.AuthCert, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
 | 
			
		||||
	return model.GetPage(pageParam, condition, condition, toEntity)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *authCertRepoImpl) Insert(ac *entity.AuthCert) {
 | 
			
		||||
	biz.ErrIsNil(model.Insert(ac), "新增授权凭证失败")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *authCertRepoImpl) Update(ac *entity.AuthCert) {
 | 
			
		||||
	biz.ErrIsNil(model.UpdateById(ac), "更新授权凭证失败")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *authCertRepoImpl) GetById(id uint64) *entity.AuthCert {
 | 
			
		||||
	ac := new(entity.AuthCert)
 | 
			
		||||
	err := model.GetById(ac, id)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return ac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *authCertRepoImpl) GetByIds(ids ...uint64) []*entity.AuthCert {
 | 
			
		||||
	acs := new([]*entity.AuthCert)
 | 
			
		||||
	model.GetByIdIn(new(entity.AuthCert), acs, ids)
 | 
			
		||||
	return *acs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *authCertRepoImpl) GetByCondition(condition *entity.AuthCert, cols ...string) error {
 | 
			
		||||
	return model.GetBy(condition, cols...)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *authCertRepoImpl) DeleteById(id uint64) {
 | 
			
		||||
	model.DeleteById(new(entity.AuthCert), id)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user