uniugm/admin/apps/game/domain/repo/gen_account.go

29 lines
634 B
Go
Raw Normal View History

2025-07-04 15:24:46 +08:00
package repo
import (
"admin/apps/game/model"
"admin/internal/errcode"
"gorm.io/gorm"
)
type IGenAccountRepo interface {
ListAll(projectId int) ([]*model.GenAccount, error)
}
func NewGenAccountRepo(db *gorm.DB) IGenAccountRepo {
return &genAccountRepoImpl{db: db}
}
type genAccountRepoImpl struct {
db *gorm.DB
}
func (impl *genAccountRepoImpl) ListAll(projectId int) ([]*model.GenAccount, error) {
po := make([]*model.GenAccount, 0)
err := impl.db.Where("project_id = ?", projectId).Find(&po).Error
if err != nil {
return nil, errcode.New(errcode.ParamsInvalid, "list gen account error:%v", err)
}
return po, nil
}