标签:ring 查询 ide EDA etag jdbc red ret app
ManagerRowMapper.java
public class ManagerRowMapper implements RowMapper<Manager>{ @Override public Manager mapRow(ResultSet rs, int i) throws SQLException { Manager m = new Manager(); m.setId(rs.getInt("ID")); m.setName(rs.getString("NAME")); m.setAge(rs.getInt("AGE")); m.setGender(rs.getString("GENDER")); m.setCreateDate(rs.getDate("CREATE_DATE")); m.setCreateBy(rs.getString("CREATE_BY")); return m; } }
使用
ManagerDao.java
public class ManagerDao { @Autowired private JdbcTemplate jdbcTemplate; public List<Manager> selectAll(){ String sql = "select * from TAB_MANAGER"; return jdbcTemplate.query(sql, new ManagerMapRow()); } }
Springboot使用JdbcTemplate RowMapper查询,直接返回实体列表
标签:ring 查询 ide EDA etag jdbc red ret app
原文地址:https://www.cnblogs.com/chyf1990/p/9044869.html