parent
e4670a4379
commit
2477915abe
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 数据源本地存储已忽略文件
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/project.iml" filepath="$PROJECT_DIR$/.idea/project.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
After Width: | Height: | Size: 126 KiB |
@ -0,0 +1,29 @@
|
||||
# 详细设计
|
||||
|
||||
## 1、用例设计模型
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## 2、类设计模型
|
||||
|
||||
<img src="https://s2.loli.net/2022/10/11/qpfVrx6tD5bB7gJ.png" alt="类设计模型" style="zoom: 150%;" />
|
||||
|
||||
## 3、数据设计模型
|
||||
|
||||

|
@ -0,0 +1,61 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
|
||||
import com.example.demo.domain.User;
|
||||
import com.example.demo.mapper.UserMapper;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class Webneed {
|
||||
@Autowired
|
||||
UserMapper userMapper;
|
||||
|
||||
@GetMapping("/exceldownload")
|
||||
public void download(HttpServletResponse response, @RequestParam(value = "taskid", required = false) String taskid) throws IOException {
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
HSSFSheet sheet = workbook.createSheet("任务情况");
|
||||
List<User> list = this.userMapper.selectList(null);
|
||||
String filename = taskid + ".xls";
|
||||
int rowNum = 1;
|
||||
//表头
|
||||
String[] headers = {"学号", "姓名", "power"};
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
HSSFCell cell = row.createCell(i);
|
||||
HSSFRichTextString text = new HSSFRichTextString(headers[i]);
|
||||
cell.setCellValue(text);
|
||||
}
|
||||
//在表中存放查询到的数据放入对应的列
|
||||
for (User user : list) {
|
||||
HSSFRow row1 = sheet.createRow(rowNum);
|
||||
row1.createCell(0).setCellValue(user.getStudentNumber());
|
||||
row1.createCell(1).setCellValue(user.getName());
|
||||
row1.createCell(2).setCellValue(user.getPower());
|
||||
rowNum++;
|
||||
}
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + filename);
|
||||
response.flushBuffer();
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
@RequestMapping("/daochu")
|
||||
|
||||
public String daochu() {
|
||||
return "daochu";
|
||||
}
|
||||
|
||||
@RequestMapping("")
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" style="margin-top:4px; margin-left: 18px">
|
||||
<tr>
|
||||
<td><a href="#" class="easyui-linkbutton" onclick="downloadfile();">数据导出</a></td>
|
||||
|
||||
</tr>
|
||||
<script>
|
||||
function downloadfile() {
|
||||
window.location.href = "/exceldownload";
|
||||
}
|
||||
</script>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue