[FEAT] add capability to set condition in update
This commit is contained in:
parent
d94e526bd4
commit
29a6e7602c
@ -1031,9 +1031,10 @@ public class DataAccess {
|
|||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
final Condition condition = options.get(Condition.class);
|
final Condition condition = options.get(Condition.class);
|
||||||
if (condition != null) {
|
if (condition != null) {
|
||||||
throw new DataAccessException("request a updateWithJson with a condition");
|
options.add(new Condition(new QueryAnd(getTableIdCondition(clazz, id), condition.condition)));
|
||||||
|
} else {
|
||||||
|
options.add(new Condition(getTableIdCondition(clazz, id)));
|
||||||
}
|
}
|
||||||
options.add(new Condition(getTableIdCondition(clazz, id)));
|
|
||||||
options.add(new TransmitKey(id));
|
options.add(new TransmitKey(id));
|
||||||
return updateWhereWithJson(clazz, jsonData, options.getAllArray());
|
return updateWhereWithJson(clazz, jsonData, options.getAllArray());
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,7 @@ public class RESTApi {
|
|||||||
final HttpRequest request = requestBuilding.method(model, BodyPublishers.ofString(body)).build();
|
final HttpRequest request = requestBuilding.method(model, BodyPublishers.ofString(body)).build();
|
||||||
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
||||||
|
LOGGER.trace("Receive Error: {}", httpResponse.body());
|
||||||
try {
|
try {
|
||||||
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(), RESTErrorResponseExeption.class);
|
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(), RESTErrorResponseExeption.class);
|
||||||
throw out;
|
throw out;
|
||||||
|
Loading…
Reference in New Issue
Block a user