Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amparo Oliver
th-app-java
Commits
01dc9393
Commit
01dc9393
authored
Nov 09, 2021
by
Joel Florentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
paginacion en listado postulante
parent
792f746c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
10 deletions
+42
-10
curriculumsearch/src/main/java/com/roshka/DTO/PostulanteListaDTO.java
+4
-4
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
+10
-2
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
+3
-3
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java
+3
-1
curriculumsearch/src/main/webapp/jsp/postulantes.jsp
+22
-0
No files found.
curriculumsearch/src/main/java/com/roshka/DTO/PostulanteListaDTO.java
View file @
01dc9393
...
...
@@ -10,11 +10,11 @@ public class PostulanteListaDTO {
private
String
nombre
;
private
String
apellido
;
private
Disponibilidad
disponibilidad
;
private
Integer
nivelIngles
;
private
Long
nivelIngles
;
private
Long
experienciaMeses
;
private
List
<
PostulanteTecnologia
>
tecnologias
;
public
PostulanteListaDTO
(
Long
id
,
String
nombre
,
String
apellido
,
Disponibilidad
disponibilidad
,
Integer
nivelIngles
,
Long
experienciaMeses
,
List
<
PostulanteTecnologia
>
tecnologias
)
{
Long
nivelIngles
,
Long
experienciaMeses
,
List
<
PostulanteTecnologia
>
tecnologias
)
{
this
.
id
=
id
;
this
.
nombre
=
nombre
;
this
.
apellido
=
apellido
;
...
...
@@ -47,10 +47,10 @@ public class PostulanteListaDTO {
public
void
setDisponibilidad
(
Disponibilidad
disponibilidad
)
{
this
.
disponibilidad
=
disponibilidad
;
}
public
Integer
getNivelIngles
()
{
public
Long
getNivelIngles
()
{
return
nivelIngles
;
}
public
void
setNivelIngles
(
Integer
nivelIngles
)
{
public
void
setNivelIngles
(
Long
nivelIngles
)
{
this
.
nivelIngles
=
nivelIngles
;
}
public
Long
getExperienciaMeses
()
{
...
...
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
View file @
01dc9393
...
...
@@ -30,6 +30,9 @@ import com.roshka.utils.Helper;
import
org.hibernate.jpa.TypedParameterValue
;
import
org.hibernate.type.StringType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -76,12 +79,16 @@ public class PostulanteController {
@RequestParam
(
required
=
false
)
Long
lvlEng
,
@RequestParam
(
required
=
false
)
Long
lvlTec
,
@RequestParam
(
required
=
false
)
Long
instId
,
@RequestParam
(
required
=
false
)
Long
expInMonths
@RequestParam
(
required
=
false
)
Long
expInMonths
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
nroPagina
)
{
final
Integer
CANTIDAD_POR_PAGINA
=
5
;
Pageable
page
=
PageRequest
.
of
(
nroPagina
,
CANTIDAD_POR_PAGINA
);
model
.
addAttribute
(
"tecnologias"
,
tecRepo
.
findAll
());
model
.
addAttribute
(
"disponibilidades"
,
Disponibilidad
.
values
());
model
.
addAttribute
(
"institucionesEducativas"
,
institucionRepository
.
findAll
());
List
<
Postulante
>
postulantes
=
post
.
postulantesMultiFiltro
(
nombre
==
null
||
nombre
.
trim
().
isEmpty
()
?
new
TypedParameterValue
(
StringType
.
INSTANCE
,
null
)
:
new
TypedParameterValue
(
StringType
.
INSTANCE
,
"%"
+
nombre
+
"%"
),
dispo
,
lvlEng
,
lvlTec
,
tecId
,
instId
);
Page
<
Postulante
>
postulantesPag
=
post
.
postulantesMultiFiltro
(
nombre
==
null
||
nombre
.
trim
().
isEmpty
()
?
new
TypedParameterValue
(
StringType
.
INSTANCE
,
null
)
:
new
TypedParameterValue
(
StringType
.
INSTANCE
,
"%"
+
nombre
+
"%"
),
dispo
,
lvlEng
,
lvlTec
,
tecId
,
instId
,
page
);
List
<
Postulante
>
postulantes
=
postulantesPag
.
getContent
();
List
<
PostulanteListaDTO
>
postulantesDTO
=
new
ArrayList
<>();
for
(
Postulante
postulante
:
postulantes
)
{
...
...
@@ -95,6 +102,7 @@ public class PostulanteController {
postulantesDTO
.
add
(
new
PostulanteListaDTO
(
postulante
.
getId
(),
postulante
.
getNombre
(),
postulante
.
getApellido
(),
postulante
.
getDisponibilidad
(),
postulante
.
getNivelIngles
(),
expTotal
,
postulante
.
getTecnologias
()));
}
model
.
addAttribute
(
"pages"
,
postulantesPag
.
getTotalPages
());
model
.
addAttribute
(
"postulantes"
,
postulantesDTO
);
return
"postulantes"
;
}
...
...
curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java
View file @
01dc9393
...
...
@@ -61,7 +61,7 @@ public class Postulante {
@Column
(
name
=
"nivel_ingles"
)
@Min
(
value
=
1
)
@Max
(
value
=
5
)
private
Integer
nivelIngles
;
private
Long
nivelIngles
;
@Column
(
name
=
"curriculum"
)
private
String
curriculum
;
...
...
@@ -175,11 +175,11 @@ public class Postulante {
this
.
resumen
=
resumen
;
}
public
Integer
getNivelIngles
()
{
public
Long
getNivelIngles
()
{
return
nivelIngles
;
}
public
void
setNivelIngles
(
Integer
nivelIngles
)
{
public
void
setNivelIngles
(
Long
nivelIngles
)
{
this
.
nivelIngles
=
nivelIngles
;
}
...
...
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java
View file @
01dc9393
...
...
@@ -3,6 +3,8 @@ package com.roshka.repositorio;
import
java.util.List
;
import
org.hibernate.jpa.TypedParameterValue
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
...
...
@@ -50,6 +52,6 @@ public interface PostulanteRepository extends JpaRepository<Postulante,Long> {
"and (pt.nivel >= ?4 or ?4 is null) "
+
"and (pt.tecnologia.id = ?5 or ?5 is null) "
+
" and (e.institucion.id = ?6 or ?6 is null ) "
)
public
List
<
Postulante
>
postulantesMultiFiltro
(
TypedParameterValue
nombre
,
Disponibilidad
disponibilidad
,
Long
nivelInges
,
Long
nivel
,
Long
tecnoId
,
Long
instId
);
public
Page
<
Postulante
>
postulantesMultiFiltro
(
TypedParameterValue
nombre
,
Disponibilidad
disponibilidad
,
Long
nivelInges
,
Long
nivel
,
Long
tecnoId
,
Long
instId
,
Pageable
pageable
);
}
curriculumsearch/src/main/webapp/jsp/postulantes.jsp
View file @
01dc9393
...
...
@@ -91,7 +91,17 @@
<td><a
href=
"/postulante/${postulante.id}"
>
Ver
</a></td>
</tr>
</c:forEach>
</tbody>
</table>
<div>
<nav
aria-label=
"Page navigation example"
>
<ul
class=
"pagination"
>
<c:forEach
begin=
"1"
end=
"${pages}"
var=
"nro"
>
<li
class=
"page-item"
><a
class=
"page-link"
href=
"javascript:buscarPagina(${nro})"
>
${nro}
</a></li>
</c:forEach>
</ul>
</nav>
</div>
<script>
function
habilitarLvlTec
(){
...
...
@@ -102,10 +112,21 @@
}
}
function
buscarPagina
(
nro
){
nro
--
const
aBuscar
=
'nroPagina='
+
nro
if
(
!
location
.
search
)
location
.
search
=
"?"
+
aBuscar
const
inicial
=
location
.
search
.
search
(
aBuscar
);
if
(
inicial
==-
1
){
//si no se encuentra y hay otros queries
location
.
search
=
"&"
+
aBuscar
}
location
.
search
.
replace
(
'nroPagina='
,
aBuscar
)
}
const
tecId
=
document
.
querySelector
(
"#tecId"
);
const
lvlTec
=
document
.
querySelector
(
"#lvlTec"
);
tecId
.
addEventListener
(
'change'
,
habilitarLvlTec
);
habilitarLvlTec
()
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment