Search in sources :

Example 1 with ExportSqlBuilder

use of io.leopard.exporter.ExportSqlBuilder in project leopard by tanhaichao.

the class ExporterMysqlImpl method export.

@Override
public <T> List<T> export(Class<T> model, int start, int size) {
    ExportSqlBuilder builder = new ExportSqlBuilder(model, ExportSqlBuilder.ESC_MYSQL);
    String tableName = builder.getTableName();
    String sql = builder.buildSql();
    System.out.println(sql);
    // return jdbc.queryForList(sql, model);
    try {
        return jdbc.getJdbcTemplate().query(sql, new ExporterLeopardBeanPropertyRowMapper<T>(model, tableName));
    } catch (EmptyResultDataAccessException e) {
        return null;
    }
}
Also used : EmptyResultDataAccessException(org.springframework.dao.EmptyResultDataAccessException) ExportSqlBuilder(io.leopard.exporter.ExportSqlBuilder)

Example 2 with ExportSqlBuilder

use of io.leopard.exporter.ExportSqlBuilder in project leopard by tanhaichao.

the class ExporterOracleImpl method export.

@Override
public <T> List<T> export(Class<T> model, int start, int size) {
    ExportSqlBuilder builder = new ExportSqlBuilder(model, ExportSqlBuilder.ESC_ORACLE);
    String tableName = builder.getTableName();
    String sql = builder.buildSql();
    System.out.println(sql);
    // return jdbc.queryForList(sql, model);
    try {
        return jdbc.getJdbcTemplate().query(sql, new ExporterLeopardBeanPropertyRowMapper<T>(model, tableName));
    } catch (EmptyResultDataAccessException e) {
        return null;
    }
}
Also used : EmptyResultDataAccessException(org.springframework.dao.EmptyResultDataAccessException) ExportSqlBuilder(io.leopard.exporter.ExportSqlBuilder)

Aggregations

ExportSqlBuilder (io.leopard.exporter.ExportSqlBuilder)2 EmptyResultDataAccessException (org.springframework.dao.EmptyResultDataAccessException)2