forked from xuwujing/springBoot-study
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
626 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
|
||
<groupId>1.0.0</groupId> | ||
<artifactId>springboot-jsp</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>springboot-jsp</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.5.9.RELEASE</version> | ||
<relativePath /> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
<fastjson>1.2.41</fastjson> | ||
<mybatis-spring-boot>1.2.0</mybatis-spring-boot> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Spring Boot Web 依赖 核心 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- Spring Boot 热部署 class文件之后会自动重启 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<!-- Spring Boot Test 依赖 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Spring Boot JPA --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
</dependency> | ||
|
||
|
||
<!-- Spring Boot Mybatis 依赖 --> | ||
<dependency> | ||
<groupId>org.mybatis.spring.boot</groupId> | ||
<artifactId>mybatis-spring-boot-starter</artifactId> | ||
<version>${mybatis-spring-boot}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
</dependency> | ||
|
||
|
||
|
||
|
||
<!--fastjson 相关jar --> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>fastjson</artifactId> | ||
<version>${fastjson}</version> | ||
</dependency> | ||
|
||
<!--JSP 依赖 --> | ||
<!-- servlet依赖. --> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>jstl</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- tomcat的支持.--> | ||
<dependency> | ||
<groupId>org.apache.tomcat.embed</groupId> | ||
<artifactId>tomcat-embed-jasper</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
|
||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.pancm; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
|
||
@SpringBootApplication | ||
public class App | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
// 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件 | ||
SpringApplication.run(App.class, args); | ||
System.out.println("程序正在运行..."); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
springboot-jsp-jpa/src/main/java/com/pancm/dao/UserDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.pancm.dao; | ||
|
||
import org.apache.ibatis.annotations.Mapper; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import com.pancm.pojo.User; | ||
|
||
/** | ||
* | ||
* Title: UserDao | ||
* Description: | ||
* 用户数据接口 | ||
* Version:1.0.0 | ||
* @author pancm | ||
* @date 2018年1月9日 | ||
*/ | ||
@Mapper | ||
public interface UserDao extends JpaRepository<User, Long>{ | ||
|
||
} |
118 changes: 118 additions & 0 deletions
118
springboot-jsp-jpa/src/main/java/com/pancm/pojo/User.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package com.pancm.pojo; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
|
||
/** | ||
* | ||
* Title: User | ||
* Description:用户pojo类 | ||
* Version:1.0.0 | ||
* @author pancm | ||
* @date 2017年9月26日 | ||
*/ | ||
@Entity | ||
@Table(name = "t_user") | ||
public class User { | ||
|
||
/** 编号 */ | ||
@Id | ||
@GeneratedValue | ||
private Long id; | ||
/** 姓名 */ | ||
@Column(nullable = false, unique = true) | ||
private String name; | ||
/** 密码*/ | ||
@Column(nullable = false) | ||
private String password; | ||
/** 年龄 */ | ||
@Column(nullable = false) | ||
private Integer age; | ||
|
||
public User(){ | ||
} | ||
|
||
/** | ||
* 获取编号 | ||
* @return id | ||
*/ | ||
public Long getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* 设置编号 | ||
* @param id | ||
*/ | ||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* 获取姓名 | ||
* @return name | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* 设置姓名 | ||
* @param name | ||
*/ | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
|
||
|
||
/** | ||
* 获取password | ||
* @return password | ||
*/ | ||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
/** | ||
* 设置password | ||
* @param String password | ||
*/ | ||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
|
||
|
||
/** | ||
* 获取age | ||
* @return age | ||
*/ | ||
public Integer getAge() { | ||
return age; | ||
} | ||
|
||
/** | ||
* 设置age | ||
* @param Integer age | ||
*/ | ||
public void setAge(Integer age) { | ||
this.age = age; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
@Override | ||
public String toString() { | ||
return "User [id=" + id + ", name=" + name + ", password=" + password + ", age=" + age + "]"; | ||
} | ||
|
||
|
||
|
||
|
||
} |
52 changes: 52 additions & 0 deletions
52
springboot-jsp-jpa/src/main/java/com/pancm/service/UserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.pancm.service; | ||
|
||
import java.util.List; | ||
|
||
import com.pancm.pojo.User; | ||
|
||
|
||
/** | ||
* | ||
* Title: UserService | ||
* Description: | ||
* 用户接口 | ||
* Version:1.0.0 | ||
* @author pancm | ||
* @date 2018年3月19日 | ||
*/ | ||
public interface UserService { | ||
|
||
/** | ||
* 新增用户 | ||
* @param user | ||
* @return | ||
*/ | ||
boolean addUser(User user); | ||
|
||
/** | ||
* 修改用户 | ||
* @param user | ||
* @return | ||
*/ | ||
boolean updateUser(User user); | ||
|
||
|
||
/** | ||
* 删除用户 | ||
* @param id | ||
* @return | ||
*/ | ||
boolean deleteUser(Long id); | ||
|
||
/** | ||
* 根据用户名字查询用户信息 | ||
* @param userName | ||
*/ | ||
User findUserById(Long id); | ||
/** | ||
* 查询所有 | ||
* @return | ||
*/ | ||
List<User> findAll(); | ||
|
||
} |
Oops, something went wrong.