Date: 2024-12-21 20:47:21
Score: 1.5
Natty:
In spring jpa
- Create Role entity
- Create Permission entity
- Create one to many relation.
- Create repositoryRole and repositoryPermission.
- In reposityRole Create method with you query or List findByRoleNameIn(List roleNames)
- Call this method - var roles = role Repository.findByRoleNameIn(List.of("user_admin","db_admin"));
- And you can transformate List to map
Map<String, Choice> result = roles.stream().collect(Collectors.toMap(Roles::getName,Roles::gerPermission )
Reasons:
- No code block (0.5):
- Low reputation (1):
Posted by: Perevalov Stanislav