ReportVo getReport public () {
// execute a stored procedure
ReportVo reportVo = jdbcTemplate.execute (new new CallableStatementCreator () {
@Override
public CallableStatement createCallableStatement (Connection Connection) throws SQLException {
// Note: there will be pit, there are several parameters to write several question marks the CALL management_report {(,,,,,??????)}
String SQL = "{management_report the CALL (,,,,,??????)}";
CallableStatement prepareCall = connection.prepareCall(sql);
prepareCall.registerOutParameter(1, Types.INTEGER);
prepareCall.registerOutParameter(2, Types.INTEGER);
prepareCall.registerOutParameter(3, Types.DOUBLE);
prepareCall.registerOutParameter(4, Types.DOUBLE);
prepareCall.registerOutParameter(5, Types.INTEGER);
prepareCall.registerOutParameter(6, Types.INTEGER);
return prepareCall;
}
}, new CallableStatementCallback<ReportVo>() {
@Override
public ReportVo doInCallableStatement(CallableStatement callableStatement) throws SQLException, DataAccessException {
callableStatement.execute();
int partyGroupCount=callableStatement.getInt(1);
int personCount=callableStatement.getInt(2);
Double shipPlateSum=callableStatement.getDouble(3);
Double palletSum=callableStatement.getDouble(4);
int shipPlateCount=callableStatement.getInt(5);
int palletCount=callableStatement.getInt(6);
return new ReportVo( personCount, partyGroupCount, shipPlateSum, palletSum, shipPlateCount, palletCount);
}
});
return reportVo;
}