File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed
src/main/java/ru/techdemo/controllers/api Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change 55 */
66package ru .techdemo .controllers .api ;
77
8- /**
9- *
10- * @author michael
11- */
8+ import java .util .List ;
9+ import org .springframework .beans .factory .annotation .Autowired ;
10+ import org .springframework .web .bind .annotation .GetMapping ;
11+ import org .springframework .web .bind .annotation .PathVariable ;
12+ import org .springframework .web .bind .annotation .RestController ;
13+ import ru .techdemo .dal .IApplicationDataContext ;
14+ import ru .techdemo .dal .entity .RoleEntity ;
15+
16+ @ RestController
1217public class RolesController {
1318
19+ @ GetMapping ("/api/roles" )
20+ public List <RoleEntity > get (){
21+ List <RoleEntity > roles = dataContext .getRolesRepository ().getAll ();
22+ return roles ;
23+ }
24+
25+ @ GetMapping ("/api/roles/{id}" )
26+ public RoleEntity get (@ PathVariable (required = true )Long id ){
27+ RoleEntity role = dataContext .getRolesRepository ().getById (id );
28+ return role ;
29+ }
30+
31+ @ Autowired
32+ IApplicationDataContext dataContext ;
1433}
You can’t perform that action at this time.
0 commit comments