数据库订正工具

  1. 直接执行sql语句
    @Autowired
    private TDataSource dataSource;
    //或者
    @Autowired
    private DataSource dataSource;

    String[] split = StringUtils.split(jobArguments, "@@@");
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    for (int i = 0; i < split.length; i++) {
        jdbcTemplate.execute(split[i]);
    }

  1. 带有返回结果的sql语句执行
    private static String                 SQL                   = "select* from where id = ?";

    private static Long                   ID
List> list = jdbcTemplate.queryForList(SQL, new Object[] { ID });

    list.stream().forEach(map -> {
                Id = ((BigInteger) map.get("id")).toString();
                Long Id = ((BigInteger) map.get("id")).longValue();
                }

你可能感兴趣的:(数据库订正工具)