Given five files,
EmployeeController.javaEmployeeRepository.javaEmployeeJpaService.javaEmployeeJpaRepository.javaEmployee.java
And also given a database file employees which contains the EMPLOYEELIST table.
| Columns | Type |
|---|---|
| employeeId | INTEGER |
| employeeName | TEXT |
| TEXT | |
| department | TEXT |
-
Employee.java:Employeeclass should contain the following attributes.Attribute Type employeeId int employeeName String email String department String -
EmployeeRepository.java: Create aninterfacecontaining the required methods. -
EmployeeJpaService.java: Update the service class with logic for managing employee data. -
EmployeeController.java: Create the controller class to handle HTTP requests. -
EmployeeJpaRepository.java: Create an interface that extends theJpaRpositoryInterface.
Implement the following APIs.
Returns a list of all employees in the employeeList.
[
{
"employeeId": 1,
"employeeName": "John Doe",
"email": "[email protected]",
"department": "Marketing"
},
...
]
Creates a new employee in the employeeList. The employeeId is auto-incremented.
{
"employeeName": "Henry Nicholas",
"email": "[email protected]",
"department": "IT"
}
{
"employeeId": 7,
"employeeName": "Henry Nicholas",
"email": "[email protected]",
"department": "IT"
}
Returns an employee details based on the employeeId.
If the given employeeId is not found in the employeeList, raise ResponseStatusException with HttpStatus.NOT_FOUND.
{
"employeeId": 2,
"employeeName": "Jane Smith",
"email": "[email protected]",
"department": "Human Resources"
}
Update the details of an employee in the employeeList based on the employeeId and return the updated employee details.
If the given employeeId is not found in the employeeList, raise ResponseStatusException with HttpStatus.NOT_FOUND.
{
"employeeName": "Steve Smith",
"email": "[email protected]"
}
{
"employeeId": 2,
"employeeName": "Steve Smith",
"email": "[email protected]",
"department": "Human Resources"
}
Deletes an employee from the employeeList based on the employeeId.
If the given employeeId is not found in the employeeList, raise ResponseStatusException with HttpStatus.NOT_FOUND.
Do not modify the code in EmployeeApplication.java
Do not modify anything in the application.properties file
Do not add any SQL files