Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
Ecsite
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shoei.kanno
Ecsite
Commits
9facbd5f
Commit
9facbd5f
authored
Oct 20, 2020
by
keita.onoguchi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'カート機能' into 'master'
カート機能 See merge request
!37
parents
d398f9d9
173f067c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
ShoesService.java
src/main/java/com/example/service/ShoesService.java
+0
-1
EcsiteController.java
src/main/java/com/example/web/EcsiteController.java
+8
-4
No files found.
src/main/java/com/example/service/ShoesService.java
View file @
9facbd5f
package
com
.
example
.
service
;
import
java.util.Collections
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
src/main/java/com/example/web/EcsiteController.java
View file @
9facbd5f
...
...
@@ -84,6 +84,7 @@ HttpSession session;
public
String
list
(
Model
model
,
@AuthenticationPrincipal
LoginUser
userDetails
)
{
//靴の情報をすべて取得
List
<
Shoes
>
shoes
=
shoesService
.
findAll
();
System
.
out
.
println
(
shoes
);
//靴の情報を一括で取得するmodel(Idでの降順表示設定済み)
model
.
addAttribute
(
"shoes"
,
shoes
);
//靴を表示するための処理を全画像にかける
...
...
@@ -122,12 +123,15 @@ HttpSession session;
}
@GetMapping
(
"cart"
)
public
String
Cart
(
Model
model
,
@AuthenticationPrincipal
LoginUser
userDetails
,
HashMap
<
String
,
Items
>
cart
){
public
String
Cart
(
Model
model
,
@AuthenticationPrincipal
LoginUser
userDetails
,
HashMap
<
String
,
Items
>
items
,
ArrayList
<
Items
>
cart
){
User
user
=
userDetails
.
getUser
();
model
.
addAttribute
(
"user"
,
user
);
cart
=
(
HashMap
<
String
,
Items
>)
session
.
getAttribute
(
"cart"
);
// cart.forEach((key, value) ->{
// });
items
=
(
HashMap
<
String
,
Items
>)
session
.
getAttribute
(
"cart"
);
for
(
int
i
=
0
;
i
<
items
.
size
();
i
++){
String
key
=
String
.
valueOf
(
i
);
cart
.
add
(
items
.
get
(
key
));
}
System
.
out
.
println
((
cart
.
get
(
1
)).
getShoesName
());
return
"Cart"
;
}
}
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