forked from s485936/PRAPRO2
NO MORE LONGS THAT ARE CHANGING THE SCHEMA OF MY DATABASE also added main controller for special requests
This commit is contained in:
parent
570dc024b5
commit
4f630016ca
@ -28,7 +28,7 @@ public class ActivityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<Activity> getActivityById(@PathVariable Long id) {
|
public ResponseEntity<Activity> getActivityById(@PathVariable Integer id) {
|
||||||
Activity activity = activityService.findById(id).orElse(null);
|
Activity activity = activityService.findById(id).orElse(null);
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
return ResponseEntity.ok(activity);
|
return ResponseEntity.ok(activity);
|
||||||
@ -38,7 +38,7 @@ public class ActivityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<Activity> updateActivity(@PathVariable Long id, @RequestBody Activity activityDetails) {
|
public ResponseEntity<Activity> updateActivity(@PathVariable Integer id, @RequestBody Activity activityDetails) {
|
||||||
Activity activity = activityService.findById(id).orElse(null);
|
Activity activity = activityService.findById(id).orElse(null);
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activity.setName(activityDetails.getName());
|
activity.setName(activityDetails.getName());
|
||||||
@ -50,7 +50,7 @@ public class ActivityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Void> deleteActivity(@PathVariable Long id) {
|
public ResponseEntity<Void> deleteActivity(@PathVariable Integer id) {
|
||||||
Activity activity = activityService.findById(id).orElse(null);
|
Activity activity = activityService.findById(id).orElse(null);
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activityService.delete(activity);
|
activityService.delete(activity);
|
||||||
|
@ -24,7 +24,7 @@ public class ActivityLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ActivityLog getActivityLogById(@PathVariable Long id) {
|
public ActivityLog getActivityLogById(@PathVariable Integer id) {
|
||||||
return activityLogService.findById(id).orElse(null);
|
return activityLogService.findById(id).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class ActivityLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public ActivityLogDTO updateActivityLog(@PathVariable Long id, @RequestBody ActivityLogDTO activityLogDetails) {
|
public ActivityLogDTO updateActivityLog(@PathVariable Integer id, @RequestBody ActivityLogDTO activityLogDetails) {
|
||||||
ActivityLogDTO activityLog = activityLogDTOService.findById(id).orElse(null);
|
ActivityLogDTO activityLog = activityLogDTOService.findById(id).orElse(null);
|
||||||
if (activityLog != null) {
|
if (activityLog != null) {
|
||||||
activityLog.setActivityId(activityLogDetails.getActivityId());
|
activityLog.setActivityId(activityLogDetails.getActivityId());
|
||||||
@ -48,7 +48,7 @@ public class ActivityLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public void deleteActivityLog(@PathVariable Long id) {
|
public void deleteActivityLog(@PathVariable Integer id) {
|
||||||
activityLogService.deleteById(id);
|
activityLogService.deleteById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.example.prapro2spring.controller;
|
||||||
|
|
||||||
|
import com.example.prapro2spring.model.Person;
|
||||||
|
import com.example.prapro2spring.dto.PersonValue;
|
||||||
|
import com.example.prapro2spring.repository.PeopleRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import com.example.prapro2spring.repository.PersonValueRepository;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/main")
|
||||||
|
public class MainController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PeopleRepository peopleRepository;
|
||||||
|
@Autowired
|
||||||
|
private PersonValueRepository personValueRepository;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<PersonValue> getAllPeopleValues() {
|
||||||
|
return personValueRepository.queryAllPersonValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public Integer getPersonValuesById(@PathVariable Integer id){
|
||||||
|
return personValueRepository.queryPersonValuesById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -28,7 +28,7 @@ public class OccupationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<Occupation> getOccupationById(@PathVariable Long id) {
|
public ResponseEntity<Occupation> getOccupationById(@PathVariable Integer id) {
|
||||||
Occupation occupation = occupationService.findById(id).orElse(null);
|
Occupation occupation = occupationService.findById(id).orElse(null);
|
||||||
if (occupation != null) {
|
if (occupation != null) {
|
||||||
return ResponseEntity.ok(occupation);
|
return ResponseEntity.ok(occupation);
|
||||||
@ -38,7 +38,7 @@ public class OccupationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<Occupation> updateOccupation(@PathVariable Long id, @RequestBody Occupation occupationDetails) {
|
public ResponseEntity<Occupation> updateOccupation(@PathVariable Integer id, @RequestBody Occupation occupationDetails) {
|
||||||
Occupation occupation = occupationService.findById(id).orElse(null);
|
Occupation occupation = occupationService.findById(id).orElse(null);
|
||||||
if (occupation != null) {
|
if (occupation != null) {
|
||||||
occupation.setName(occupationDetails.getName());
|
occupation.setName(occupationDetails.getName());
|
||||||
@ -50,7 +50,7 @@ public class OccupationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Void> deleteOccupation(@PathVariable Long id) {
|
public ResponseEntity<Void> deleteOccupation(@PathVariable Integer id) {
|
||||||
Occupation occupation = occupationService.findById(id).orElse(null);
|
Occupation occupation = occupationService.findById(id).orElse(null);
|
||||||
if (occupation != null) {
|
if (occupation != null) {
|
||||||
occupationService.delete(occupation);
|
occupationService.delete(occupation);
|
||||||
|
@ -24,7 +24,7 @@ public class OccupationLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public OccupationLog getOccupationLogById(@PathVariable Long id) {
|
public OccupationLog getOccupationLogById(@PathVariable Integer id) {
|
||||||
return occupationLogService.findById(id).orElse(null);
|
return occupationLogService.findById(id).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class OccupationLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public OccupationLogDTO updateOccupationLog(@PathVariable Long id, @RequestBody OccupationLogDTO occupationLogDetails) {
|
public OccupationLogDTO updateOccupationLog(@PathVariable Integer id, @RequestBody OccupationLogDTO occupationLogDetails) {
|
||||||
OccupationLogDTO occupationLog = occupationLogDTOService.findById(id).orElse(null);
|
OccupationLogDTO occupationLog = occupationLogDTOService.findById(id).orElse(null);
|
||||||
if (occupationLog != null) {
|
if (occupationLog != null) {
|
||||||
occupationLog.setOccupationId(occupationLogDetails.getOccupationId());
|
occupationLog.setOccupationId(occupationLogDetails.getOccupationId());
|
||||||
@ -49,7 +49,7 @@ public class OccupationLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public void deleteOccupationLog(@PathVariable Long id) {
|
public void deleteOccupationLog(@PathVariable Integer id) {
|
||||||
occupationLogService.deleteById(id);
|
occupationLogService.deleteById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,7 +25,7 @@ public class PersonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public Person getPersonById(@PathVariable Long id) {
|
public Person getPersonById(@PathVariable Integer id) {
|
||||||
return peopleRepository.findById(id).orElse(null);
|
return peopleRepository.findById(id).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class PersonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
public PersonDTO updatePerson(@PathVariable Long id, @RequestBody PersonDTO personDetails) {
|
public PersonDTO updatePerson(@PathVariable Integer id, @RequestBody PersonDTO personDetails) {
|
||||||
PersonDTO person = personService.findById(id).orElse(null);
|
PersonDTO person = personService.findById(id).orElse(null);
|
||||||
if (person != null) {
|
if (person != null) {
|
||||||
person.setParent1(personDetails.getParent1());
|
person.setParent1(personDetails.getParent1());
|
||||||
@ -51,7 +51,7 @@ public class PersonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public void deletePerson(@PathVariable Long id) {
|
public void deletePerson(@PathVariable Integer id) {
|
||||||
peopleRepository.deleteById(id);
|
peopleRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,13 +12,13 @@ public class ActivityLogDTO {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@Column(name = "activityId")
|
@Column(name = "activityId")
|
||||||
private Long activityId;
|
private Integer activityId;
|
||||||
|
|
||||||
@Column(name = "humanId")
|
@Column(name = "humanId")
|
||||||
private Long personId;
|
private Integer personId;
|
||||||
|
|
||||||
@Column(name = "start_timestamp")
|
@Column(name = "start_timestamp")
|
||||||
private LocalDateTime startTimestamp;
|
private LocalDateTime startTimestamp;
|
||||||
@ -28,27 +28,27 @@ public class ActivityLogDTO {
|
|||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getActivityId() {
|
public Integer getActivityId() {
|
||||||
return activityId;
|
return activityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivityId(Long activityId) {
|
public void setActivityId(Integer activityId) {
|
||||||
this.activityId = activityId;
|
this.activityId = activityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getPersonId() {
|
public Integer getPersonId() {
|
||||||
return personId;
|
return personId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPersonId(Long person) {
|
public void setPersonId(Integer person) {
|
||||||
this.personId = person;
|
this.personId = person;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,13 +12,13 @@ public class OccupationLogDTO {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@Column(name = "occupationId")
|
@Column(name = "occupationId")
|
||||||
private Long occupationId;
|
private Integer occupationId;
|
||||||
|
|
||||||
@Column(name = "humanId")
|
@Column(name = "humanId")
|
||||||
private Long personId;
|
private Integer personId;
|
||||||
|
|
||||||
@Column(name = "start_timestamp")
|
@Column(name = "start_timestamp")
|
||||||
private LocalDateTime startTimestamp;
|
private LocalDateTime startTimestamp;
|
||||||
@ -31,27 +31,27 @@ public class OccupationLogDTO {
|
|||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getOccupationId() {
|
public Integer getOccupationId() {
|
||||||
return occupationId;
|
return occupationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOccupationId(Long occupationId) {
|
public void setOccupationId(Integer occupationId) {
|
||||||
this.occupationId = occupationId;
|
this.occupationId = occupationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getPersonId() {
|
public Integer getPersonId() {
|
||||||
return personId;
|
return personId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPersonId(Long personId) {
|
public void setPersonId(Integer personId) {
|
||||||
this.personId = personId;
|
this.personId = personId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,40 +10,40 @@ public class PersonDTO {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@Column(name = "parent1Id")
|
@Column(name = "parent1Id")
|
||||||
private Long parent1;
|
private Integer parent1;
|
||||||
|
|
||||||
@Column(name = "parent2Id")
|
@Column(name = "parent2Id")
|
||||||
private Long parent2;
|
private Integer parent2;
|
||||||
|
|
||||||
@Column(name = "birth_timestamp")
|
@Column(name = "birth_timestamp")
|
||||||
private java.time.LocalDateTime birthTimestamp;
|
private java.time.LocalDateTime birthTimestamp;
|
||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getParent1() {
|
public Integer getParent1() {
|
||||||
return parent1;
|
return parent1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParent1(Long parent1) {
|
public void setParent1(Integer parent1) {
|
||||||
this.parent1 = parent1;
|
this.parent1 = parent1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getParent2() {
|
public Integer getParent2() {
|
||||||
return parent2;
|
return parent2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParent2(Long parent2) {
|
public void setParent2(Integer parent2) {
|
||||||
this.parent2 = parent2;
|
this.parent2 = parent2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
src/main/java/com/example/prapro2spring/dto/PersonValue.java
Normal file
22
src/main/java/com/example/prapro2spring/dto/PersonValue.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package com.example.prapro2spring.dto;
|
||||||
|
|
||||||
|
public class PersonValue {
|
||||||
|
private Integer id;
|
||||||
|
private Integer value;
|
||||||
|
|
||||||
|
public PersonValue(Integer id, Integer value) {
|
||||||
|
this.id = id;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersonValue() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,7 @@ public class Activity {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@Column(name = "name")
|
@Column(name = "name")
|
||||||
private String name;
|
private String name;
|
||||||
@ -18,11 +18,11 @@ public class Activity {
|
|||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ public class ActivityLog {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "activityId")
|
@JoinColumn(name = "activityId")
|
||||||
@ -28,11 +28,11 @@ public class ActivityLog {
|
|||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.example.prapro2spring.model;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
public class FullPerson {
|
||||||
|
private Integer id;
|
||||||
|
private Person parent1;
|
||||||
|
private Person parent2;
|
||||||
|
private java.time.LocalDateTime birthTimestamp;
|
||||||
|
private ActivityLog[] activityLog;
|
||||||
|
private OccupationLog[] occupationLog;
|
||||||
|
|
||||||
|
public FullPerson(Integer id, Person parent1, Person parent2, java.time.LocalDateTime birthTimestamp, ActivityLog[] activityLog, OccupationLog[] occupationLog) {
|
||||||
|
this.id = id;
|
||||||
|
this.parent1 = parent1;
|
||||||
|
this.parent2 = parent2;
|
||||||
|
this.birthTimestamp = birthTimestamp;
|
||||||
|
this.activityLog = activityLog;
|
||||||
|
this.occupationLog = occupationLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person getParent1() {
|
||||||
|
return parent1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent1(Person parent1) {
|
||||||
|
this.parent1 = parent1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person getParent2() {
|
||||||
|
return parent2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent2(Person parent2) {
|
||||||
|
this.parent2 = parent2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getBirthTimestamp() {
|
||||||
|
return birthTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthTimestamp(LocalDateTime birthTimestamp) {
|
||||||
|
this.birthTimestamp = birthTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActivityLog[] getActivityLog() {
|
||||||
|
return activityLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityLog(ActivityLog[] activityLog) {
|
||||||
|
this.activityLog = activityLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OccupationLog[] getOccupationLog() {
|
||||||
|
return occupationLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOccupationLog(OccupationLog[] occupationLog) {
|
||||||
|
this.occupationLog = occupationLog;
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,7 @@ public class Occupation {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@Column(name = "name")
|
@Column(name = "name")
|
||||||
private String name;
|
private String name;
|
||||||
@ -18,11 +18,11 @@ public class Occupation {
|
|||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ public class OccupationLog {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "occupationId")
|
@JoinColumn(name = "occupationId")
|
||||||
@ -31,11 +31,11 @@ public class OccupationLog {
|
|||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ public class Person {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "parent1Id")
|
@JoinColumn(name = "parent1Id")
|
||||||
@ -25,11 +25,11 @@ public class Person {
|
|||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
public Long getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,5 +3,5 @@ package com.example.prapro2spring.repository;
|
|||||||
import com.example.prapro2spring.model.Activity;
|
import com.example.prapro2spring.model.Activity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface ActivityRepository extends JpaRepository<Activity, Long> {
|
public interface ActivityRepository extends JpaRepository<Activity, Integer> {
|
||||||
}
|
}
|
@ -3,5 +3,5 @@ package com.example.prapro2spring.repository;
|
|||||||
import com.example.prapro2spring.model.Person;
|
import com.example.prapro2spring.model.Person;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface PeopleRepository extends JpaRepository<Person, Long> {
|
public interface PeopleRepository extends JpaRepository<Person, Integer> {
|
||||||
}
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.example.prapro2spring.repository;
|
||||||
|
|
||||||
|
import com.example.prapro2spring.dto.PersonValue;
|
||||||
|
import com.example.prapro2spring.dto.PersonDTO;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PersonValueRepository extends CrudRepository<PersonDTO, Integer> {
|
||||||
|
@Query(value = "SELECT people_scoreboard.get_human_value(?1)", nativeQuery = true)
|
||||||
|
Integer queryPersonValuesById(Integer id);
|
||||||
|
|
||||||
|
@Query(value = "SELECT * FROM people_scoreboard.get_all_people_values()", nativeQuery = true)
|
||||||
|
List<PersonValue> queryAllPersonValues();
|
||||||
|
}
|
@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface ActivityLogDTOService extends JpaRepository<ActivityLogDTO, Long> {
|
public interface ActivityLogDTOService extends JpaRepository<ActivityLogDTO, Integer> {
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface ActivityLogService extends JpaRepository<ActivityLog, Long> {
|
public interface ActivityLogService extends JpaRepository<ActivityLog, Integer> {
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface ActivityService extends JpaRepository<Activity, Long> {
|
public interface ActivityService extends JpaRepository<Activity, Integer> {
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface OccupationLogDTOService extends JpaRepository<OccupationLogDTO, Long> {
|
public interface OccupationLogDTOService extends JpaRepository<OccupationLogDTO, Integer> {
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface OccupationLogService extends JpaRepository<OccupationLog, Long> {
|
public interface OccupationLogService extends JpaRepository<OccupationLog, Integer> {
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface OccupationService extends JpaRepository<Occupation, Long> {
|
public interface OccupationService extends JpaRepository<Occupation, Integer> {
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface PersonService extends JpaRepository<PersonDTO, Long> {
|
public interface PersonService extends JpaRepository<PersonDTO, Integer> {
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user