, , , WHERE $P {}.
WHERE :
$P!{whereClause}
$P {eventoid}, $P {data1} $P {data2}.
Spring MVC Controller, POST , String, whereClause, "WHERE 1 = 1" ( true if ):
String whereClause = "WHERE 1=1";
if (relIndice.getEventoId() != 0) {
whereClause += " AND evento.id = " + relIndice.getEventoId().toString();
}
if (relIndice.getData1() != null) {
whereClause += " AND evento.data_inicio_realizacao >= '" + relIndice.getData1().toString() + "'";
}
if (relIndice.getData2() != null) {
whereClause += " AND evento.data_inicio_realizacao <= '" + relIndice.getData2().toString() + "'";
}
whereClause += " ORDER BY evento.data_inicio_realizacao";
whereClause 3 IF, , WHERE, SQL.
"WHERE 1 = 1 , , .
ORDER BY, .
, , , .
null zero ( eventoId, int), , SELECT WHERE... Coz !
, !