-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateOrderService.java
More file actions
33 lines (27 loc) · 898 Bytes
/
UpdateOrderService.java
File metadata and controls
33 lines (27 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.example.order.service;
import com.example.order.dao.UpdateOrderDao;
import com.example.order.dto.ParamsDto;
import com.example.order.util.Database;
import java.io.IOException;
/**
* Service class to update an order
*/
public class UpdateOrderService implements OrderService {
private final UpdateOrderDao updateOrderDao = new UpdateOrderDao(Database.getInstance());
/**
* Method to execute the service operation
*
* @param paramsDTO Object with the parameters to execute the service
*/
@Override
public String execute(ParamsDto paramsDTO) throws IOException {
String result;
int rowsAffected = updateOrderDao.updateOrderStatus(paramsDTO);
if (rowsAffected <= 0) {
result = "No rows affected";
} else {
result = "Rows affected: " + rowsAffected;
}
return result;
}
}