Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
M
mywork
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
sumet
mywork
Commits
9444a934
Commit
9444a934
authored
Apr 18, 2018
by
sumet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
late
parent
379320c4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
88 additions
and
18 deletions
+88
-18
HomeController.java
play-java-ebean-example/app/controllers/HomeController.java
+9
-0
Thai.java
play-java-ebean-example/app/models/Thai.java
+21
-0
thai.scala.html
play-java-ebean-example/app/views/thai.scala.html
+37
-0
1.sql
play-java-ebean-example/conf/evolutions/default/1.sql
+19
-18
2.sql
play-java-ebean-example/conf/evolutions/default/2.sql
+0
-0
routes
play-java-ebean-example/conf/routes
+2
-0
t.jpg
play-java-ebean-example/public/images/t.jpg
+0
-0
th.jpg
play-java-ebean-example/public/images/th.jpg
+0
-0
thai.jpg
play-java-ebean-example/public/images/thai.jpg
+0
-0
thailand.jpg
play-java-ebean-example/public/images/thailand.jpg
+0
-0
Sumet.css
play-java-ebean-example/public/stylesheets/Sumet.css
+0
-0
No files found.
play-java-ebean-example/app/controllers/HomeController.java
View file @
9444a934
package
controllers
;
package
controllers
;
import
models.Computer
;
import
models.Computer
;
import
models.Thai
;
import
play.data.Form
;
import
play.data.Form
;
import
play.data.FormFactory
;
import
play.data.FormFactory
;
import
play.libs.concurrent.HttpExecutionContext
;
import
play.libs.concurrent.HttpExecutionContext
;
...
@@ -12,6 +13,8 @@ import repository.ComputerRepository;
...
@@ -12,6 +13,8 @@ import repository.ComputerRepository;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
javax.persistence.PersistenceException
;
import
javax.persistence.PersistenceException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.CompletionStage
;
import
java.util.concurrent.CompletionStage
;
...
@@ -50,6 +53,12 @@ public class HomeController extends Controller {
...
@@ -50,6 +53,12 @@ public class HomeController extends Controller {
return
GO_HOME
;
return
GO_HOME
;
}
}
public
Result
thai
(){
List
<
Thai
>
Thailand
=
new
ArrayList
<>();
Thailand
=
Thai
.
find
.
all
();
return
ok
(
views
.
html
.
thai
.
render
(
Thailand
));
}
/**
/**
* Display the paginated list of computers.
* Display the paginated list of computers.
*
*
...
...
play-java-ebean-example/app/models/Thai.java
0 → 100644
View file @
9444a934
package
models
;
import
io.ebean.Finder
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
@Entity
public
class
Thai
extends
BaseModel
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
public
Long
id
;
public
String
Coun
;
public
String
Prov
;
public
static
final
Finder
<
Long
,
Thai
>
find
=
new
Finder
<>(
Thai
.
class
);
}
\ No newline at end of file
play-java-ebean-example/app/views/thai.scala.html
0 → 100644
View file @
9444a934
@(thai:List[models.Thai])
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Country Database
</title>
<link
rel=
"stylesheet"
href=
"/assets/stylesheets/Sumet.css"
>
</head>
<body
class=
"background-info"
>
<nav
class=
"navbar navbar-dark bg-dark"
>
<a
class=
"navbar-brand"
href=
"#"
>
Country Database
</a>
</nav>
<br>
<center><h1>
จำนวนจังหวัดทั้งหมด @thai.size จังหวัด
</h1></center>
<table
border=
"1"
width=
"600"
class=
"table table-borderless table-dark"
align=
"center"
>
<thead
class=
"thead color"
>
<tr
align=
"center"
>
<th>
ID
</th>
<th>
PROVINCE
</th>
<th>
COUNTRY
</th>
</tr>
</thead>
<tbody>
@for(t
<-
thai
){
<
tr
align=
"center"
>
<td>
@t.id
</td>
<td>
@t.Prov
</td>
<td>
@t.Coun
</td>
</tr>
}
</tbody>
</table>
</body>
</html>
play-java-ebean-example/conf/evolutions/default/1.sql
View file @
9444a934
#
--- First database schema
#
--- Created by Ebean DDL
#
To
stop
Ebean
DDL
generation
,
remove
this
comment
and
start
using
Evolutions
#
--- !Ups
#
--- !Ups
create
table
company
(
create
table
company
(
id
bigi
nt
not
null
,
id
bigint
auto_increme
nt
not
null
,
name
varchar
(
255
),
name
varchar
(
255
),
constraint
pk_company
primary
key
(
id
)
)
constraint
pk_company
primary
key
(
id
)
;
)
;
create
table
computer
(
create
table
computer
(
id
bigi
nt
not
null
,
id
bigint
auto_increme
nt
not
null
,
name
varchar
(
255
),
name
varchar
(
255
),
introduced
timestamp
,
introduced
timestamp
,
discontinued
timestamp
,
discontinued
timestamp
,
company_id
bigint
,
company_id
bigint
,
constraint
pk_computer
primary
key
(
id
)
)
constraint
pk_computer
primary
key
(
id
)
;
)
;
create
sequence
company_seq
start
with
1000
;
create
table
thai
(
id
bigint
auto_increment
not
null
,
coun
varchar
(
255
),
prov
varchar
(
255
),
constraint
pk_thai
primary
key
(
id
)
);
create
sequence
computer_seq
start
with
1000
;
alter
table
computer
add
constraint
fk_computer_company_id
foreign
key
(
company_id
)
references
company
(
id
)
on
delete
restrict
on
update
restrict
;
create
index
ix_computer_company_id
on
computer
(
company_id
);
alter
table
computer
add
constraint
fk_computer_company_1
foreign
key
(
company_id
)
references
company
(
id
)
on
delete
restrict
on
update
restrict
;
create
index
ix_computer_company_1
on
computer
(
company_id
);
#
--- !Downs
#
--- !Downs
SET
REFERENTIAL_INTEGRITY
FALSE
;
alter
table
computer
drop
constraint
if
exists
fk_computer_company_id
;
drop
index
if
exists
ix_computer_company_id
;
drop
table
if
exists
company
;
drop
table
if
exists
company
;
drop
table
if
exists
computer
;
drop
table
if
exists
computer
;
SET
REFERENTIAL_INTEGRITY
TRUE
;
drop
table
if
exists
thai
;
drop
sequence
if
exists
company_seq
;
drop
sequence
if
exists
computer_seq
;
play-java-ebean-example/conf/evolutions/default/2.sql
View file @
9444a934
This diff is collapsed.
Click to expand it.
play-java-ebean-example/conf/routes
View file @
9444a934
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
# Default path will just redirect to the computer list
# Default path will just redirect to the computer list
GET / controllers.HomeController.index()
GET / controllers.HomeController.index()
GET /thai controllers.HomeController.thai()
# Computers list (look at the default values for pagination parameters)
# Computers list (look at the default values for pagination parameters)
GET /computers controllers.HomeController.list(p:Int ?= 0, s ?= "name", o ?= "asc", f ?= "")
GET /computers controllers.HomeController.list(p:Int ?= 0, s ?= "name", o ?= "asc", f ?= "")
...
...
play-java-ebean-example/public/images/t.jpg
0 → 100644
View file @
9444a934
288 KB
play-java-ebean-example/public/images/th.jpg
0 → 100644
View file @
9444a934
229 KB
play-java-ebean-example/public/images/thai.jpg
0 → 100644
View file @
9444a934
232 KB
play-java-ebean-example/public/images/thailand.jpg
0 → 100644
View file @
9444a934
46.2 KB
play-java-ebean-example/public/stylesheets/Sumet.css
0 → 100644
View file @
9444a934
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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