Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sfewfsaf
spring-boot-examples
提交
f7348b2e
S
spring-boot-examples
项目概览
sfewfsaf
/
spring-boot-examples
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-boot-examples
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f7348b2e
编写于
9月 14, 2017
作者:
微笑很纯洁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add thymeleaf jpa demo
上级
4597adaf
变更
28
展开全部
显示空白变更内容
内联
并排
Showing
28 changed file
with
7 addition
and
14103 deletion
+7
-14103
README.md
README.md
+3
-2
README_EN.md
README_EN.md
+3
-3
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/web/UserController.java
...meleaf-curd/src/main/java/com/neo/web/UserController.java
+0
-1
spring-boot-thymeleaf/pom.xml
spring-boot-thymeleaf/pom.xml
+1
-1
spring-boot-thymeleaf/spring-boot-thymeleaf.iml
spring-boot-thymeleaf/spring-boot-thymeleaf.iml
+0
-79
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/entity/User.java
...hymeleaf/src/main/java/com/neo/thymeleaf/entity/User.java
+0
-55
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/repository/UserRepository.java
...ain/java/com/neo/thymeleaf/repository/UserRepository.java
+0
-11
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/service/UserService.java
.../src/main/java/com/neo/thymeleaf/service/UserService.java
+0
-20
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/service/impl/UserServiceImpl.java
.../java/com/neo/thymeleaf/service/impl/UserServiceImpl.java
+0
-44
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/web/HelloController.java
.../src/main/java/com/neo/thymeleaf/web/HelloController.java
+0
-16
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/web/UserController.java
...f/src/main/java/com/neo/thymeleaf/web/UserController.java
+0
-64
spring-boot-thymeleaf/src/main/resources/static/css/bootstrap.css
...oot-thymeleaf/src/main/resources/static/css/bootstrap.css
+0
-6760
spring-boot-thymeleaf/src/main/resources/templates/user/list.html
...oot-thymeleaf/src/main/resources/templates/user/list.html
+0
-43
spring-boot-thymeleaf/src/main/resources/templates/user/userAdd.html
...-thymeleaf/src/main/resources/templates/user/userAdd.html
+0
-43
spring-boot-thymeleaf/src/main/resources/templates/user/userEdit.html
...thymeleaf/src/main/resources/templates/user/userEdit.html
+0
-44
spring-boot-thymeleaf/target/classes/application.properties
spring-boot-thymeleaf/target/classes/application.properties
+0
-17
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/ThymeleafApplication.class
...rget/classes/com/neo/thymeleaf/ThymeleafApplication.class
+0
-0
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/entity/User.class
...meleaf/target/classes/com/neo/thymeleaf/entity/User.class
+0
-0
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/repository/UserRepository.class
...classes/com/neo/thymeleaf/repository/UserRepository.class
+0
-0
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/service/UserService.class
...arget/classes/com/neo/thymeleaf/service/UserService.class
+0
-0
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/service/impl/UserServiceImpl.class
...sses/com/neo/thymeleaf/service/impl/UserServiceImpl.class
+0
-0
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/web/HelloController.class
...arget/classes/com/neo/thymeleaf/web/HelloController.class
+0
-0
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/web/UserController.class
...target/classes/com/neo/thymeleaf/web/UserController.class
+0
-0
spring-boot-thymeleaf/target/classes/static/css/bootstrap.css
...ng-boot-thymeleaf/target/classes/static/css/bootstrap.css
+0
-6760
spring-boot-thymeleaf/target/classes/templates/hello.html
spring-boot-thymeleaf/target/classes/templates/hello.html
+0
-10
spring-boot-thymeleaf/target/classes/templates/user/list.html
...ng-boot-thymeleaf/target/classes/templates/user/list.html
+0
-43
spring-boot-thymeleaf/target/classes/templates/user/userAdd.html
...boot-thymeleaf/target/classes/templates/user/userAdd.html
+0
-43
spring-boot-thymeleaf/target/classes/templates/user/userEdit.html
...oot-thymeleaf/target/classes/templates/user/userEdit.html
+0
-44
未找到文件。
README.md
浏览文件 @
f7348b2e
...
...
@@ -13,6 +13,8 @@ Spring boot使用的各种示例,以最简单、最实用为标准
-
[
spring-boot-mybaits-xml
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-xml
)
:xml配置版本
-
[
spring-boot-mybatis-mulidatasource
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-mulidatasource
)
:springboot+mybatis多数据源最简解决方案
-
[
spring-boot-mybatis-annotation-mulidatasource
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-annotation-mulidatasource
)
:springboot+mybatis(注解版)多数据源最简解决方案
-
[
spring-boot-thymeleaf
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf
)
:简单 spring boot thymeleaf 脚手架
-
[
spring-boot-jpa-thymeleaf-curd
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd
)
:spring boot + jpa + thymeleaf 增删改查示例
-
[
spring-boot-rabbitmq
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-rabbitmq
)
:spring boot和rabbitmq各种消息应用案例
-
[
spring-boot-scheduler
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-scheduler
)
:spring boot和定时任务案例
-
[
spring-boot-web
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-web
)
:web开发综合使用案例
...
...
@@ -21,8 +23,7 @@ Spring boot使用的各种示例,以最简单、最实用为标准
-
[
spring-boot-multi-mongodb
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-multi-mongodb
)
:spring boot和mongodb多数据源的使用
-
[
spring-boot-package-war
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-package-war
)
:spring-boot打包成war包示例
-
[
spring-boot-shiro
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-shiro
)
:springboot 整合shiro rbac示例
-
[
spring-boot-thymeleaf
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf
)
:简单 spring boot thymeleaf 脚手架
-
[
spring-boot-jpa-thymeleaf-curd
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd
)
:spring boot + jpa + thymeleaf 增删改查示例
-
[
Favorites-web
](
https://github.com/cloudfavorites/favorites-web
)
:云收藏(springboot实战开源软件)
...
...
README_EN.md
浏览文件 @
f7348b2e
...
...
@@ -14,6 +14,9 @@ Spring Boot Examples, Use the simplest and most useful scene demo.
-
[
spring-boot-mybaits-xml
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-xml
)
:Spring Boot use mybatis xml
-
[
spring-boot-mybatis-mulidatasource
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-mulidatasource
)
:Spring Boot+mybatis+mulidatasource
-
[
spring-boot-mybatis-annotation-mulidatasource
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-annotation-mulidatasource
)
:Spring Boot+ mybatis annotation + mulidatasource
-
[
spring-boot-thymeleaf
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf
)
:simple spring boot thymeleaf demo
spring-boot-thymeleaf):简单 spring boot thymeleaf 脚手架
-
[
spring-boot-jpa-thymeleaf-curd
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd
)
:spring boot + jpa + thymeleaf curd demo
-
[
spring-boot-rabbitmq
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-rabbitmq
)
: using AMQP and RabbitMQ
-
[
spring-boot-scheduler
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-scheduler
)
:Timed tasks developed using Spring Boot
-
[
spring-boot-web
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-web
)
:Web projects developed using Spring Boot
...
...
@@ -22,7 +25,4 @@ Spring Boot Examples, Use the simplest and most useful scene demo.
-
[
spring-boot-multi-mongodb
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-multi-mongodb
)
:Spring Boot + multiMongodb
-
[
spring-boot-package-war
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-package-war
)
:Spring Boot package war
-
[
spring-boot-shiro
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-shiro
)
:spring boot shiro rbac demo
-
[
spring-boot-thymeleaf
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-thymeleaf
)
:simple spring boot thymeleaf demo
spring-boot-thymeleaf):简单 spring boot thymeleaf 脚手架
-
[
spring-boot-jpa-thymeleaf-curd
](
https://github.com/ityouknow/spring-boot-examples/tree/master/spring-boot-jpa-thymeleaf-curd
)
:spring boot + jpa + thymeleaf curd demo
-
[
Favorites-web
](
https://github.com/cloudfavorites/favorites-web
)
:Open source projects developed using Spring Boot
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/web/UserController.java
浏览文件 @
f7348b2e
...
...
@@ -41,7 +41,6 @@ public class UserController {
return
"redirect:/list"
;
}
@RequestMapping
(
"/toEdit"
)
public
String
toEdit
(
Model
model
,
Long
id
)
{
User
user
=
userService
.
findUserById
(
id
);
...
...
spring-boot-thymeleaf/pom.xml
浏览文件 @
f7348b2e
...
...
@@ -11,7 +11,7 @@
</parent>
<properties>
<java.version>
1.
7
</java.version>
<java.version>
1.
8
</java.version>
</properties>
<dependencies>
...
...
spring-boot-thymeleaf/spring-boot-thymeleaf.iml
已删除
100644 → 0
浏览文件 @
4597adaf
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"FacetManager"
>
<facet
type=
"Spring"
name=
"Spring"
>
<configuration
/>
</facet>
</component>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_7"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/resources"
type=
"java-resource"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"jdk"
jdkName=
"1.7"
jdkType=
"JavaSDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-web:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-logging:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-classic:1.1.11"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-core:1.1.11"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:jul-to-slf4j:1.7.25"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:log4j-over-slf4j:1.7.25"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-core:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"RUNTIME"
name=
"Maven: org.yaml:snakeyaml:1.17"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-tomcat:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.16"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.16"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.16"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate:hibernate-validator:5.3.5.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.validation:validation-api:1.1.0.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.jboss.logging:jboss-logging:3.3.1.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml:classmate:1.3.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.core:jackson-databind:2.8.9"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.core:jackson-core:2.8.9"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-web:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-aop:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-beans:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-context:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-webmvc:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-expression:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-thymeleaf:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.thymeleaf:thymeleaf-spring4:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.thymeleaf:thymeleaf:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ognl:ognl:3.0.8"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.unbescape:unbescape:1.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:slf4j-api:1.7.25"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:1.4.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.codehaus.groovy:groovy:2.4.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-data-jpa:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-aop:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.aspectj:aspectjweaver:1.8.10"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-jdbc:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat:tomcat-jdbc:8.5.16"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat:tomcat-juli:8.5.16"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-jdbc:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate:hibernate-core:5.0.12.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.javassist:javassist:3.21.0-GA"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: antlr:antlr:2.7.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.jboss:jandex:2.0.0.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: dom4j:dom4j:1.6.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate:hibernate-entitymanager:5.0.12.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.transaction:javax.transaction-api:1.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.data:spring-data-jpa:1.11.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.data:spring-data-commons:1.13.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-orm:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-tx:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:jcl-over-slf4j:1.7.25"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-aspects:4.3.10.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: mysql:mysql-connector-java:5.1.43"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-devtools:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot:1.5.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.6.RELEASE"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/entity/User.java
已删除
100644 → 0
浏览文件 @
4597adaf
package
com.neo.thymeleaf.entity
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
@Entity
public
class
User
{
@Id
@GeneratedValue
private
long
id
;
@Column
(
nullable
=
false
,
unique
=
true
)
private
String
userName
;
@Column
(
nullable
=
false
)
private
String
password
;
@Column
(
nullable
=
false
)
private
int
age
;
public
long
getId
()
{
return
id
;
}
public
User
setId
(
long
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getUserName
()
{
return
userName
;
}
public
User
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
return
this
;
}
public
String
getPassword
()
{
return
password
;
}
public
User
setPassword
(
String
password
)
{
this
.
password
=
password
;
return
this
;
}
public
int
getAge
()
{
return
age
;
}
public
User
setAge
(
int
age
)
{
this
.
age
=
age
;
return
this
;
}
}
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/repository/UserRepository.java
已删除
100644 → 0
浏览文件 @
4597adaf
package
com.neo.thymeleaf.repository
;
import
com.neo.thymeleaf.entity.User
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
UserRepository
extends
JpaRepository
<
User
,
Long
>
{
User
findById
(
long
id
);
Long
deleteById
(
Long
id
);
}
\ No newline at end of file
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/service/UserService.java
已删除
100644 → 0
浏览文件 @
4597adaf
package
com.neo.thymeleaf.service
;
import
com.neo.thymeleaf.entity.User
;
import
java.util.List
;
public
interface
UserService
{
public
List
<
User
>
getUserList
();
public
User
findUserById
(
long
id
);
public
void
save
(
User
user
);
public
void
edit
(
User
user
);
public
void
delete
(
long
id
);
}
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/service/impl/UserServiceImpl.java
已删除
100644 → 0
浏览文件 @
4597adaf
package
com.neo.thymeleaf.service.impl
;
import
com.neo.thymeleaf.entity.User
;
import
com.neo.thymeleaf.repository.UserRepository
;
import
com.neo.thymeleaf.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
UserServiceImpl
implements
UserService
{
@Autowired
private
UserRepository
userRepository
;
@Override
public
List
<
User
>
getUserList
()
{
return
userRepository
.
findAll
();
}
@Override
public
User
findUserById
(
long
id
)
{
return
userRepository
.
findById
(
id
);
}
@Override
public
void
save
(
User
user
)
{
userRepository
.
save
(
user
);
}
@Override
public
void
edit
(
User
user
)
{
userRepository
.
save
(
user
);
}
@Override
public
void
delete
(
long
id
)
{
userRepository
.
delete
(
id
);
}
}
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/web/HelloController.java
已删除
100644 → 0
浏览文件 @
4597adaf
package
com.neo.thymeleaf.web
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
@Controller
public
class
HelloController
{
@RequestMapping
(
"/hello"
)
public
String
hello
(
Model
model
,
@RequestParam
(
value
=
"name"
,
required
=
false
,
defaultValue
=
"World"
)
String
name
)
{
model
.
addAttribute
(
"name"
,
name
);
return
"hello"
;
}
}
spring-boot-thymeleaf/src/main/java/com/neo/thymeleaf/web/UserController.java
已删除
100644 → 0
浏览文件 @
4597adaf
package
com.neo.thymeleaf.web
;
import
com.neo.thymeleaf.entity.User
;
import
com.neo.thymeleaf.service.UserService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Service
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Controller
public
class
UserController
{
@Resource
UserService
userService
;
@RequestMapping
(
"/"
)
public
String
index
()
{
return
"redirect:/list"
;
}
@RequestMapping
(
"/list"
)
public
String
list
(
Model
model
)
{
List
<
User
>
users
=
userService
.
getUserList
();
model
.
addAttribute
(
"users"
,
users
);
return
"user/list"
;
}
@RequestMapping
(
"/toAdd"
)
public
String
toAdd
()
{
return
"user/userAdd"
;
}
@RequestMapping
(
"/add"
)
public
String
add
(
User
user
)
{
userService
.
save
(
user
);
return
"redirect:/list"
;
}
@RequestMapping
(
"/toEdit"
)
public
String
toEdit
(
Model
model
,
Long
id
)
{
User
user
=
userService
.
findUserById
(
id
);
model
.
addAttribute
(
"user"
,
user
);
return
"user/userEdit"
;
}
@RequestMapping
(
"/edit"
)
public
String
edit
(
User
user
)
{
userService
.
edit
(
user
);
return
"redirect:/list"
;
}
@RequestMapping
(
"/delete"
)
public
String
delete
(
Long
id
)
{
userService
.
delete
(
id
);
return
"redirect:/list"
;
}
}
spring-boot-thymeleaf/src/main/resources/static/css/bootstrap.css
已删除
100644 → 0
浏览文件 @
4597adaf
此差异已折叠。
点击以展开。
spring-boot-thymeleaf/src/main/resources/templates/user/list.html
已删除
100644 → 0
浏览文件 @
4597adaf
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
userList
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
用户列表
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
#
</th>
<th>
User Name
</th>
<th>
Password
</th>
<th>
Age
</th>
<th>
Edit
</th>
<th>
Delete
</th>
</tr>
</thead>
<tbody>
<tr
th:each=
"user : ${users}"
>
<th
scope=
"row"
th:text=
"${user.id}"
>
1
</th>
<td
th:text=
"${user.userName}"
>
neo
</td>
<td
th:text=
"${user.password}"
>
Otto
</td>
<td
th:text=
"${user.age}"
>
6
</td>
<td><a
th:href=
"@{/toEdit(id=${user.id})}"
>
edit
</a></td>
<td><a
th:href=
"@{/delete(id=${user.id})}"
>
delete
</a></td>
</tr>
</tbody>
</table>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-2 control-label"
>
<a
href=
"/toAdd"
th:href=
"@{/toAdd}"
class=
"btn btn-info"
>
add
</a>
</div>
</div>
</body>
</html>
\ No newline at end of file
spring-boot-thymeleaf/src/main/resources/templates/user/userAdd.html
已删除
100644 → 0
浏览文件 @
4597adaf
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
user
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
添加用户
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<form
class=
"form-horizontal"
th:action=
"@{/add}"
method=
"post"
>
<div
class=
"form-group"
>
<label
for=
"userName"
class=
"col-sm-2 control-label"
>
userName
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"userName"
id=
"userName"
placeholder=
"userName"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
Password
</label>
<div
class=
"col-sm-10"
>
<input
type=
"password"
class=
"form-control"
name=
"password"
id=
"password"
placeholder=
"Password"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"age"
class=
"col-sm-2 control-label"
>
age
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"age"
id=
"age"
placeholder=
"age"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<input
type=
"submit"
value=
"Submit"
class=
"btn btn-info"
/>
<input
type=
"reset"
value=
"Reset"
class=
"btn btn-info"
/>
</div>
</div>
</form>
</div>
</body>
</html>
spring-boot-thymeleaf/src/main/resources/templates/user/userEdit.html
已删除
100644 → 0
浏览文件 @
4597adaf
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
user
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
修改用户
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<form
class=
"form-horizontal"
th:action=
"@{/edit}"
th:object=
"${user}"
method=
"post"
>
<input
type=
"hidden"
name=
"id"
th:value=
"*{id}"
/>
<div
class=
"form-group"
>
<label
for=
"userName"
class=
"col-sm-2 control-label"
>
userName
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"userName"
id=
"userName"
th:value=
"*{userName}"
placeholder=
"userName"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
Password
</label>
<div
class=
"col-sm-10"
>
<input
type=
"password"
class=
"form-control"
name=
"password"
id=
"password"
th:value=
"*{password}"
placeholder=
"Password"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"age"
class=
"col-sm-2 control-label"
>
age
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"age"
id=
"age"
th:value=
"*{age}"
placeholder=
"age"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<input
type=
"submit"
value=
"Submit"
class=
"btn btn-info"
/>
<a
href=
"/toAdd"
th:href=
"@{/list}"
class=
"btn btn-info"
>
Back
</a>
</div>
</div>
</form>
</div>
</body>
</html>
spring-boot-thymeleaf/target/classes/application.properties
已删除
100644 → 0
浏览文件 @
4597adaf
spring.datasource.url
=
jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
spring.datasource.username
=
root
spring.datasource.password
=
root
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
#spring.thymeleaf.check-template-location=true
#spring.thymeleaf.prefix=classpath:/templates/
#spring.thymeleaf.suffix=.html
#spring.thymeleaf.mode=HTML
#spring.thymeleaf.encoding=UTF-8
#spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache
=
false
spring.jpa.properties.hibernate.hbm2ddl.auto
=
update
spring.jpa.properties.hibernate.dialect
=
org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql
=
true
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/ThymeleafApplication.class
已删除
100644 → 0
浏览文件 @
4597adaf
文件已删除
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/entity/User.class
已删除
100644 → 0
浏览文件 @
4597adaf
文件已删除
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/repository/UserRepository.class
已删除
100644 → 0
浏览文件 @
4597adaf
文件已删除
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/service/UserService.class
已删除
100644 → 0
浏览文件 @
4597adaf
文件已删除
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/service/impl/UserServiceImpl.class
已删除
100644 → 0
浏览文件 @
4597adaf
文件已删除
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/web/HelloController.class
已删除
100644 → 0
浏览文件 @
4597adaf
文件已删除
spring-boot-thymeleaf/target/classes/com/neo/thymeleaf/web/UserController.class
已删除
100644 → 0
浏览文件 @
4597adaf
文件已删除
spring-boot-thymeleaf/target/classes/static/css/bootstrap.css
已删除
100644 → 0
浏览文件 @
4597adaf
此差异已折叠。
点击以展开。
spring-boot-thymeleaf/target/classes/templates/hello.html
已删除
100644 → 0
浏览文件 @
4597adaf
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
Hello Thymeleaf!
</title>
</head>
<body>
<p
th:text=
"'Hello, ' + ${name} + '!'"
/>
</body>
</html>
\ No newline at end of file
spring-boot-thymeleaf/target/classes/templates/user/list.html
已删除
100644 → 0
浏览文件 @
4597adaf
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
userList
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
用户列表
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
#
</th>
<th>
User Name
</th>
<th>
Password
</th>
<th>
Age
</th>
<th>
Edit
</th>
<th>
Delete
</th>
</tr>
</thead>
<tbody>
<tr
th:each=
"user : ${users}"
>
<th
scope=
"row"
th:text=
"${user.id}"
>
1
</th>
<td
th:text=
"${user.userName}"
>
neo
</td>
<td
th:text=
"${user.password}"
>
Otto
</td>
<td
th:text=
"${user.age}"
>
6
</td>
<td><a
th:href=
"@{/toEdit(id=${user.id})}"
>
edit
</a></td>
<td><a
th:href=
"@{/delete(id=${user.id})}"
>
delete
</a></td>
</tr>
</tbody>
</table>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-2 control-label"
>
<a
href=
"/toAdd"
th:href=
"@{/toAdd}"
class=
"btn btn-info"
>
add
</a>
</div>
</div>
</body>
</html>
\ No newline at end of file
spring-boot-thymeleaf/target/classes/templates/user/userAdd.html
已删除
100644 → 0
浏览文件 @
4597adaf
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
user
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
添加用户
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<form
class=
"form-horizontal"
th:action=
"@{/add}"
method=
"post"
>
<div
class=
"form-group"
>
<label
for=
"userName"
class=
"col-sm-2 control-label"
>
userName
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"userName"
id=
"userName"
placeholder=
"userName"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
Password
</label>
<div
class=
"col-sm-10"
>
<input
type=
"password"
class=
"form-control"
name=
"password"
id=
"password"
placeholder=
"Password"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"age"
class=
"col-sm-2 control-label"
>
age
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"age"
id=
"age"
placeholder=
"age"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<input
type=
"submit"
value=
"Submit"
class=
"btn btn-info"
/>
<input
type=
"reset"
value=
"Reset"
class=
"btn btn-info"
/>
</div>
</div>
</form>
</div>
</body>
</html>
spring-boot-thymeleaf/target/classes/templates/user/userEdit.html
已删除
100644 → 0
浏览文件 @
4597adaf
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
user
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
修改用户
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<form
class=
"form-horizontal"
th:action=
"@{/edit}"
th:object=
"${user}"
method=
"post"
>
<input
type=
"hidden"
name=
"id"
th:value=
"*{id}"
/>
<div
class=
"form-group"
>
<label
for=
"userName"
class=
"col-sm-2 control-label"
>
userName
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"userName"
id=
"userName"
th:value=
"*{userName}"
placeholder=
"userName"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
Password
</label>
<div
class=
"col-sm-10"
>
<input
type=
"password"
class=
"form-control"
name=
"password"
id=
"password"
th:value=
"*{password}"
placeholder=
"Password"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"age"
class=
"col-sm-2 control-label"
>
age
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"age"
id=
"age"
th:value=
"*{age}"
placeholder=
"age"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<input
type=
"submit"
value=
"Submit"
class=
"btn btn-info"
/>
<a
href=
"/toAdd"
th:href=
"@{/list}"
class=
"btn btn-info"
>
Back
</a>
</div>
</div>
</form>
</div>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录