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
b14b8070
Commit
b14b8070
authored
Sep 11, 2022
by
Nikola Markovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OglasRepository - procedure
parent
6f9c4805
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
+1
-3
SkuciSe/src/main/java/com/example/SkuciSe/repository/OglasRepository.java
+13
-6
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
View file @
b14b8070
...
...
@@ -36,8 +36,7 @@ public class KorisnikRepository
stmt
.
setInt
(
6
,
1
);
stmt
.
setString
(
7
,
slika
);
stmt
.
setInt
(
8
,
korisnik
.
getGradId
());
stmt
.
addBatch
();
stmt
.
executeBatch
();
stmt
.
execute
();
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
catch
(
SQLException
e
)
{
...
...
@@ -62,7 +61,6 @@ public class KorisnikRepository
stmt
.
setString
(
4
,
korisnik
.
getTelefon
());
stmt
.
setInt
(
5
,
korisnik
.
getGradId
());
stmt
.
setInt
(
6
,
korisnik
.
getKorisnikId
());
System
.
out
.
println
(
stmt
.
toString
());
stmt
.
execute
();
}
catch
(
SQLException
e
)
{
...
...
SkuciSe/src/main/java/com/example/SkuciSe/repository/OglasRepository.java
View file @
b14b8070
...
...
@@ -109,9 +109,12 @@ public class OglasRepository
}
public
void
deleteSlike
(
Integer
id
)
{
String
sql
=
"delete from slike where oglasid = "
+
id
;
String
sql
=
"{call deleteSlike(?)}"
;
CallableStatement
cs
=
null
;
try
{
dataBase
.
statement
.
execute
(
sql
);
cs
=
dataBase
.
connection
.
prepareCall
(
sql
);
cs
.
setInt
(
1
,
id
);
cs
.
execute
();
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
@@ -120,10 +123,12 @@ public class OglasRepository
public
List
<
Oglas
>
findAll
(
Integer
vrstaOglasaId
,
Integer
lokacijaId
,
Integer
brojSoba
,
Double
cenaMin
,
Double
cenaMax
,
Double
kvadraturaMin
,
Double
kvadraturaMax
,
Boolean
lift
,
Boolean
grejanje
,
Boolean
namesten
)
{
List
<
Oglas
>
list
=
new
ArrayList
<
Oglas
>();
String
sql
=
"
select * from oglas
"
;
String
sql
=
"
{call findAll()}
"
;
ResultSet
rs
=
null
;
CallableStatement
stmt
=
null
;
try
{
rs
=
dataBase
.
statement
.
executeQuery
(
sql
);
stmt
=
dataBase
.
connection
.
prepareCall
(
sql
);
rs
=
stmt
.
executeQuery
();
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"
));
...
...
@@ -154,10 +159,12 @@ public class OglasRepository
public
List
<
Oglas
>
findAllByKorisnikId
(
int
korisnikId
,
Integer
vrstaOglasaId
,
Integer
lokacijaId
,
Integer
brojSoba
,
Double
cenaMin
,
Double
cenaMax
,
Double
kvadraturaMin
,
Double
kvadraturaMax
,
Boolean
lift
,
Boolean
grejanje
,
Boolean
namesten
)
{
List
<
Oglas
>
list
=
new
ArrayList
<
Oglas
>();
String
sql
=
"
select * from oglas where korisnikid = "
+
korisnikId
;
String
sql
=
"
call findAllByKorisnikId(?)"
;
ResultSet
rs
=
null
;
CallableStatement
stmt
=
null
;
try
{
rs
=
dataBase
.
statement
.
executeQuery
(
sql
);
stmt
=
dataBase
.
connection
.
prepareCall
(
sql
);
rs
=
stmt
.
executeQuery
();
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"
));
...
...
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