Merge remote-tracking branch 'origin/frontend'
This commit is contained in:
parent
5b67fb75aa
commit
56a9101d62
@ -14,7 +14,7 @@
|
|||||||
// let url = "https://jsonplaceholder.typicode.com/photos";
|
// let url = "https://jsonplaceholder.typicode.com/photos";
|
||||||
// let url = "https://webhook.site/b1792c3d-cd5a-4c29-8e9c-1ff9f84653eb";
|
// let url = "https://webhook.site/b1792c3d-cd5a-4c29-8e9c-1ff9f84653eb";
|
||||||
// let url = "http://34.65.132.148:8080";
|
// let url = "http://34.65.132.148:8080";
|
||||||
let url = "http://localhost:8080/api/cars/search";
|
let url = "http://localhost:8080/car/api/search";
|
||||||
var params = [];
|
var params = [];
|
||||||
if(fuel_type.value != -1){
|
if(fuel_type.value != -1){
|
||||||
params.push("fuel_type="+fuel_type.options[fuel_type.value].text);
|
params.push("fuel_type="+fuel_type.options[fuel_type.value].text);
|
||||||
|
@ -132,8 +132,8 @@
|
|||||||
Skrzynia biegów:
|
Skrzynia biegów:
|
||||||
<select id="gearbox">
|
<select id="gearbox">
|
||||||
<option value="-1">Dowolna</option>
|
<option value="-1">Dowolna</option>
|
||||||
<option value="manual">Manualna</option>
|
<option value="Manual">Manualna</option>
|
||||||
<option value="automatic">Automatyczna</option>
|
<option value="Automatic">Automatyczna</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -143,9 +143,9 @@
|
|||||||
Rodzaj napędu:
|
Rodzaj napędu:
|
||||||
<select id="drive_type">
|
<select id="drive_type">
|
||||||
<option value="-1">Dowolny</option>
|
<option value="-1">Dowolny</option>
|
||||||
<option value="1">Na przednie koła</option>
|
<option value="przednie">Na przednie koła</option>
|
||||||
<option value="2">Na tylnie koła</option>
|
<option value="tylnie">Na tylnie koła</option>
|
||||||
<option value="3">Na cztery koła</option>
|
<option value="4x4">Na cztery koła</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,8 +2,6 @@ package com.cars.car4you.api;
|
|||||||
|
|
||||||
import com.cars.car4you.dto.CarDto;
|
import com.cars.car4you.dto.CarDto;
|
||||||
import com.cars.car4you.model.Car;
|
import com.cars.car4you.model.Car;
|
||||||
import com.cars.car4you.model.CarDetails;
|
|
||||||
import com.cars.car4you.repository.CarDetailRepository;
|
|
||||||
import com.cars.car4you.repository.CarRepository;
|
import com.cars.car4you.repository.CarRepository;
|
||||||
import com.cars.car4you.service.CarService;
|
import com.cars.car4you.service.CarService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -11,18 +11,18 @@ public class CarDto {
|
|||||||
private String brand;
|
private String brand;
|
||||||
private String model;
|
private String model;
|
||||||
private String version;
|
private String version;
|
||||||
private int year;
|
private Integer year;
|
||||||
private int engine_power;
|
private Integer engine_power;
|
||||||
private double engine_capacity;
|
private Double engine_capacity;
|
||||||
private String transmission;
|
private String transmission;
|
||||||
private String drive;
|
private String drive;
|
||||||
private String body_type;
|
private String body_type;
|
||||||
private int doors;
|
private Integer doors;
|
||||||
private int seats;
|
private Integer seats;
|
||||||
private long price_from;
|
private Long price_from;
|
||||||
private long price_to;
|
private Long price_to;
|
||||||
private long average;
|
private Long average;
|
||||||
private double rating;
|
private Double rating;
|
||||||
private String fuel;
|
private String fuel;
|
||||||
private String[] car_pros;
|
private String[] car_pros;
|
||||||
private String[] car_cons;
|
private String[] car_cons;
|
||||||
|
@ -58,7 +58,7 @@ public class Car {
|
|||||||
private Long price_to;
|
private Long price_to;
|
||||||
|
|
||||||
@Column(nullable = false, unique = false)
|
@Column(nullable = false, unique = false)
|
||||||
private Long avarage;
|
private Double avarage;
|
||||||
|
|
||||||
@Column(nullable = false, unique = false)
|
@Column(nullable = false, unique = false)
|
||||||
private String fuel;
|
private String fuel;
|
||||||
|
@ -35,7 +35,7 @@ public class CarRepositoryImpl implements CustomCarRepository {
|
|||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
|
|
||||||
if(maxPrice != null) predicates.add(criteriaBuilder.lessThanOrEqualTo(car.get("price_to"), maxPrice));
|
if(maxPrice != null) predicates.add(criteriaBuilder.lessThanOrEqualTo(car.get("price_to"), maxPrice));
|
||||||
if(maxYearsOld != null) predicates.add(criteriaBuilder.greaterThanOrEqualTo(car.get("year"),localDateTime.getYear() - maxYearsOld));
|
if(maxYearsOld != null) predicates.add(criteriaBuilder.greaterThanOrEqualTo(car.get("year"),localDateTime.getYear() - maxYearsOld - 1));
|
||||||
if(enginePowerFrom != null) predicates.add(criteriaBuilder.greaterThanOrEqualTo(car.get("engine_power"), enginePowerFrom));
|
if(enginePowerFrom != null) predicates.add(criteriaBuilder.greaterThanOrEqualTo(car.get("engine_power"), enginePowerFrom));
|
||||||
if(enginePowerTo != null) predicates.add(criteriaBuilder.lessThanOrEqualTo(car.get("engine_power"), enginePowerTo));
|
if(enginePowerTo != null) predicates.add(criteriaBuilder.lessThanOrEqualTo(car.get("engine_power"), enginePowerTo));
|
||||||
if(transmission != null && !transmission.isEmpty()) predicates.add(criteriaBuilder.like(car.get("transmission"), "%" + transmission + "%"));
|
if(transmission != null && !transmission.isEmpty()) predicates.add(criteriaBuilder.like(car.get("transmission"), "%" + transmission + "%"));
|
||||||
|
@ -32,7 +32,7 @@ public class CarService {
|
|||||||
// ceny
|
// ceny
|
||||||
carDto.setPrice_from(car.getPrice_from());
|
carDto.setPrice_from(car.getPrice_from());
|
||||||
carDto.setPrice_to(car.getPrice_to());
|
carDto.setPrice_to(car.getPrice_to());
|
||||||
carDto.setAverage(car.getAvarage());
|
carDto.setAverage(car.getAvarage().longValue());
|
||||||
|
|
||||||
// Parametry konieczne do przepisania z CarDetails (cars_details)
|
// Parametry konieczne do przepisania z CarDetails (cars_details)
|
||||||
carDto.setBrand(car.getCarDetails().getBrand());
|
carDto.setBrand(car.getCarDetails().getBrand());
|
||||||
@ -46,8 +46,9 @@ public class CarService {
|
|||||||
carDto.setAverage(car.getCarDetails().getAverage());
|
carDto.setAverage(car.getCarDetails().getAverage());
|
||||||
carDto.setCar_cons(car.getCarDetails().getCar_cons());
|
carDto.setCar_cons(car.getCarDetails().getCar_cons());
|
||||||
carDto.setCar_pros(car.getCarDetails().getCar_pros());
|
carDto.setCar_pros(car.getCarDetails().getCar_pros());
|
||||||
carDto.setRating(car.getCarDetails().getRating());
|
|
||||||
}
|
}
|
||||||
|
if(carDto.getRating() != null) carDto.setRating(car.getCarDetails().getRating());
|
||||||
|
|
||||||
|
|
||||||
return carDto;
|
return carDto;
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ spring.datasource.password=car4yourootek
|
|||||||
|
|
||||||
spring.jpa.show-sql=true
|
spring.jpa.show-sql=true
|
||||||
|
|
||||||
#spring.jpa.generate-ddl=true
|
spring.jpa.generate-ddl=true
|
||||||
|
|
||||||
#spring.jpa.hibernate.ddl-auto=validate
|
spring.jpa.hibernate.ddl-auto=validate
|
||||||
|
|
||||||
#spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=false
|
#spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=false
|
Loading…
Reference in New Issue
Block a user