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
bf991611
Commit
bf991611
authored
Oct 17, 2020
by
DESKTOP-FI5PFC1\tevir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
購入履歴処理途中
parent
62cb19b1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
322 additions
and
6 deletions
+322
-6
SalesLog.java
src/main/java/com/example/domain/SalesLog.java
+21
-1
Wallets.java
src/main/java/com/example/domain/Wallets.java
+4
-1
SalesLogRepository.java
src/main/java/com/example/repository/SalesLogRepository.java
+16
-0
SalesLogService.java
src/main/java/com/example/service/SalesLogService.java
+35
-0
EcsiteController.java
src/main/java/com/example/web/EcsiteController.java
+17
-0
application.properties
src/main/resources/application.properties
+1
-0
style.css
src/main/resources/static/css/style.css
+62
-0
management.js
src/main/resources/static/js/management.js
+24
-0
fistory.html
src/main/resources/templates/fistory.html
+2
-2
index.html
src/main/resources/templates/index.html
+3
-2
management.html
src/main/resources/templates/management.html
+137
-0
No files found.
src/main/java/com/example/domain/SalesLog.java
View file @
bf991611
package
com
.
example
.
domain
;
public
class
SalesLog
{
import
java.sql.Date
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.Getter
;
import
lombok.Setter
;
@Entity
@Getter
@Setter
@Table
(
name
=
"sales_logs"
)
public
class
SalesLog
{
@Id
@GeneratedValue
private
Integer
id
;
private
Integer
userId
;
private
Integer
shoesId
;
private
Integer
price
;
private
Date
created
;
}
src/main/java/com/example/domain/Wallets.java
View file @
bf991611
package
com
.
example
.
domain
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
...
...
@@ -16,7 +17,9 @@ import lombok.Setter;
public
class
Wallets
{
@Id
@GeneratedValue
private
Integer
Id
;
private
Integer
id
;
@Column
(
nullable
=
false
)
private
Integer
userId
;
@Column
(
nullable
=
false
)
private
Integer
amount
;
}
src/main/java/com/example/repository/SalesLogRepository.java
0 → 100644
View file @
bf991611
package
com
.
example
.
repository
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
com.example.domain.SalesLog
;
@Repository
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"
,
nativeQuery
=
true
)
public
List
<
SalesLog
>
history
(
Integer
id
);
}
src/main/java/com/example/service/SalesLogService.java
0 → 100644
View file @
bf991611
package
com
.
example
.
service
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.example.domain.SalesLog
;
import
com.example.repository.SalesLogRepository
;
@Service
public
class
SalesLogService
{
@Autowired
SalesLogRepository
salesLogRepository
;
public
List
<
SalesLog
>
findAll
(){
return
salesLogRepository
.
findAll
();
}
public
SalesLog
findOne
(
Integer
id
){
return
salesLogRepository
.
findOne
(
id
);
}
public
SalesLog
create
(
SalesLog
salesLog
){
return
salesLogRepository
.
save
(
salesLog
);
}
public
SalesLog
update
(
SalesLog
salesLog
){
return
salesLogRepository
.
save
(
salesLog
);
}
public
List
<
SalesLog
>
history
(
Integer
id
)
{
return
salesLogRepository
.
history
(
id
);
}
}
src/main/java/com/example/web/EcsiteController.java
View file @
bf991611
...
...
@@ -10,11 +10,14 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.example.domain.SalesLog
;
import
com.example.domain.Shoes
;
import
com.example.domain.User
;
import
com.example.service.LoginUser
;
import
com.example.service.SalesLogService
;
import
com.example.service.ShoesService
;
@Controller
...
...
@@ -23,6 +26,9 @@ public class EcsiteController {
@Autowired
ShoesService
shoesService
;
@Autowired
SalesLogService
salesLogService
;
//写真の表示用メソッド
public
String
photoView
(
String
Photo
)
{
// 画像を検索してbyteとしてViewへ受け渡す
...
...
@@ -83,4 +89,15 @@ public class EcsiteController {
//遷移先 未設定
return
"Hello world"
;
}
//購入履歴画面
@GetMapping
(
"log/{id}"
)
public
String
History
(
@PathVariable
Integer
id
,
Model
model
,
SalesLog
salesLog
)
{
List
<
SalesLog
>
list
=
salesLogService
.
history
(
id
);
for
(
SalesLog
value
:
list
)
{
System
.
out
.
println
(
value
);
}
model
.
addAttribute
(
"log"
,
list
);
return
"fistory"
;
}
}
src/main/resources/application.properties
View file @
bf991611
spring.datasource.url
=
jdbc:mysql://localhost:3306/limited
spring.datasource.username
=
root
spring.datasource.password
=
kanikani7
security.basic.enabled
=
false
spring.datasource.driverClassName
=
com.mysql.jdbc.Driver
src/main/resources/static/css/style.css
View file @
bf991611
...
...
@@ -1770,4 +1770,65 @@ label {
#history-table
{
color
:
#000
;
width
:
100%
;
}
/* 管理画面(宮嶋) */
#management_wrapper
{
height
:
100%
;
width
:
100%
;
display
:
flex
;
}
#sidebar
{
height
:
100%
;
width
:
20%
;
border-right
:
1px
gray
solid
;
}
.sidebar_title
{
margin
:
10px
;
}
.sidebar_title_name
{
display
:
block
;
margin
:
0
auto
;
}
#mainbody
{
height
:
100%
;
width
:
80%
;
}
.ma_header
{
border-bottom
:
1px
gray
solid
;
height
:
10%
;
padding
:
5px
;
font-size
:
large
;
font-weight
:
bold
;
}
#user_list
{
padding
:
20px
;
}
th
,
td
{
padding
:
10px
;
}
#roleBtn
{
margin
:
10px
;
}
#newShoesForm
{
border-bottom
:
1px
gray
solid
;
height
:
15%
;
padding
:
10px
;
}
#newShoesFormTitle
,
#shoesListTitle
{
padding
:
5px
;
font-size
:
large
;
font-weight
:
bold
;
}
#newShoesFormBtn
,
#ShoesEditBtn
{
display
:
block
;
margin
:
0
0
0
auto
;
padding
:
5px
;
margin-bottom
:
5px
;
margin-right
:
5px
;
}
#ShoesEditForm
{
border-bottom
:
1px
gray
dashed
;
height
:
15%
;
padding
:
10px
;
}
\ No newline at end of file
src/main/resources/static/js/management.js
0 → 100644
View file @
bf991611
$
(
'#shoe_management'
).
hide
();
//ユーザー管理
$
(
'#user_button'
).
on
(
'click'
,
function
(){
$
(
'#user_management'
).
show
();
$
(
'#shoe_management'
).
hide
();
})
//権限変更の確認アラート
$
(
'#roleBtn'
).
on
(
'click'
,
function
(){
if
(
!
confirm
(
'本当に権限を変更しますか?'
))
{
return
false
;
}
else
{
//権限書き換え機能
}
})
//商品管理
$
(
'#shoe_button'
).
on
(
'click'
,
function
(){
$
(
'#user_management'
).
hide
();
$
(
'#shoe_management'
).
show
();
})
\ No newline at end of file
src/main/resources/templates/fistory.html
View file @
bf991611
...
...
@@ -78,8 +78,8 @@
</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>
会員登録ボタン
<button class="js-modal-open" id="sign-up">Sign Up</button>
</div>
</form>-->
...
...
src/main/resources/templates/index.html
View file @
bf991611
<!DOCTYPE html>
<html
class=
"no-js"
lang=
"ja"
xmlns:th=
"http://www.thymeleaf.org"
>
<html
class=
"no-js"
lang=
"ja"
xmlns:th=
"http://www.thymeleaf.org"
xmlns:sec=
"http://www.thymeleaf.org/extras/spring-security"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
/>
...
...
@@ -33,7 +34,7 @@
<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=
"@{/l
imited/l
og/{id}(id=${user.id})}"
>
My Purchase Log
</a></li>
<!-- カートページへ遷移 -->
<li><a
th:href=
"@{/cart/{id}(id=${user.id})}"
>
Cart
</a></li>
<!-- ログアウト -->
...
...
src/main/resources/templates/management.html
0 → 100644
View file @
bf991611
<!doctype html>
<html
class=
"no-js"
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<title>
Limited
</title>
<meta
name=
"description"
content=
""
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"icon"
href=
"images/favicon.png"
>
<link
rel=
"stylesheet"
href=
"css/style.css"
>
<!--[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>
<div
id=
"management_wrapper"
>
<div
id=
"sidebar"
>
<div
class=
"sidebar_title"
><button
th:href=
"http://localhost:8080/limited"
>
TOPへ戻る
</button></div>
<div
class=
"sidebar_title"
><button
id=
"user_button"
type=
"button"
>
ユーザー管理
</button></div>
<div
class=
"sidebar_title"
><button
id=
"shoe_button"
type=
"button"
>
商品管理
</button></div>
</div>
<div
id=
"mainbody"
>
<!-- ユーザー管理 -->
<div
id=
"user_management"
>
<!-- ヘッダー -->
<div
class=
"ma_header"
>
<p>
ユーザー管理
</p>
</div>
<div
id=
"user_list"
>
<table
id=
"user_list_table"
border=
"1"
>
<tr>
<th>
ID
</th>
<th>
名前
</th>
<th>
権限
</th>
</tr>
<tr>
<td>
1
</td>
<td>
demo
</td>
<td><input
name=
"roles"
th:text=
"admin"
/><button
id=
"roleBtn"
>
権限変更
</button></td>
</tr>
</table>
</div>
</div>
<!-- 商品管理 -->
<div
id=
"shoe_management"
>
<!-- ヘッダー -->
<div
class=
"ma_header"
>
<p>
商品管理
</p>
</div>
<!-- 新規登録フォーム -->
<div
id=
"newShoesFormTitle"
>
商品新規登録
</div>
<form
id=
"newShoesForm"
>
<span>
商品名:
<input
type=
"text"
name=
"name"
placeholder=
"name"
/></span>
<span>
価格:
<input
type=
"text"
name=
"price"
placeholder=
"price"
/></span>
<!-- <span>在庫数:<select name="stock">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select></span> -->
<span>
在庫数:
<input
type=
"number"
name=
"stock"
/></span>
<span>
サイズ:
<select
name=
"size_id"
>
<option
value=
"1"
>
24
</option>
<option
value=
"2"
>
24.5
</option>
<option
value=
"3"
>
25
</option>
<option
value=
"4"
>
25.5
</option>
<option
value=
"5"
>
26
</option>
<option
value=
"6"
>
26.5
</option>
<option
value=
"7"
>
27
</option>
<option
value=
"8"
>
27.5
</option>
<option
value=
"9"
>
28
</option>
<option
value=
"10"
>
28.5
</option>
</select></span>
<div>
商品画像
<input
type=
"file"
name=
"photo"
></div>
<button
type=
"button"
id=
"newShoesFormBtn"
>
登録確定
</button>
</form>
<!-- 在庫一覧 eachで繰り返し -->
<div
id=
"shoesListTitle"
>
在庫一覧
</div>
<form
id=
"ShoesEditForm"
>
<span>
ID:
<div
name=
"id"
th:text=
""
></div></span>
<span>
商品名:
<input
type=
"text"
name=
"name"
placeholder=
"name"
/></span>
<span>
価格:
<input
type=
"text"
name=
"price"
placeholder=
"price"
/></span>
<!-- <span>在庫数:<select name="stock">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select></span> -->
<span>
在庫数:
<input
type=
"number"
name=
"stock"
/></span>
<span>
サイズ:
<select
name=
"size_id"
>
<option
value=
"1"
>
24
</option>
<option
value=
"2"
>
24.5
</option>
<option
value=
"3"
>
25
</option>
<option
value=
"4"
>
25.5
</option>
<option
value=
"5"
>
26
</option>
<option
value=
"6"
>
26.5
</option>
<option
value=
"7"
>
27
</option>
<option
value=
"8"
>
27.5
</option>
<option
value=
"9"
>
28
</option>
<option
value=
"10"
>
28.5
</option>
</select></span>
<div>
商品画像
<input
type=
"file"
name=
"photo"
></div>
<button
type=
"button"
id=
"ShoesEditBtn"
>
変更確定
</button>
</form>
</div>
</div>
</div>
<script
src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
></script>
<!-- <script src="js/vendor/bootstrap.min.js"></script>
<script src="js/isotope.pkgd.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/custom.js"></script> -->
<script
type=
"text/javascript"
src=
"js/management.js"
></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