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 }