From dca3cb0140c32419140fbc7a4664c55043570931 Mon Sep 17 00:00:00 2001 From: Giuli1297 Date: Wed, 3 Nov 2021 16:05:48 -0300 Subject: [PATCH] Listar postulantes por tecnologia --- curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java | 12 ++++++++++++ curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java | 11 ++++++++++- curriculumsearch/src/main/webapp/jsp/list-test.jsp | 21 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 curriculumsearch/src/main/webapp/jsp/list-test.jsp diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java index 7e4eec7..44a786b 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java @@ -15,6 +15,10 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import java.sql.SQLOutput; +import java.util.List; @Controller @@ -64,4 +68,12 @@ public class PostulanteController { .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; + } + } diff --git a/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java b/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java index 6ea288f..ab6d13c 100644 --- a/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java +++ b/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java @@ -3,8 +3,17 @@ package com.roshka.repositorio; import org.springframework.data.jpa.repository.JpaRepository; 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 { - + @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 buscarPostulantesPorTecnologia(String nombre); + } diff --git a/curriculumsearch/src/main/webapp/jsp/list-test.jsp b/curriculumsearch/src/main/webapp/jsp/list-test.jsp new file mode 100644 index 0000000..0965ce8 --- /dev/null +++ b/curriculumsearch/src/main/webapp/jsp/list-test.jsp @@ -0,0 +1,21 @@ +<%@ 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" %> + + + + + + +
+

Lenguajes

+
+
    + +
  • ${item.nombre}
  • +
    +
+
+
+ + -- libgit2 0.26.0