Skip to content

Commit

Permalink
springboot整合jsp代码提交
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwujing committed Jun 8, 2018
1 parent e3b6085 commit 5cc7076
Show file tree
Hide file tree
Showing 15 changed files with 626 additions and 0 deletions.
1 change: 1 addition & 0 deletions springboot-jsp-jpa/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
120 changes: 120 additions & 0 deletions springboot-jsp-jpa/pom.xml
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>
16 changes: 16 additions & 0 deletions springboot-jsp-jpa/src/main/java/com/pancm/App.java
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 springboot-jsp-jpa/src/main/java/com/pancm/dao/UserDao.java
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 springboot-jsp-jpa/src/main/java/com/pancm/pojo/User.java
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 + "]";
}




}
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();

}
Loading

0 comments on commit 5cc7076

Please sign in to comment.