Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Walter.Wen
SpringBootFileUploadDownload
提交
dc313ecf
S
SpringBootFileUploadDownload
项目概览
Walter.Wen
/
SpringBootFileUploadDownload
通知
5
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBootFileUploadDownload
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
dc313ecf
编写于
3月 24, 2020
作者:
W
wenguang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
整合Mybatis,引入Excel依赖包
上级
a35a8e4d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
192 addition
and
0 deletion
+192
-0
pom.xml
pom.xml
+43
-0
src/main/java/com/we/MainApplication.java
src/main/java/com/we/MainApplication.java
+3
-0
src/main/java/com/we/controller/MysqlTestController.java
src/main/java/com/we/controller/MysqlTestController.java
+33
-0
src/main/java/com/we/mapper/StudentMapper.java
src/main/java/com/we/mapper/StudentMapper.java
+12
-0
src/main/java/com/we/pojo/Student.java
src/main/java/com/we/pojo/Student.java
+18
-0
src/main/java/com/we/service/IStudentService.java
src/main/java/com/we/service/IStudentService.java
+10
-0
src/main/java/com/we/service/impl/StudentServiceImpl.java
src/main/java/com/we/service/impl/StudentServiceImpl.java
+21
-0
src/main/resources/mapper/StudentMapper.xml
src/main/resources/mapper/StudentMapper.xml
+32
-0
src/main/resources/templates/mysqltest/listtest.html
src/main/resources/templates/mysqltest/listtest.html
+20
-0
未找到文件。
pom.xml
浏览文件 @
dc313ecf
...
...
@@ -33,5 +33,48 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<!--Excel导入导出工具-->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
<version>
1.1.2-beat1
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.18.2
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.13
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis
</artifactId>
<version>
3.4.6
</version>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
src/main/java/com/we/MainApplication.java
浏览文件 @
dc313ecf
package
com.we
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
@MapperScan
(
"com.we.mapper"
)
public
class
MainApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
MainApplication
.
class
,
args
);
}
}
src/main/java/com/we/controller/MysqlTestController.java
0 → 100644
浏览文件 @
dc313ecf
package
com.we.controller
;
import
com.we.pojo.Student
;
import
com.we.service.IStudentService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.List
;
@Controller
public
class
MysqlTestController
{
private
String
prefix
=
"/mysqltest"
;
@Autowired
private
IStudentService
studentService
;
@GetMapping
(
"/listtest"
)
public
String
selectAll
(
Model
model
)
{
List
<
Student
>
stus
=
studentService
.
selectStuList
();
//Map<String, Object> model= new HashMap<String, Object>();
//model.put("stus", stus);
model
.
addAttribute
(
"stus"
,
stus
);
return
prefix
+
"/listtest"
;
}
}
src/main/java/com/we/mapper/StudentMapper.java
0 → 100644
浏览文件 @
dc313ecf
package
com.we.mapper
;
import
com.we.pojo.Student
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
StudentMapper
{
public
List
<
Student
>
selectStuList
();
}
src/main/java/com/we/pojo/Student.java
0 → 100644
浏览文件 @
dc313ecf
package
com.we.pojo
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
@Getter
@Setter
@ToString
public
class
Student
{
private
String
stuid
;
private
String
stuclass
;
private
String
stuname
;
private
String
stuage
;
private
String
stusex
;
private
String
stutel
;
}
src/main/java/com/we/service/IStudentService.java
0 → 100644
浏览文件 @
dc313ecf
package
com.we.service
;
import
com.we.pojo.Student
;
import
java.util.List
;
public
interface
IStudentService
{
public
List
<
Student
>
selectStuList
();
}
src/main/java/com/we/service/impl/StudentServiceImpl.java
0 → 100644
浏览文件 @
dc313ecf
package
com.we.service.impl
;
import
com.we.mapper.StudentMapper
;
import
com.we.pojo.Student
;
import
com.we.service.IStudentService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
StudentServiceImpl
implements
IStudentService
{
@Autowired
private
StudentMapper
studentMapper
;
@Override
public
List
<
Student
>
selectStuList
()
{
return
studentMapper
.
selectStuList
();
}
}
src/main/resources/mapper/StudentMapper.xml
0 → 100644
浏览文件 @
dc313ecf
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.we.mapper.StudentMapper"
>
<resultMap
type=
"com.we.pojo.Student"
id=
"StudentResult"
>
<result
property=
"stuid"
column=
"stuid"
/>
<result
property=
"stuclass"
column=
"stuclass"
/>
<result
property=
"stuname"
column=
"stuname"
/>
<result
property=
"stuage"
column=
"stuage"
/>
<result
property=
"stusex"
column=
"stusex"
/>
<result
property=
"stutel"
column=
"stutel"
/>
</resultMap>
<sql
id=
"selectStuVo"
>
select stuid, stuclass, stuname, stuage, stusex, stutel from student
</sql>
<select
id=
"selectStuList"
parameterType=
"com.we.pojo.Student"
resultMap=
"StudentResult"
>
<include
refid=
"selectStuVo"
/>
<where>
<if
test=
"stuid != null and stuid != '' "
>
and stuid = #{stuid}
</if>
<if
test=
"stuclass != null and stuclass != '' "
>
and stuclass = #{stuclass}
</if>
<if
test=
"stuname != null and stuname != '' "
>
and stuname = #{stuname}
</if>
<if
test=
"stuage != null and stuage != '' "
>
and stuage = #{stuage}
</if>
<if
test=
"stusex != null and stusex != '' "
>
and stusex = #{stusex}
</if>
<if
test=
"stutel != null and stutel != '' "
>
and stutel = #{stutel}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
src/main/resources/templates/mysqltest/listtest.html
0 → 100644
浏览文件 @
dc313ecf
<!DOCTYPE html>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
学生信息
</title>
</head>
<body>
<table>
<tr
th:each=
"stus : ${stus}"
>
<td
th:text=
"${stus.stuid}"
></td>
<td
th:text=
"${stus.stuclass}"
></td>
<td
th:text=
"${stus.stuname}"
></td>
<td
th:text=
"${stus.stuage}"
></td>
<td
th:text=
"${stus.stusex}"
></td>
<td
th:text=
"${stus.stutel}"
></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录