@Test public void testSelectByIds() { List<UserDO> users = userDao.selectByIds(Arrays.asList(1, 5)); System.out.println("users：" + users.size()); }
public List<UserDO> selectByIds(List<Integer> ids) { NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(template); Map<String, Object> params = new HashMap<>(); params.put("ids", ids); return namedParameterJdbcTemplate.query( "SELECT id, username, password, create_time FROM users WHERE id IN (:ids)", params, new BeanPropertyRowMapper<>(UserDO.class) ); }
UserDao { public List<UserDO> selectByIds(List<Integer> ids) { NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(template); Map<String, Object> params = new HashMap<>(); params.put("ids", ids); return namedParameterJdbcTemplate.query( "SELECT id, username, password, create_time FROM users WHERE id IN (:ids)", params, new BeanPropertyRowMapper<>(UserDO.class) ); } }
UserDao { public List<UserDO> selectByIds(List<Integer> ids) { NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(template); Map<String, Object> params = new HashMap<>(); params.put("ids", ids); return namedParameterJdbcTemplate.query( "SELECT id, username, password, create_time FROM users WHERE id IN (:ids)", params, new BeanPropertyRowMapper<>(UserDO.class) ); }  }
UserDao { public List<UserDO> selectByIds(List<Integer> ids) { NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(template); Map<String, Object> params = new HashMap<>(); params.put("ids", ids); return namedParameterJdbcTemplate.query( "SELECT id, username, password, create_time FROM users WHERE id IN (:ids)", params, new BeanPropertyRowMapper<>(UserDO.class) ); }  int insert(UserDO entity); int insert0(UserDO entity); int updateById(UserDO entity); int deleteById(Integer id); UserDO selectById(Integer id); UserDO selectByUsername(String username); List<UserDO> selectByIds(List<Integer> ids); }
UserDao { public List<UserDO> selectByIds(List<Integer> ids) { NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(template); Map<String, Object> params = new HashMap<>(); params.put("ids", ids); return namedParameterJdbcTemplate.query( "SELECT id, username, password, create_time FROM users WHERE id IN (:ids)", params, new BeanPropertyRowMapper<>(UserDO.class) ); }  int insert(UserDO entity); int insert0(UserDO entity); int updateById(UserDO entity); int deleteById(Integer id); UserDO selectById(Integer id); UserDO selectByUsername(String username); List<UserDO> selectByIds(List<Integer> ids);  }