File tree Expand file tree Collapse file tree 4 files changed +26
-3
lines changed
person-service/src/main/java/com/cevher/ms/person
task-service/src/main/java/com/cevher/ms/task/web/rest Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 15
15
@ AllArgsConstructor
16
16
@ NoArgsConstructor
17
17
public class Person {
18
-
19
18
@ Id
20
19
@ GeneratedValue (strategy = GenerationType .AUTO )
21
20
private Long id ;
21
+ private Long parentId ;
22
22
private String userName ;
23
23
private String password ;
24
24
private String firstName ;
25
25
private String lastName ;
26
26
private String email ;
27
27
private Long departmentId ;
28
-
29
28
}
Original file line number Diff line number Diff line change @@ -47,4 +47,8 @@ public List<Person> findAllPerson() {
47
47
log .info ("findAllPerson method of PersonService" );
48
48
return personRepository .findAll ();
49
49
}
50
+
51
+ public Person getPersonById (Long personId ) {
52
+ return personRepository .findById (personId ).orElse (new Person ());
53
+ }
50
54
}
Original file line number Diff line number Diff line change @@ -22,16 +22,25 @@ public Person savePerson(@RequestBody Person person) {
22
22
log .info ("savePerson by PersonController" );
23
23
return personService .savePerson (person );
24
24
}
25
+
25
26
@ GetMapping ("/" )
26
27
public List <Person > findAllPerson () {
27
28
log .info ("findAllPerson by PersonController" );
28
29
return personService .findAllPerson ();
29
30
}
31
+
30
32
@ GetMapping ("/{id}" )
33
+ public Person getPersonById (
34
+ @ PathVariable ("id" ) Long personId ) {
35
+ log .info ("getPersonWithDepartment by PersonController" );
36
+ return personService .getPersonById (personId );
37
+ }
38
+
39
+ @ GetMapping ("/rel/{id}" )
31
40
public ResponseTempVM getPersonWithDepartment (
32
41
@ PathVariable ("id" ) Long personId ) {
33
42
log .info ("getPersonWithDepartment by PersonController" );
34
43
return personService .getPersonWithDepartment (personId );
35
44
}
36
45
37
- }
46
+ }
Original file line number Diff line number Diff line change @@ -33,4 +33,15 @@ public Task findByTaskId(@PathVariable("id") Long id){
33
33
log .info ("findByTaskId method of TaskController" );
34
34
return taskService .findByTaskId (id );
35
35
}
36
+
37
+ /**
38
+ * Get Task with all relationship information
39
+ * @param id task ID
40
+ * @return Return Task with all relationship ResponseVM
41
+ */
42
+ @ GetMapping ("/rel/{id}" )
43
+ public ResponseVM findByTaskIdWithRelationShip (@ PathVariable ("id" ) Long id ){
44
+ log .info ("findByTaskId method of TaskController" );
45
+ return taskService .findByTaskIdWithPersonAndDepartment (id );
46
+ }
36
47
}
You can’t perform that action at this time.
0 commit comments