數(shù)據(jù)庫查詢那里可以直接使用
User user = jdbcTemplate.queryForObject(sql, new String[]{name}, new BeanPropertyRowMapper<>(User.class));
和
List<String> list = jdbcTemplate.queryForList(sql, new String[]{name}, String.class);
這樣就不用一個一個屬性遍歷賦值了
User user = jdbcTemplate.queryForObject(sql, new String[]{name}, new BeanPropertyRowMapper<>(User.class));
和
List<String> list = jdbcTemplate.queryForList(sql, new String[]{name}, String.class);
這樣就不用一個一個屬性遍歷賦值了
2018-05-19