Listar postulantes por tecnologia

parent c492342c
...@@ -15,6 +15,10 @@ import org.springframework.stereotype.Controller; ...@@ -15,6 +15,10 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.sql.SQLOutput;
import java.util.List;
@Controller @Controller
...@@ -64,4 +68,12 @@ public class PostulanteController { ...@@ -64,4 +68,12 @@ public class PostulanteController {
.body(ex.getMessage()); .body(ex.getMessage());
} }
@GetMapping("/getPostulanteByTec_test/{name}")
public ModelAndView getPostTec(@PathVariable("name") String name){
System.out.println(name);
ModelAndView mv = new ModelAndView("list-test");
mv.addObject("lista", post.buscarPostulantesPorTecnologia(name));
return mv;
}
} }
...@@ -3,8 +3,17 @@ package com.roshka.repositorio; ...@@ -3,8 +3,17 @@ package com.roshka.repositorio;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import com.roshka.modelo.Postulante; import com.roshka.modelo.Postulante;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface PostulanteRepository extends JpaRepository<Postulante,Long> { public interface PostulanteRepository extends JpaRepository<Postulante,Long> {
@Query("select p from Postulante p " +
"JOIN PostulanteTecnologia pt ON pt.postulante.id = p.id " +
"JOIN Tecnologia t ON t.id = pt.tecnologia.id " +
"WHERE t.nombre = ?1")
public List<Postulante> buscarPostulantesPorTecnologia(String nombre);
} }
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<c:set var="valores" scope="session" value="${{1, 2, 3, 4, 5, 6}}"/>
</head>
<body>
<div class="container">
<div class="row mt-3"><h2>Lenguajes</h2></div>
<div class="row mt-3">
<ul>
<c:forEach items="${lista}" var="item">
<li>${item.nombre}</li>
</c:forEach>
</ul>
</div>
</div>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment