complete make role tree

This commit is contained in:
yanghao05
2023-02-05 14:23:57 +08:00
parent ee631b9714
commit afeffe2ed6
7 changed files with 68 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ type RoleDao interface {
UpdateByID(context.Context, *models.SysRole) (*models.SysRole, error)
DeleteByID(context.Context, uint64) error
DeletePermanentlyByID(context.Context, uint64) error
All(context.Context) ([]*models.SysRole, error)
}
type roleDaoImpl struct {
@@ -54,6 +55,11 @@ func (dao *roleDaoImpl) GetByFilter(ctx context.Context, filter dto.RoleRequestF
return items, uint64(total), nil
}
func (dao *roleDaoImpl) All(ctx context.Context) ([]*models.SysRole, error) {
role := dao.query.SysRole
return role.WithContext(ctx).Find()
}
func (dao *roleDaoImpl) FindByID(ctx context.Context, id uint64) (*models.SysRole, error) {
role := dao.query.SysRole
return role.WithContext(ctx).Where(role.ID.Eq(id)).First()