提交
This commit is contained in:
@@ -535,8 +535,13 @@ func (s *Service) DeleteRole(ctx context.Context, id int) error {
|
||||
return s.ctx.EntClient.Role.DeleteOneID(id).Exec(ctx)
|
||||
}
|
||||
|
||||
func (s *Service) ListRoles(ctx context.Context) ([]*ent.Role, error) {
|
||||
return s.ctx.EntClient.Role.Query().Order(ent.Asc(role.FieldID)).All(ctx)
|
||||
func (s *Service) ListRoles(ctx context.Context, keyword string) ([]*ent.Role, error) {
|
||||
q := s.ctx.EntClient.Role.Query().Order(ent.Asc(role.FieldID))
|
||||
if keyword != "" {
|
||||
kw := keyword
|
||||
q = q.Where(role.Or(role.NameContainsFold(kw), role.CodeContainsFold(kw)))
|
||||
}
|
||||
return q.All(ctx)
|
||||
}
|
||||
|
||||
type PermissionReq struct {
|
||||
|
||||
Reference in New Issue
Block a user