jdbcTemplate之“rowMapper内部类写法”

jdbcTemplate的rowMapper内部类写法

String sql ="select sku,feature from product"
List<Product> products = jdbcTemplate.query(sql, (rs, rowNum) -> { Product entity = new Product(); entity.setProductSku(rs.getString(ProductDBField.SKU)); entity.setProductFeature(rs.getString(ProductDBField.FEATURE)); return entity; });

 

posted @ 2023-03-01 19:33  骚哥  阅读(85)  评论(0编辑  收藏  举报