——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SpringBoot教务管理系统(java+thymeleaf+html+spring+springboot+layui+maven)
一、项目简述
功能包括: 三角色教师 管理员,学生教务管理系统,包括院系管理,课题综合管理,信息管理,以及差旅管理,学生选题等等。
二、项目运行 环境配置:
Jdk1.8 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| @Controller @RequestMapping("/sadmin") public class SuperAdminController {
@Autowired AdminService adminService;
@Autowired HttpServletRequest request;
@Autowired HttpServletResponse response;
@Autowired CollegeService collegeService;
@ModelAttribute("id_institute") public long getRoleInfo(HttpSession session) throws MyException { User user = (User) request.getAttribute("user"); if(user!=null) return user.getId(); throw new MyException("无法访问"); }
private static final Logger LOGGER = LoggerFactory.getLogger(SuperAdminController.class);
@PostMapping("/updatePwd") @ResponseBody public Msg updatePwd( @RequestBody Sadmin sadmin, HttpSession httpSession){
User user = (User)request.getAttribute("user"); adminService.updateSadminPwdByUserName( user.getUserName(), sadmin.getPwd() );
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| fun8(region, sheet, workBook); cell = row.createCell(6); cell.setCellValue(teacher.getName()); cell.setCellStyle(style2); row.setHeightInPoints(30);
XSSFCellStyle style3 = workBook.createCellStyle(); f = workBook.createFont(); f.setFontHeightInPoints((short) 12); f.setFontName("仿宋_GB2312"); style3.setFont(f); style3.setWrapText(true); style3.setAlignment(HorizontalAlignment.CENTER); style3.setVerticalAlignment(VerticalAlignment.CENTER); style3.setBorderBottom(BorderStyle.THIN); style3.setBorderLeft(BorderStyle.THIN); style3.setBorderRight(BorderStyle.THIN); style3.setBorderTop(BorderStyle.THIN);
String teachingTask = debriefing.getTeachingtask(); String[] aa = teachingTask.split("/");
row = sheet.createRow(2); region = new CellRangeAddress(2, 2 + aa.length, (short) 0, (short) 0); sheet.addMergedRegion(region); fun8(region, sheet, workBook); cell = row.createCell(0); cell.setCellValue("教学任务"); cell.setCellStyle(style3);
cell = row.createCell(1); cell.setCellValue("序号"); cell.setCellStyle(style2); region = new CellRangeAddress(2, 2, (short) 2, (short) 6); sheet.addMergedRegion(region);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| RegionUtil.setBorderBottom(borderStyle, region, sheet); RegionUtil.setBorderLeft(borderStyle, region, sheet); RegionUtil.setBorderRight(borderStyle, region, sheet); RegionUtil.setBorderTop(borderStyle, region, sheet); }
@GetMapping("/down_debriefing") public void fun9(Long year, String term, HttpSession httpSession, HttpServletResponse response) throws IOException { Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
DebriefingWithBLOBs debriefing = teacherService.selectTermDebriefingInfo(teacher.getId(), year, term);
XSSFWorkbook workBook = new XSSFWorkbook(); XSSFSheet sheet = workBook.createSheet("Sheet1");
sheet.setColumnWidth(0, 15 * 256);
sheet.setColumnWidth(6, 24 * 256);
XSSFRow row = sheet.createRow(0); CellRangeAddress region = new CellRangeAddress(0, 0, (short) 0, (short) 6); sheet.addMergedRegion(region); fun8(region, sheet, workBook);
row.createCell(0).setCellValue(teacher.getInstituteName() + year + term + "学期述职表"); row.setHeightInPoints(40);
XSSFCellStyle style1 = workBook.createCellStyle(); XSSFFont f = workBook.createFont(); f.setFontHeightInPoints((short) 18); f.setFontName("仿宋_GB2312"); f.setBold(true); style1.setFont(f); style1.setAlignment(HorizontalAlignment.CENTER); style1.setVerticalAlignment(VerticalAlignment.CENTER);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| cell.setCellValue("部 门"); cell.setCellStyle(style2);
region = new CellRangeAddress(1, 1, (short) 1, (short) 3); sheet.addMergedRegion(region); fun8(region, sheet, workBook); cell = row.createCell(1); cell.setCellValue(teacher.getInstituteName()); cell.setCellStyle(style2);
cell = row.createCell(4); cell.setCellValue("填报人"); cell.setCellStyle(style2);
region = new CellRangeAddress(1, 1, (short) 4, (short) 5); sheet.addMergedRegion(region); fun8(region, sheet, workBook); cell = row.createCell(6); cell.setCellValue(teacher.getName()); cell.setCellStyle(style2); row.setHeightInPoints(30);
XSSFCellStyle style3 = workBook.createCellStyle(); f = workBook.createFont(); f.setFontHeightInPoints((short) 12); f.setFontName("仿宋_GB2312"); style3.setFont(f); style3.setWrapText(true); style3.setAlignment(HorizontalAlignment.CENTER); style3.setVerticalAlignment(VerticalAlignment.CENTER); style3.setBorderBottom(BorderStyle.THIN); style3.setBorderLeft(BorderStyle.THIN); style3.setBorderRight(BorderStyle.THIN); style3.setBorderTop(BorderStyle.THIN);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
private void setSizeColumn(XSSFSheet sheet, int size) { for (int columnNum = 1; columnNum < size; columnNum++) { int columnWidth = sheet.getColumnWidth(columnNum) / 256; for (int rowNum = 0; rowNum < sheet.getLastRowNum(); rowNum++) { XSSFRow currentRow; if (sheet.getRow(rowNum) == null) { currentRow = sheet.createRow(rowNum); } else { currentRow = sheet.getRow(rowNum); } if (currentRow.getCell(columnNum) != null) { XSSFCell currentCell = currentRow.getCell(columnNum); if (currentCell.getCellType() == XSSFCell.CELL_TYPE_STRING) { int length = currentCell.getStringCellValue().getBytes().length; if (columnWidth < length) { columnWidth = length; } } } } sheet.setColumnWidth(columnNum, (columnWidth + 4) * 256); } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| setSizeColumn(sheet, 8);
response.setCharacterEncoding("utf-8"); response.setContentType("application/msexcel"); OutputStream os = response.getOutputStream(); String outputName = "学生一览表"; String encodeFilename = URLEncoder.encode(outputName, StandardCharsets.UTF_8.toString()); response.setHeader("Content-disposition", "attachment; filename=" + encodeFilename + ".xlsx");
wb.write(os); os.flush(); os.close(); }
public void fun8(CellRangeAddress region, XSSFSheet sheet, XSSFWorkbook workBook) {
BorderStyle borderStyle = BorderStyle.THIN;
RegionUtil.setBorderBottom(borderStyle, region, sheet); RegionUtil.setBorderLeft(borderStyle, region, sheet); RegionUtil.setBorderRight(borderStyle, region, sheet); RegionUtil.setBorderTop(borderStyle, region, sheet); }
} package com.hngy.educationaladministration.controller;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=521422312105200jc
https://javayms.pages.dev?id=521422312105200jc