|  | @@ -0,0 +1,31 @@
 | 
	
		
			
				|  |  | +package eu.jovian_hersemeule.dev.squad.squad_composer.controllers;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import eu.jovian_hersemeule.dev.squad.squad_composer.data.MechRowMapper;
 | 
	
		
			
				|  |  | +import eu.jovian_hersemeule.dev.squad.squad_composer.data.model.Mech;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import javax.sql.DataSource;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | +import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@RestController
 | 
	
		
			
				|  |  | +@RequestMapping("/mech")
 | 
	
		
			
				|  |  | +public class MechController {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private final JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    MechController(final DataSource ds) {
 | 
	
		
			
				|  |  | +        jdbcTemplate = new JdbcTemplate(ds);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping("/")
 | 
	
		
			
				|  |  | +    public List<Mech> list() {
 | 
	
		
			
				|  |  | +        return jdbcTemplate.query("SELECT * FROM MECH", new MechRowMapper());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +}
 |