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
9425bde9
Commit
9425bde9
authored
Oct 18, 2020
by
shoei.kanno
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '購入履歴画面機能' into 'master'
購入履歴機能完成(画像を載せるかは未定) See merge request
!24
parents
e1fdfadc
29a41f6b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
6 deletions
+152
-6
SalesLogRepository.java
src/main/java/com/example/repository/SalesLogRepository.java
+2
-2
SalesLogService.java
src/main/java/com/example/service/SalesLogService.java
+2
-2
EcsiteController.java
src/main/java/com/example/web/EcsiteController.java
+11
-1
log.html
src/main/resources/templates/log.html
+1
-1
logDetails.html
src/main/resources/templates/logDetails.html
+136
-0
No files found.
src/main/java/com/example/repository/SalesLogRepository.java
View file @
9425bde9
...
@@ -14,7 +14,7 @@ public interface SalesLogRepository extends JpaRepository<SalesLog, Integer>{
...
@@ -14,7 +14,7 @@ public interface SalesLogRepository extends JpaRepository<SalesLog, Integer>{
@Query
(
value
=
"SELECT id,user_id, shoes_id, SUM(price) AS price, created FROM sales_logs AS sl WHERE sl.user_id = ?1 GROUP BY sl.created"
,
@Query
(
value
=
"SELECT id,user_id, shoes_id, SUM(price) AS price, created FROM sales_logs AS sl WHERE sl.user_id = ?1 GROUP BY sl.created"
,
nativeQuery
=
true
)
nativeQuery
=
true
)
public
List
<
SalesLog
>
history
(
Integer
id
);
public
List
<
SalesLog
>
history
(
Integer
id
);
@Query
(
value
=
"SELECT id, user_id, shoes_id, price, created FROM sales_logs AS sl WHERE sl.created = ?1"
,
@Query
(
value
=
"SELECT id, user_id, shoes_id, price, created FROM sales_logs AS sl WHERE sl.created = ?1
&& sl.user_id = ?2
"
,
nativeQuery
=
true
)
nativeQuery
=
true
)
public
List
<
SalesLog
>
history
Shoes
(
Date
create
d
);
public
List
<
SalesLog
>
history
Details
(
Date
created
,
Integer
i
d
);
}
}
src/main/java/com/example/service/SalesLogService.java
View file @
9425bde9
...
@@ -34,7 +34,7 @@ public class SalesLogService {
...
@@ -34,7 +34,7 @@ public class SalesLogService {
return
salesLogRepository
.
history
(
id
);
return
salesLogRepository
.
history
(
id
);
}
}
public
List
<
SalesLog
>
history
Shoes
(
Date
create
d
)
{
public
List
<
SalesLog
>
history
Details
(
Date
created
,
Integer
i
d
)
{
return
salesLogRepository
.
history
Shoes
(
create
d
);
return
salesLogRepository
.
history
Details
(
created
,
i
d
);
}
}
}
}
src/main/java/com/example/web/EcsiteController.java
View file @
9425bde9
...
@@ -93,11 +93,21 @@ public class EcsiteController {
...
@@ -93,11 +93,21 @@ public class EcsiteController {
//購入履歴画面
//購入履歴画面
@GetMapping
(
"log/{id}"
)
@GetMapping
(
"log/{id}"
)
public
String
H
istory
(
@PathVariable
Integer
id
,
Model
model
,
SalesLog
salesLog
,
@AuthenticationPrincipal
LoginUser
userDetails
)
{
public
String
h
istory
(
@PathVariable
Integer
id
,
Model
model
,
SalesLog
salesLog
,
@AuthenticationPrincipal
LoginUser
userDetails
)
{
User
user
=
userDetails
.
getUser
();
User
user
=
userDetails
.
getUser
();
model
.
addAttribute
(
"user"
,
user
);
model
.
addAttribute
(
"user"
,
user
);
List
<
SalesLog
>
list
=
salesLogService
.
history
(
id
);
List
<
SalesLog
>
list
=
salesLogService
.
history
(
id
);
model
.
addAttribute
(
"log"
,
list
);
model
.
addAttribute
(
"log"
,
list
);
return
"log"
;
return
"log"
;
}
}
//購入履歴詳細画面
@GetMapping
(
"logDetails/{created}"
)
public
String
historyDetails
(
@PathVariable
Date
created
,
Model
model
,
@AuthenticationPrincipal
LoginUser
userDetails
)
{
User
user
=
userDetails
.
getUser
();
model
.
addAttribute
(
"user"
,
user
);
List
<
SalesLog
>
list
=
salesLogService
.
historyDetails
(
created
,
user
.
getId
());
model
.
addAttribute
(
"logDetails"
,
list
);
return
"logDetails"
;
}
}
}
src/main/resources/templates/log.html
View file @
9425bde9
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
<tr
class=
"row tr"
th:each=
"log : ${log}"
>
<tr
class=
"row tr"
th:each=
"log : ${log}"
>
<td
class=
"td"
><p
class=
"textP"
th:text=
"${log.created}"
>
Convers All Star
</p></td>
<td
class=
"td"
><p
class=
"textP"
th:text=
"${log.created}"
>
Convers All Star
</p></td>
<td
class=
"td"
><p
class=
"textP"
th:text=
"'¥' + ${log.price}"
>
10000
</p></td>
<td
class=
"td"
><p
class=
"textP"
th:text=
"'¥' + ${log.price}"
>
10000
</p></td>
<td
class=
"td"
><
button
class=
"details-btn"
>
Details
</button
></td>
<td
class=
"td"
><
a
th:href=
"@{/limited/logDetails/{created}(created=${log.created})}"
><button
class=
"details-btn"
>
Details
</button></a
></td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
...
...
src/main/resources/templates/logDetails.html
0 → 100644
View file @
9425bde9
<!doctype html>
<html
class=
"no-js"
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<link
rel=
"icon"
href=
"images/favicon.png"
th:href=
"@{/images/favicon.png}"
/>
<link
rel=
"stylesheet"
href=
"css/style.css"
th:href=
"@{/css/style.css}"
/>
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"/>
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet"/>-->
<title>
Limited History
</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script>window.html5 || document.write('<script src="js/vendor/html5shiv.js"><\/script>')</script>
<![endif]-->
</head>
<body>
<section
class=
"header-top-section"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<div
class=
"header-top-content"
>
<ul
class=
"nav nav-pills navbar-left"
>
<li><a
href=
"#"
><i
class=
"pe-7s-call"
></i><span>
123-123456789
</span></a></li>
<li><a
href=
"#"
><i
class=
"pe-7s-mail"
></i><span>
info@mart.com
</span></a></li>
</ul>
</div>
</div>
<div
class=
"col-md-6"
>
<div
class=
"header-top-menu"
>
<ul
class=
"nav nav-pills navbar-right"
>
<!-- 履歴ページへ遷移 -->
<li><a
th:href=
"@{/log/{id}(id=${user.id})}"
>
My Purchase Log
</a></li>
<!-- カートページへ遷移 -->
<li><a
th:href=
"@{/cart/{id}(id=${user.id})}"
>
Cart
</a></li>
<!-- ログアウト -->
<li><form
th:action=
"@{/logout}"
method=
"post"
><input
type=
"submit"
value=
"logout"
style=
"border:none;background-color:transparent;text-decoration:none;"
class=
"logoutBtn"
/></form></li>
</ul>
</div>
</div>
</div>
</div>
</section>
<header
class=
"header-section"
>
<nav
class=
"navbar navbar-default"
>
<div
class=
"container"
>
<!-- Brand and toggle get grouped for better mobile display -->
<div
class=
"navbar-header"
>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#bs-example-navbar-collapse-1"
aria-expanded=
"false"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand"
href=
"#"
><b>
L
</b>
imited
</a>
</div>
</div>
<!-- /.container -->
</nav>
</header>
<!-- ログインフォーム -->
<div
class=
"container"
>
<p
id=
"log-p-text"
><span
id=
"log-text"
>
Purchase History
</span></p>
<!--<form id="login-form" method="post" th:action="@{/login}">
<div id="email-form">
<label for="login-email">Email</label>
<input type="email" class="login" name="email" id="login-email" placeholder="Email" required="required"/>
</div>
<div id="password-form">
<label for="login-password">Password</label>
<input type="password" class="login" name="password" id="login-password" placeholder="Password" required="required"/>
</div>
<div id="submit-form">
<input type="submit" class="login" id="btn" value="Login"/>
会員登録ボタン
<button class="js-modal-open" id="sign-up">Sign Up</button>
</div>
</form>-->
<!-- 購入履歴一覧 -->
<div
id=
"log"
>
<table
id=
"log-table"
>
<thead
class=
"thead"
>
<tr
class=
"row"
id=
"theadTr"
>
<th
class=
"th"
id=
"productNameTh"
>
Product Name
</th>
<th
class=
"th"
id=
"sizeTh"
>
Size
</th>
<th
class=
"th"
id=
"priceTh"
>
Price
</th>
</tr>
</thead>
<tbody>
<tr
class=
"row tr"
th:each=
"logDetails : ${logDetails}"
>
<td
class=
"td"
><p
class=
"textP"
th:text=
"${logDetails.shoes.name}"
>
Convers All Star
</p></td>
<td
class=
"td"
><p
class=
"textP"
th:text=
"${logDetails.shoes.size} + 'cm'"
>
28
</p></td>
<td
class=
"td"
><p
class=
"textP"
th:text=
"'¥' + ${logDetails.shoes.price}"
>
10000
</p></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- footer -->
<footer
class=
"footer"
id=
"log-footer"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<p
class=
"center"
>
Made with
<i
class=
"fa fa-heart"
></i>
by
<a
href=
"https://revolthemes.net/"
target=
"_blank"
>
Limited
</a>
. All Rights Reserved
</p>
</div>
</div>
</div>
</footer>
<!-- モーダル用 -->
<script
src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
></script>
<!-- JQUERY -->
<!-- <script src="js/vendor/jquery-1.11.2.min.js" th:src="@{/js/vendor/jquery-1.11.2.min.js}"></script>
<script src="js/vendor/bootstrap.min.js" th:src="@{/js/vendor/bootstrap.min.js}"></script>
<script src="js/isotope.pkgd.min.js" th:src="@{/js/isotope.pkgd.min.js}"></script>
<script src="js/owl.carousel.min.js" th:src="@{/js/owl.carousel.min.js}"></script>
<script src="js/wow.min.js" th:src="@{/js/wow.min.js}"></script>
<script src="js/custom.js" th:src="@{/js/custom.js}"></script>-->
<!-- BootStrap -->
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> -->
</body>
</html>
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