Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SkuciSe
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
Tim 2 - 2022
SkuciSe
Commits
68d2153b
Commit
68d2153b
authored
Sep 10, 2022
by
Bogdan Andjelkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filtriranje oglasa - back
parent
f044fe2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletions
+29
-1
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
+1
-1
SkuciSe/src/main/java/com/example/SkuciSe/repository/OglasRepository.java
+28
-0
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
View file @
68d2153b
...
...
@@ -64,7 +64,7 @@ public class OglasController
@RequestParam
(
value
=
"namesten"
,
required
=
false
)
Boolean
namesten
)
{
model
.
addAttribute
(
"loggedUser"
,
loggedUser
);
List
<
Oglas
>
listaOglasa
=
oRepo
.
findAll
();
List
<
Oglas
>
listaOglasa
=
oRepo
.
findAll
(
vrstaOglasaId
,
lokacijaId
,
cenaMin
,
cenaMax
,
brojSoba
,
kvadratura
,
lift
,
grejanje
,
namesten
);
while
(
listaOglasa
.
size
()
%
3
!=
0
){
Oglas
o
=
new
Oglas
();
listaOglasa
.
add
(
o
);
...
...
SkuciSe/src/main/java/com/example/SkuciSe/repository/OglasRepository.java
View file @
68d2153b
...
...
@@ -143,4 +143,31 @@ public class OglasRepository
throw
new
RuntimeException
(
e
);
}
}
public
List
<
Oglas
>
findAll
(
Integer
vrstaOglasaId
,
Integer
lokacijaId
,
Double
cenaMin
,
Double
cenaMax
,
Integer
brojSoba
,
Double
kvadratura
,
Boolean
lift
,
Boolean
grejanje
,
Boolean
namesten
)
{
List
<
Oglas
>
list
=
new
ArrayList
<
Oglas
>();
String
sql
=
"select * from oglas"
;
ResultSet
rs
=
null
;
try
{
rs
=
dataBase
.
statement
.
executeQuery
(
sql
);
while
(
rs
.
next
())
{
Oglas
oglas
=
new
Oglas
(
rs
.
getInt
(
"oglasId"
),
rs
.
getInt
(
"korisnikId"
),
rs
.
getString
(
"naslov"
),
rs
.
getString
(
"opis"
),
rs
.
getInt
(
"lokacijaId"
),
rs
.
getDouble
(
"cena"
),
rs
.
getInt
(
"vrstaOglasaId"
),
rs
.
getDouble
(
"kvadratura"
),
rs
.
getInt
(
"brojSoba"
),
rs
.
getBoolean
(
"namesten"
),
rs
.
getBoolean
(
"grejanje"
),
rs
.
getBoolean
(
"lift"
),
rs
.
getString
(
"lokacija"
));
if
(!(
vrstaOglasaId
==
null
||
(
vrstaOglasaId
!=
null
&&
vrstaOglasaId
==
oglas
.
getVrstaOglasaId
()
)
)
)
continue
;
if
(!(
lokacijaId
==
null
||
(
lokacijaId
!=
null
&&
lokacijaId
==
oglas
.
getLokacijaId
()
)
)
)
continue
;
if
(!(
cenaMin
==
null
||
(
cenaMin
!=
null
&&
cenaMin
<=
oglas
.
getCena
()
)
)
)
continue
;
if
(!(
cenaMax
==
null
||
(
cenaMax
!=
null
&&
cenaMax
>=
oglas
.
getCena
()
)
)
)
continue
;
if
(!(
brojSoba
==
null
||
(
brojSoba
!=
null
&&
brojSoba
==
oglas
.
getBrojSoba
()
)
)
)
continue
;
if
(!(
kvadratura
==
null
||
(
kvadratura
!=
null
&&
kvadratura
==
oglas
.
getKvadratura
()
)
)
)
continue
;
if
(!(
lift
==
null
||
(
lift
!=
null
&&
lift
==
oglas
.
isLift
()
)
)
)
continue
;
if
(!(
grejanje
==
null
||
(
grejanje
!=
null
&&
grejanje
==
oglas
.
isGrejanje
()
)
)
)
continue
;
if
(!(
namesten
==
null
||
(
namesten
!=
null
&&
namesten
==
oglas
.
isNamesten
()
)
)
)
continue
;
list
.
add
(
oglas
);
}
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
(
list
);
}
}
\ 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