@Test public void getDeviceTypeList() throws Exception { List<DeviceType> deviceTypeList = deviceTypeDao.getDeviceTypeList(); for (DeviceType deviceType : deviceTypeList) { System.out.println(deviceType.getName()); System.out.println(deviceType.getTypeId()); System.out.println(deviceType.getImgUrl()); } }
@Override public List<DeviceType> getDeviceTypeList() { String sql = "select * from device_type"; SqlRowSet row = template.queryForRowSet(sql); List<DeviceType> list = new ArrayList<>(); DeviceType deviceType = null; while (row.next()) { deviceType = new DeviceType(); deviceType.setTypeId(row.getInt("type_id")); deviceType.setName(row.getString("name")); deviceType.setImgUrl(row.getString("img_url")); list.add(deviceType); } return list; }
DeviceTypeDaoImpl implements DeviceTypeDao { @Override public List<DeviceType> getDeviceTypeList() { String sql = "select * from device_type"; SqlRowSet row = template.queryForRowSet(sql); List<DeviceType> list = new ArrayList<>(); DeviceType deviceType = null; while (row.next()) { deviceType = new DeviceType(); deviceType.setTypeId(row.getInt("type_id")); deviceType.setName(row.getString("name")); deviceType.setImgUrl(row.getString("img_url")); list.add(deviceType); } return list; } }
DeviceTypeDaoImpl implements DeviceTypeDao { @Override public List<DeviceType> getDeviceTypeList() { String sql = "select * from device_type"; SqlRowSet row = template.queryForRowSet(sql); List<DeviceType> list = new ArrayList<>(); DeviceType deviceType = null; while (row.next()) { deviceType = new DeviceType(); deviceType.setTypeId(row.getInt("type_id")); deviceType.setName(row.getString("name")); deviceType.setImgUrl(row.getString("img_url")); list.add(deviceType); } return list; }  }
DeviceTypeDaoImpl implements DeviceTypeDao { @Override public List<DeviceType> getDeviceTypeList() { String sql = "select * from device_type"; SqlRowSet row = template.queryForRowSet(sql); List<DeviceType> list = new ArrayList<>(); DeviceType deviceType = null; while (row.next()) { deviceType = new DeviceType(); deviceType.setTypeId(row.getInt("type_id")); deviceType.setName(row.getString("name")); deviceType.setImgUrl(row.getString("img_url")); list.add(deviceType); } return list; }  JdbcTemplate getTemplate(); void setTemplate(JdbcTemplate template); @Override void insert(List<DeviceType> deviceTypes); @Override void insert(DeviceType deviceType); @Override List<DeviceType> getDeviceTypeList(); }
DeviceTypeDaoImpl implements DeviceTypeDao { @Override public List<DeviceType> getDeviceTypeList() { String sql = "select * from device_type"; SqlRowSet row = template.queryForRowSet(sql); List<DeviceType> list = new ArrayList<>(); DeviceType deviceType = null; while (row.next()) { deviceType = new DeviceType(); deviceType.setTypeId(row.getInt("type_id")); deviceType.setName(row.getString("name")); deviceType.setImgUrl(row.getString("img_url")); list.add(deviceType); } return list; }  JdbcTemplate getTemplate(); void setTemplate(JdbcTemplate template); @Override void insert(List<DeviceType> deviceTypes); @Override void insert(DeviceType deviceType); @Override List<DeviceType> getDeviceTypeList();  }