|
|
|
@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
@ -60,16 +61,27 @@ public class BuscadorController {
|
|
|
|
|
@RequestParam(defaultValue = "asc") String sortDir,
|
|
|
|
|
@RequestParam String secondaryOption,
|
|
|
|
|
Model model){
|
|
|
|
|
Page<Empresa> page = empresaService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
String[] queryMultiWord = query.split(",");
|
|
|
|
|
List<String> queryList = new ArrayList<>();
|
|
|
|
|
for (String queryForList : queryMultiWord) {
|
|
|
|
|
String trimmedQuery = queryForList.trim();
|
|
|
|
|
if (!trimmedQuery.isEmpty()) {
|
|
|
|
|
queryList.add(trimmedQuery);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Integer> itemsPage = Arrays.asList(5, 10, 15, 20, 25, 50);
|
|
|
|
|
Page<Empresa> page = null;
|
|
|
|
|
if(queryMultiWord.length>1){
|
|
|
|
|
page = empresaService.getPageMultiWord(pageNum, size, sortField, sortDir, queryList, secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
page = empresaService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
}
|
|
|
|
|
if(page!=null){
|
|
|
|
|
List<Empresa> empresas = page.getContent();
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, query, itemsPage, size);
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, itemsPage, size);
|
|
|
|
|
model.addAttribute("empresas", empresas);
|
|
|
|
|
model.addAttribute("query", query);
|
|
|
|
|
model.addAttribute("secondaryOption", secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
// System.out.println("No se encontraron empresas");
|
|
|
|
|
}
|
|
|
|
|
return "/list/empresas";
|
|
|
|
|
}
|
|
|
|
@ -91,7 +103,6 @@ public class BuscadorController {
|
|
|
|
|
}
|
|
|
|
|
model.addAttribute("secondaryOption",secondaryOption);
|
|
|
|
|
return "/list/sectores";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/contactos/page/{pageNum}")
|
|
|
|
@ -100,18 +111,29 @@ public class BuscadorController {
|
|
|
|
|
@RequestParam(defaultValue = "10") int size,
|
|
|
|
|
@RequestParam(defaultValue = "nombre") String sortField,
|
|
|
|
|
@RequestParam(defaultValue = "asc") String sortDir,
|
|
|
|
|
@RequestParam(defaultValue = "") String secondaryOption,
|
|
|
|
|
@RequestParam String secondaryOption,
|
|
|
|
|
Model model) {
|
|
|
|
|
Page<Contacto> page = contactosService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
String[] queryMultiWord = query.split(",");
|
|
|
|
|
List<String> queryList = new ArrayList<>();
|
|
|
|
|
for (String queryForList : queryMultiWord) {
|
|
|
|
|
String trimmedQuery = queryForList.trim();
|
|
|
|
|
if (!trimmedQuery.isEmpty()) {
|
|
|
|
|
queryList.add(trimmedQuery);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Integer> itemsPage = Arrays.asList(5, 10, 15, 20, 25, 50);
|
|
|
|
|
Page<Contacto> page = null;
|
|
|
|
|
if(queryMultiWord.length>1){
|
|
|
|
|
page = contactosService.getPageMultiWord(pageNum, size, sortField, sortDir, queryList, secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
page = contactosService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
}
|
|
|
|
|
if(page!=null){
|
|
|
|
|
List<Contacto> contactos = page.getContent();
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, query, itemsPage, size);
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, itemsPage, size);
|
|
|
|
|
model.addAttribute("contactos", contactos);
|
|
|
|
|
model.addAttribute("query", query);
|
|
|
|
|
model.addAttribute("secondaryOption", secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
//System.out.println("No se encontraron Contactos");
|
|
|
|
|
}
|
|
|
|
|
return "/list/contactos";
|
|
|
|
|
}
|
|
|
|
@ -122,18 +144,30 @@ public class BuscadorController {
|
|
|
|
|
@RequestParam(defaultValue = "10") int size,
|
|
|
|
|
@RequestParam(defaultValue = "nombre") String sortField,
|
|
|
|
|
@RequestParam(defaultValue = "asc") String sortDir,
|
|
|
|
|
@RequestParam(defaultValue = "") String secondaryOption,
|
|
|
|
|
Model model){
|
|
|
|
|
Page<Sucursal> page = sucursalService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
@RequestParam String secondaryOption,
|
|
|
|
|
Model model) {
|
|
|
|
|
String[] queryMultiWord = query.split(",");
|
|
|
|
|
List<String> queryList = new ArrayList<>();
|
|
|
|
|
for (String queryForList : queryMultiWord) {
|
|
|
|
|
String trimmedQuery = queryForList.trim();
|
|
|
|
|
if (!trimmedQuery.isEmpty()) {
|
|
|
|
|
queryList.add(trimmedQuery);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Integer> itemsPage = Arrays.asList(5, 10, 15, 20, 25, 50);
|
|
|
|
|
Page<Sucursal> page = null;
|
|
|
|
|
|
|
|
|
|
if(queryMultiWord.length>1){
|
|
|
|
|
page = sucursalService.getPageMultiWord(pageNum, size, sortField, sortDir, queryList, secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
page = sucursalService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
}
|
|
|
|
|
if(page!=null){
|
|
|
|
|
List<Sucursal> sucursals = page.getContent();
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, query, itemsPage, size);
|
|
|
|
|
model.addAttribute("sucursals",sucursals);
|
|
|
|
|
List<Sucursal> sucursales = page.getContent();
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, itemsPage, size);
|
|
|
|
|
model.addAttribute("sucursales", sucursales);
|
|
|
|
|
model.addAttribute("query", query);
|
|
|
|
|
model.addAttribute("secondaryOption", secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
// System.out.println("No se encontraron sucursales");
|
|
|
|
|
}
|
|
|
|
|
return "/list/sucursales";
|
|
|
|
|
}
|
|
|
|
@ -145,17 +179,30 @@ public class BuscadorController {
|
|
|
|
|
@RequestParam(defaultValue = "nombre") String sortField,
|
|
|
|
|
@RequestParam(defaultValue = "asc") String sortDir,
|
|
|
|
|
@RequestParam(defaultValue = "") String secondaryOption,
|
|
|
|
|
Model model){
|
|
|
|
|
Page<Oferta> page = ofertasService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
Model model) throws ParseException {
|
|
|
|
|
System.out.println("Query: TEST " + query);
|
|
|
|
|
String[] queryMultiWord = query.split(",");
|
|
|
|
|
List<String> queryList = new ArrayList<>();
|
|
|
|
|
for (String queryForList : queryMultiWord) {
|
|
|
|
|
String trimmedQuery = queryForList.trim();
|
|
|
|
|
if (!trimmedQuery.isEmpty()) {
|
|
|
|
|
queryList.add(trimmedQuery);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Integer> itemsPage = Arrays.asList(5, 10, 15, 20, 25, 50);
|
|
|
|
|
Page<Oferta> page = null;
|
|
|
|
|
|
|
|
|
|
if(queryMultiWord.length>1){
|
|
|
|
|
page = ofertasService.getPageMultiWord(pageNum, size, sortField, sortDir, queryList, secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
page = ofertasService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
}
|
|
|
|
|
if(page!=null){
|
|
|
|
|
List<Oferta> ofertas = page.getContent();
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, query, itemsPage, size);
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, itemsPage, size);
|
|
|
|
|
model.addAttribute("ofertas", ofertas);
|
|
|
|
|
model.addAttribute("query", query);
|
|
|
|
|
model.addAttribute("secondaryOption", secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
// System.out.println("No se encontraron ofertas");
|
|
|
|
|
}
|
|
|
|
|
return "/list/ofertas";
|
|
|
|
|
}
|
|
|
|
@ -190,17 +237,30 @@ public class BuscadorController {
|
|
|
|
|
@RequestParam(defaultValue = "nombre") String sortField,
|
|
|
|
|
@RequestParam(defaultValue = "asc") String sortDir,
|
|
|
|
|
@RequestParam(defaultValue = "") String secondaryOption,
|
|
|
|
|
Model model) {
|
|
|
|
|
Page<Ciclo> page =cicloService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
Model model) throws ParseException {
|
|
|
|
|
System.out.println("Query: TEST " + query);
|
|
|
|
|
String[] queryMultiWord = query.split(",");
|
|
|
|
|
List<String> queryList = new ArrayList<>();
|
|
|
|
|
for (String queryForList : queryMultiWord) {
|
|
|
|
|
String trimmedQuery = queryForList.trim();
|
|
|
|
|
if (!trimmedQuery.isEmpty()) {
|
|
|
|
|
queryList.add(trimmedQuery);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Integer> itemsPage = Arrays.asList(5, 10, 15, 20, 25, 50);
|
|
|
|
|
Page<Ciclo> page = null;
|
|
|
|
|
|
|
|
|
|
if(queryMultiWord.length>1){
|
|
|
|
|
page = cicloService.getPageMultiWord(pageNum, size, sortField, sortDir, queryList, secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
page = cicloService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
}
|
|
|
|
|
if(page!=null){
|
|
|
|
|
List<Ciclo> ciclos = page.getContent();
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, query, itemsPage, size);
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, itemsPage, size);
|
|
|
|
|
model.addAttribute("ciclos", ciclos);
|
|
|
|
|
model.addAttribute("query", query);
|
|
|
|
|
model.addAttribute("secondaryOption", secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
// System.out.println("No se encontraron ofertas");
|
|
|
|
|
}
|
|
|
|
|
return "/list/ciclos";
|
|
|
|
|
}
|
|
|
|
@ -214,17 +274,32 @@ public class BuscadorController {
|
|
|
|
|
@RequestParam(defaultValue = "") String secondaryOption,
|
|
|
|
|
Model model) {
|
|
|
|
|
|
|
|
|
|
Page<Alumno> page = alumnoService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
String[] queryMultiWord = query.split(",");
|
|
|
|
|
List<String> queryList = new ArrayList<>();
|
|
|
|
|
for (String queryForList : queryMultiWord) {
|
|
|
|
|
String trimmedQuery = queryForList.trim();
|
|
|
|
|
if (!trimmedQuery.isEmpty()) {
|
|
|
|
|
queryList.add(trimmedQuery);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Integer> itemsPage = Arrays.asList(5, 10, 15, 20, 25, 50);
|
|
|
|
|
Page<Alumno> page = null;
|
|
|
|
|
|
|
|
|
|
if(queryMultiWord.length>1){
|
|
|
|
|
page = alumnoService.getPageMultiWord(pageNum, size, sortField, sortDir, queryList, secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
page = alumnoService.getPage(pageNum, size, sortField, sortDir, query, secondaryOption);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(page!=null){
|
|
|
|
|
List<Alumno> alumnos = page.getContent();
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, query, itemsPage, size);
|
|
|
|
|
addPaginationAttributes(model, pageNum, page, sortField, sortDir, itemsPage, size);
|
|
|
|
|
model.addAttribute("alumnos", alumnos);
|
|
|
|
|
model.addAttribute("query", query);
|
|
|
|
|
model.addAttribute("secondaryOption", secondaryOption);
|
|
|
|
|
}else{
|
|
|
|
|
// System.out.println("No se encontraron alumnos");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "/list/alumnos";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -268,7 +343,7 @@ public class BuscadorController {
|
|
|
|
|
return attributes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void addPaginationAttributes(Model model, int pageNum, Page<?> page, String sortField, String sortDir, String query, List<Integer> itemsPage, int size) {
|
|
|
|
|
public void addPaginationAttributes(Model model, int pageNum, Page<?> page, String sortField, String sortDir, List<Integer> itemsPage, int size) {
|
|
|
|
|
model.addAttribute("currentPage", pageNum);
|
|
|
|
|
model.addAttribute("totalPages", page.getTotalPages());
|
|
|
|
|
model.addAttribute("totalItems", page.getTotalElements());
|
|
|
|
|