当前位置: 首页 > 编程日记 > 正文

Java项目:教材管理系统(java+SSM+jsp+mysql+maven)

源码获取:博客首页 "资源" 里下载!

一、项目简述

功能包括: 管理员可以增删改查教材、教材商、入库教材、用户(用 户包括学生和教师)可以对教材商、教材进行。xcel的导入 导出操作。教U阿以领取入库的教材,可以退还教材。学 生只能在对应的教师那里领取教材,并且可以退还教材、 查询自己已经领取的教材。并且对已领教材付款等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。

教师管理控制层:

@Authority(roles = {Role.TEACHER})
@Controller
@RequestMapping("/teacher")
public class TeacherController {@AutowiredTeacherService teacherService;@AutowiredSubjectService subjectService;@RequestMapping(value = {"", "/loginPage"})public String loginPage() {return "teacher/login";}@GetMapping("/index")public String homePage() {return "teacher/public-teacher-index";}@GetMapping("/updatePwd")public String updatePwd() {return "teacher/teacherInfo/updatePwd";}@GetMapping("/teacherInfo")public String teacherInfo() {return "teacher/teacherInfo/teacherinfo";}@GetMapping("/modifyinfo")public String modifyInfo() {return "teacher/teacherInfo/updateinfo";}@GetMapping("/workapprovalinfo")public String workInfo() {return "teacher/workapproval/winfo";}@GetMapping("/workapprovaldata")public String workData() {return "teacher/workapproval/wdata";}@GetMapping("/seeworkdata")public String seeWorkData() {return "teacher/workapproval/seewdata";}//填写表格页面@GetMapping("/term_debriefing")public String termDebriefing() {return "teacher/fillouttable/termdebriefing";}@GetMapping("/year_debriefing")public String yearDebriefing() {return "teacher/fillouttable/yeardebriefing";}@GetMapping("/annual_assessment")public String annualAssessment() {return "teacher/fillouttable/annualassessment";}@GetMapping("/work_load")public String workLoad() {return "teacher/fillouttable/workload";}@GetMapping("/technical_personnel")public String technicalPersonnel() {return "teacher/fillouttable/technicalpersonnel";}@GetMapping("/term_business")public String termBusiness() {return "teacher/fillouttable/termbusiness";}//查看表格页面@GetMapping("/show_year_debriefing")public String showYearDebriefing() {return "teacher/showtable/yeardebriefing";}@GetMapping("/show_term_debriefing")public String showTermDebriefing() {return "teacher/showtable/termdebriefing";}@GetMapping("/show_annual_assessment")public String showAnnualAssessment() {return "teacher/showtable/annualassessment";}@GetMapping("/show_technical_personnel")public String showTechnicalPersonnel() {return "teacher/showtable/technicalpersonnel";}@GetMapping("/show_workload")public String showWorkLoad() {return "teacher/showtable/workload";}@GetMapping("/exit")public String exit(HttpServletResponse response) {//将Cookie 中的token 置空Cookie cookie = new Cookie("token", null);cookie.setPath("/");response.addCookie(cookie);return "redirect:/";}//打印页面@GetMapping("/print_term_debriefing")public String printYearDebriefing(Long year, String term, Model model) {model.addAttribute("year", year);model.addAttribute("term", term);return "teacher/showtable/print/termdebriefing";}@GetMapping("/print_year_debriefing")public String printTermDebriefing(Long year, Model model) {model.addAttribute("year", year);return "teacher/showtable/print/yeardebriefing";}@GetMapping("/login")@ResponseBodypublic Msg login(String name, String pwd, HttpSession httpSession, HttpServletResponse response) throws ParseException {name = name.trim();int flag = teacherService.teacherDL(name, pwd);if (flag == 200) {User user = new User();//-1表示为超管user.setId(0L);user.setRole("teacher");user.setUserName(name);//生成Token 存到 CookieCookie cookie = new Cookie("token", TokenUtil.createToken(user));//该Cookie无法被js读取cookie.setHttpOnly(true);cookie.setPath("/");response.addCookie(cookie);Teacher teacher = teacherService.selectTeacher(name);httpSession.setAttribute("teacherInfo", teacher);httpSession.setMaxInactiveInterval(3600);}return Msg.success().add("info", flag);}//教师信息修改//修改教师密码@PostMapping("/teacherupdetpwd")@ResponseBodypublic Msg fun6(String oldpwd, String newpwd, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");int flag = teacherService.teacherUpdetpwd(teacher.getUsername(), oldpwd, newpwd);return Msg.success().add("flag", flag);}//修改教师信息@PostMapping("/teacherupdeteinfo")@ResponseBodypublic Msg updateinfo(String name, String gender, HttpSession httpSession) {TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");teacher.setName(name);teacher.setGender(gender);teacherService.teacherupdateInfo(teacher);return Msg.success();}//教师出差模块//查询所有教师出差申请信息@GetMapping("/select_work_all")@ResponseBodypublic Msg fun1(HttpSession httpSession) {TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");List<WorkapprovalWithBLOBs> list = teacherService.selectTeacherWorkAll(teacher.getId());return Msg.success().add("workinfo", list);}//查询申请成功教师出差申请@GetMapping("/select_work_success")@ResponseBodypublic Msg fun2(HttpSession httpSession) {TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSuccess(teacher.getId());return Msg.success().add("workinfo", list);}//查询申请失败教师出差申请@GetMapping("/select_work_failed")@ResponseBodypublic Msg fun3(HttpSession httpSession) {TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");List<WorkapprovalWithBLOBs> list = teacherService.selectWorkFailed(teacher.getId());return Msg.success().add("workinfo", list);}//查询已提交教师出差申请@GetMapping("/select_work_submitted")@ResponseBodypublic Msg fun4(HttpSession httpSession) {TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSubmitted(teacher.getId());return Msg.success().add("workinfo", list);}//删除申请失败的教师出差@PostMapping("/delete_work")@ResponseBodypublic Msg deleteWork(Long id) {teacherService.deleteWorkById(id);return Msg.success();}//加载报告填写页面@GetMapping("/fillworkapproval")public String fun5(Long id, Model model) throws ParseException {WorkapprovalWithBLOBs workapproval = teacherService.selectWorkById(id);SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");String start = sdf.format(workapproval.getBeginDate());String end = sdf.format(workapproval.getEndDate());String time = start + " - " + end;model.addAttribute("workapproval", workapproval);model.addAttribute("time", time);return "teacher/workapproval/fillwdata";}//上传出差报告@PostMapping("/fill_in_w")@ResponseBodypublic Msg fun7(@RequestParam("id_work") Long idWork, @RequestParam("news") String news, @RequestParam("flag") Integer flag,@RequestParam("file") MultipartFile file) throws IOException {//判断file的值是否为空if (file.isEmpty()) {return Msg.error();}String fileName = file.getOriginalFilename();// 获取上传文件的原名int size = (int) file.getSize();System.out.println(fileName + "-->" + size);File path = new File(ResourceUtils.getURL("target").getPath());String savePath = path.getAbsolutePath() + "\\classes\\static\\model";String saveFileName = savePath + "\\" + fileName;//        String path = "D:/test";//文件保存路径File targetFile = new File(savePath);if (!targetFile.getParentFile().exists()) { //判断文件父目录是否存在targetFile.getParentFile().mkdir();}file.transferTo(new File(targetFile, fileName)); // 开始接受文件Workapprovaldata workapprovaldata = new Workapprovaldata();workapprovaldata.setIdWorkapproval(idWork);workapprovaldata.setNews(news);workapprovaldata.setDatarar(saveFileName);//flag == 0 公有  flag == 1私有workapprovaldata.setFlag(flag);teacherService.insertWordData(workapprovaldata);return Msg.success();}//查看出差报告@GetMapping("/select_work_data")@ResponseBodypublic Msg fun8(Integer pn, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");PageHelper.startPage(pn, 9);List<Workapprovaldata> list = teacherService.selectWorkData(teacher.getIdSection());PageInfo page = new PageInfo(list, 5);return Msg.success().add("dataInfo", page);}//出差附件下载@RequestMapping(value = "/file_download")public ResponseEntity<byte[]> downloadFile(String dataId, HttpServletRequest req, HttpServletResponse response) throws IOException {Workapprovaldata workapprovaldata = null;if (dataId != null) {Long id = Long.valueOf(dataId);workapprovaldata = teacherService.selectWorkDataById(id);}if (workapprovaldata != null) {String filePath = workapprovaldata.getDatarar();//设置文件路径File file = new File(filePath);if (!file.exists()) {file.mkdirs();}String fileName = file.getName();HttpHeaders headers = new HttpHeaders();headers.setContentType(MediaType.MULTIPART_FORM_DATA);String encodeFilename = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());headers.setContentDispositionFormData("attachment", encodeFilename);return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);}return null;}//学期述职@PostMapping("/upload_term_debriefing")@ResponseBodypublic Msg fun9(String year, String term, String teachingTask, String scientificResearch,String otherWork, String winAward, String summary, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");DebriefingWithBLOBs debriefingWithBLOBs = new DebriefingWithBLOBs();debriefingWithBLOBs.setIdTeacher(teacher.getId());debriefingWithBLOBs.setYear(Long.parseLong(year));debriefingWithBLOBs.setTerm(term);debriefingWithBLOBs.setTeachingtask(teachingTask);debriefingWithBLOBs.setAchievementsinscientificresearch(scientificResearch);debriefingWithBLOBs.setOtherwork(otherWork);debriefingWithBLOBs.setWinaward(winAward);debriefingWithBLOBs.setSummary(summary);int flag = teacherService.selectTermDebriefingFlag(teacher.getId(), Long.parseLong(year), term);if (flag == 1) {teacherService.updateTermDebriefing(debriefingWithBLOBs);} else {int i = teacherService.insertTermDebriefing(debriefingWithBLOBs);}return Msg.success();}// 工作量表相关@GetMapping("/wordload")public String wordloadPage() {return "teacher/table/workload";}@GetMapping("/wordloadData")@ResponseBodypublic Msg wordloadData(@RequestParam("year") String year,@RequestParam("trem") String trem) {Teacher teacher = (Teacher) request.getSession().getAttribute("teacherInfo");return Msg.success().add("teacher", teacher).add("workloadDTO", teacherService.getWorkload(teacher.getId(), year, trem));}private static final Logger LOGGER = LoggerFactory.getLogger(TeacherController.class);@AutowiredHttpServletRequest request;@PostMapping("/wordload")@ResponseBodypublic Msg wordloadSave(@RequestBody WorkloadDTO workloadDTO) {Teacher teacher = (Teacher) request.getSession().getAttribute("teacherInfo");
//        LOGGER.info("{}",workloadDTO);teacherService.saveWorkload(workloadDTO, teacher);return Msg.success();}// 教师业务表@GetMapping("/business")public String businessPage() {return "teacher/table/business";}@GetMapping("/businessData")@ResponseBodypublic Msg businessData(@RequestParam("year") String year,@RequestParam("trem") String trem) {Teacher teacher = (Teacher) request.getSession().getAttribute("teacherInfo");return teacherService.getBusiness(teacher.getId(), year, trem).add("teacher", teacher);}@PostMapping("/business")@ResponseBodypublic Msg saveBusiness(@RequestBody BusinessDTO businessDTO) {Teacher teacher = (Teacher) request.getSession().getAttribute("teacherInfo");return Msg.sqlChange((int) teacherService.saveBusiness(businessDTO, teacher));}//年度述职@PostMapping("/upload_year_debriefing")@ResponseBodypublic Msg fun10(String year, String teachingTask, String scientificResearch,String otherWork, String winAward, String summary, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");DebriefingYearWithBLOBs debriefingYear = new DebriefingYearWithBLOBs();debriefingYear.setIdTeacher(teacher.getId());debriefingYear.setYear(Long.parseLong(year));debriefingYear.setTeachingtask(teachingTask);debriefingYear.setAchievementsinscientificresearch(scientificResearch);debriefingYear.setOtherwork(otherWork);debriefingYear.setWinaward(winAward);debriefingYear.setSummary(summary);Long flag = teacherService.selectYearDebriefingFlag(teacher.getId(), Long.parseLong(year));if (flag == 1) {teacherService.updateYearDebriefing(debriefingYear);} else {int i = teacherService.insertYearDebriefing(debriefingYear);}return Msg.success();}//查询年度述职中年份@GetMapping("/select_debriefing_year")@ResponseBodypublic Msg fun11() {List<DebriefingYear> list = teacherService.selectDebriefingByYear();//         把年份排序Collections.sort(list, new Comparator<DebriefingYear>() {@Overridepublic int compare(DebriefingYear o1, DebriefingYear o2) {return (int) (o2.getYear() - o1.getYear());}});return Msg.success().add("year", list);}//查询指定年份的年度述职信息@GetMapping("/select_debriefing_year_info")@ResponseBodypublic Msg fun12(Long year, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");DebriefingYearWithBLOBs debriefingYear = teacherService.selectYearDebriefingInfo(teacher.getId(), year);return Msg.success().add("debriefingInfo", debriefingYear);}//查询学期述职中年份@GetMapping("select_debriefing_term")@ResponseBodypublic Msg fun13() {List<Debriefing> list = teacherService.selectDebriefingTermByYear();List<Long> temp = new ArrayList<>();//去除重复的年份for (Debriefing s : list) {if (!temp.contains(s.getYear())) {temp.add(s.getYear());}}return Msg.success().add("year", temp);}//查询指定年份的学期述职信息@GetMapping("/select_debriefing_term_info")@ResponseBodypublic Msg fun14(Long year, String term, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");DebriefingWithBLOBs debriefing = teacherService.selectTermDebriefingInfo(teacher.getId(), year, term);return Msg.success().add("debriefingInfo", debriefing);}//年度考核@PostMapping("/upload_annual_assessment")@ResponseBodypublic Msg fun15(String personalSummary, String year, String remark, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");AnnualAssessmentWithBLOBs assessment = new AnnualAssessmentWithBLOBs();assessment.setIdTeacher(teacher.getId());assessment.setPersonalsummary(personalSummary);assessment.setYear(year);assessment.setRemark(remark);Long flag = teacherService.selectAnnualAssessmentFlag(teacher.getId(), year);if (flag == 1) {int i = teacherService.updateAnnualAssessment(assessment);} else {int i = teacherService.insertAnnualAssessment(assessment);}return Msg.success();}//年度专业技术人员考核表@PostMapping("/upload_technical_personnel")@ResponseBodypublic Msg fun16(String year, String mainAchievements, String attendance, String rewardsAndPunishments, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");TechnicalPersonnelWithBLOBs technicalPersonnelWithBLOBs = new TechnicalPersonnelWithBLOBs();technicalPersonnelWithBLOBs.setIdTeacher(teacher.getId());technicalPersonnelWithBLOBs.setYear(year);technicalPersonnelWithBLOBs.setMainachievements(mainAchievements);technicalPersonnelWithBLOBs.setAttendance(attendance);technicalPersonnelWithBLOBs.setRewardsandpunishments(rewardsAndPunishments);Long flag = teacherService.selectTechnicalPersonnelFlag(teacher.getId(), Long.parseLong(year));if (flag == 1) {int i = teacherService.updateTechnicalPersonnel(technicalPersonnelWithBLOBs);} else {int i = teacherService.insertTechnicalPersonnel(technicalPersonnelWithBLOBs);}return Msg.success();}//查询年度考核年份@GetMapping("/select_annual_assessment")@ResponseBodypublic Msg fun17(HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");List<AnnualAssessment> list = teacherService.selectAnnualAssessmentByYear(teacher.getId());if (list.isEmpty()) {return Msg.fail();} else {return Msg.success().add("year", list);}}//查询指定年度考核信息@GetMapping("/select_annualassessment_year_info")@ResponseBodypublic Msg fun18(Long year, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");AnnualAssessmentWithBLOBs assessment = teacherService.selectAnnualAssessmentInfo(teacher.getId(), year);return Msg.success().add("assessmentInfo", assessment);}//查询度专业技术人员考核表年份@GetMapping("/select_technical_personnel_year")@ResponseBodypublic Msg fun18(HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");List<TechnicalPersonnel> list = teacherService.selectTechnicalPersonnelByYear(teacher.getId());if (list.isEmpty()) {return Msg.fail();} else {return Msg.success().add("year", list);}}//查询度专业技术人员考核表信息@GetMapping("/select_technicalpersonnel_year_info")@ResponseBodypublic Msg fun19(Long year, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");TechnicalPersonnelWithBLOBs technicalPersonnelWithBLOBs = teacherService.selectTechnicalPersonnelInfo(teacher.getId(), year);return Msg.success().add("technicalPersonnel", technicalPersonnelWithBLOBs);}// 毕业设计内容// 加载上传课题页面@GetMapping("/upload_topic_page")public String uploadTopic(ModelMap modelMap, HttpSession httpSession) {TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");List<Projecttype> projecttypes = teacherService.select_allProjecttype();List<Projectsource> projectsources = teacherService.select_allProjectsource();List<Specialty> specialties = teacherService.select_allSpecialty(teacher.getIdSection());modelMap.addAttribute("projecttypes", projecttypes);modelMap.addAttribute("projectsources", projectsources);modelMap.addAttribute("specialties", specialties);return "teacher/graduation/upload";}// 上传课题@PostMapping("/up_project")@ResponseBodypublic Msg fun20(String projectName, Long idProjecttype, Long idProjectsource, String marchspecialty, String teachernames, @RequestParam("file") MultipartFile file, HttpServletRequest request, HttpSession httpSession) throws IOException {if (file == null) {return Msg.fail().add("msg","文件上传失败");}if(teacherService.selectProjectByName(projectName).size()>0){System.out.println("上传失败");return Msg.fail().add("msg","课题名已存在");}Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");ServletContext servletContext = request.getSession().getServletContext();String uploadFileName = file.getOriginalFilename(); // 获取上传文件的原名System.out.println(uploadFileName);uploadFileName = uploadFileName.substring(uploadFileName.lastIndexOf(File.separator) + 1);System.out.println(uploadFileName);File path = new File(ResourceUtils.getURL("target").getPath());String savePath =path.getAbsolutePath() + File.separator+"classes+"+File.separator+"static"+File.separator+"model"+File.separator + teacher.getId();String saveFileName = savePath +File.separator + uploadFileName;File dirs = new File(savePath);//判断路径是否存在,如果不存在就创建一个if (!dirs.exists()) {dirs.mkdirs();}file.transferTo(new File(dirs, uploadFileName)); // 开始接受文件System.out.println(teachernames);ProjectWithBLOBs project = new ProjectWithBLOBs();project.setProjectname(projectName);project.setIdProjecttype(idProjecttype);project.setIdProjectsource(idProjectsource);project.setIdTeacher(teacher.getId());project.setFilepath(saveFileName);project.setMarchspecialty(marchspecialty.trim());project.setTeachernames(teachernames);project.setSelectcount(0);project.setSelectFlag(0);project.setVerifyprojectFlag(0);project.setReleaseFlag(0);int i = teacherService.insert_project(project);return Msg.success();}//查看自己的课题发布记录@GetMapping("/cxmyProject")public String fun21(ModelMap modelMap, HttpSession httpSession)  {TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");List<Projecttype> projecttypes = teacherService.select_allProjecttype();List<Projectsource> projectsources = teacherService.select_allProjectsource();List<Specialty> specialties = teacherService.select_allSpecialty(teacher.getIdSection());modelMap.addAttribute("projecttypes", projecttypes);modelMap.addAttribute("projectsources", projectsources);modelMap.addAttribute("specialties", specialties);List<Project> projects = teacherService.selectTeacherProject(teacher.getName());for (int i = 0; i < projects.size(); i++) {if (projects.get(i).getVerifyprojectFlag() == 0) projects.get(i).setProjectZT("未审核");else if (projects.get(i).getVerifyprojectFlag() == 1) projects.get(i).setProjectZT("审核未通过");else projects.get(i).setProjectZT("审核通过");}modelMap.addAttribute("Myproject", projects);return "teacher/graduation/section_xq/index";}// 发布或取消发布已审核通过的课题@PostMapping("/fb_project")@ResponseBodypublic String fun8(Long project_id, String pd,HttpSession httpSession) {int s = Integer.parseInt(pd);teacherService.updateProjectFB(project_id, s);if (s == 0) {teacherService.deleteSelectedAll(project_id);teacherService.updateProjectCount(project_id);}Map<String, String> map = new HashMap<String, String>();map.put("pd", "" + 1);return JSONObject.toJSONString(map);}@PostMapping("del_project")@ResponseBodypublic Msg deleteProject(Long id) {teacherService.deleteProject(id);return Msg.success();}@PostMapping("/updateSubject")@ResponseBodypublic Msg updateProject(Long id, String projectName, Long idProjecttype, Long idProjectsource, String marchspecialty, String teachernames, @RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, HttpSession httpSession) throws IOException {//拼接 teacherNames 字段TeacherWithBLOBs teacher = (TeacherWithBLOBs) request.getSession().getAttribute("teacherInfo");String teacherName = teacher.getName();if (teachernames == null || teachernames.trim().length() == 0) {teachernames = teacherName;} else {teachernames = teacherName + "&" + teachernames;}SubjectWithBLOBs subject = null;//文件大小 为 0 则表示 文件没上传long size = file.getSize();//不更新课题文件情况if (file == null || size == 0) {subject = new SubjectWithBLOBs();subject.setId(id);subject.setProjectname(projectName);subject.setIdProjecttype(idProjecttype);subject.setIdProjectsource(idProjectsource);subject.setMarchspecialty(marchspecialty);subject.setTeachernames(teachernames);//修改后状态置 0subject.setSelectFlag(0);subject.setVerifyprojectFlag(0);subject.setReleaseFlag(0);subjectService.updateSubjectByid(subject);return Msg.success();} else {//获取课题SubjectWithBLOBs subject1 = subjectService.getSubjectByID(id);//获取课题路径String oldPath = subject1.getFilepath();File oldFile = new File(oldPath);//如果文件存在则删除if (oldFile.exists()) {//删除成功if (oldFile.delete()) {} else {return Msg.fail();}}ServletContext servletContext = request.getSession().getServletContext();String uploadFileName = file.getOriginalFilename(); // 获取上传文件的原名uploadFileName = uploadFileName.substring(uploadFileName.lastIndexOf(File.separator) + 1);File path = new File(ResourceUtils.getURL("target").getPath());
//            String savePath = path.getAbsolutePath() + "\\classes\\static\\model\\" + teacher.getId();
//            String saveFileName = savePath + "\\" + uploadFileName;String savePath =path.getAbsolutePath() + File.separator+"classes+"+File.separator+"static"+File.separator+"model"+File.separator + teacher.getId();String saveFileName = savePath +File.separator + uploadFileName;File dirs = new File(savePath);//判断路径是否存在,如果不存在就创建一个if (!dirs.exists()) {dirs.mkdirs();}file.transferTo(new File(dirs, uploadFileName)); // 开始接受文件SubjectWithBLOBs project = subject1;project.setProjectname(projectName);project.setIdProjecttype(idProjecttype);project.setIdProjectsource(idProjectsource);project.setFilepath(saveFileName);project.setMarchspecialty(marchspecialty.trim());project.setTeachernames(teachernames);//修改后状态置 0project.setSelectFlag(0);project.setVerifyprojectFlag(0);project.setReleaseFlag(0);int i = subjectService.updateSubjectByid(project);return Msg.success();}}@GetMapping("/getSubjectById")@ResponseBodypublic Msg getss(Long id) {SubjectWithBLOBs subject = subjectService.getSubjectByID(id);System.out.println(subject);subject.setFilepath(subject.getFilepath().substring(subject.getFilepath().lastIndexOf("\\") + 1));String[] teachers = subject.getTeachernames().split("&");String teacher2 = "";if (teachers.length >= 2) {teacher2 = teachers[teachers.length - 1];}subject.setTeachernames(teacher2);return Msg.success().add("subject", subject);}//查看自己所在教研室的课题发布记录@GetMapping("/cxallProject")public String fun7(ModelMap modelMap, HttpSession httpSession) {Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");List<Project> projects = teacherService.selecSectionProject(teacher.getSectionName());for (int i = 0; i < projects.size(); i++) {if (projects.get(i).getVerifyprojectFlag() == 0) projects.get(i).setProjectZT("未审核");else if (projects.get(i).getVerifyprojectFlag() == 1) projects.get(i).setProjectZT("审核未通过");else projects.get(i).setProjectZT("审核通过");}modelMap.addAttribute("allproject", projects);return "teacher/graduation/section_xq/subjectinfoto";}
}

后台管理员控制层:

@Authority(roles = {Role.ADMIN, Role.SADMIN})
@Controller
@RequestMapping("/admin")
public class AdminController {private static final Logger LOGGER = LoggerFactory.getLogger(AdminController.class);@AutowiredAdminService adminService;@AutowiredAdminMapper adminMapper;@AutowiredCollegeService collegeService;@AutowiredSectionService sectionService;@AutowiredSpecialtyService specialtyService;@AutowiredClassService classService;@AutowiredTeacherService teacherService;@AutowiredStudentService studentService;@AutowiredSubjectService subjectService;@AutowiredExcelService excelService;@AutowiredSubjectRelationStudentMapper subjectRelationStudentMapper;@AutowiredHttpServletRequest request;@AutowiredHttpServletResponse response;@AutowiredHttpSession session;@ModelAttribute("id_institute")public long getRoleInfo() {User user = (User) request.getAttribute("user");
//        LOGGER.info("USER:{}",user);if (user != null) {if (user.getRole().equals("admin")) {Institute institute = collegeService.selectCollege(adminMapper.selectByPrimaryKey(user.getId()).getIdInstitute());return institute.getId();}if (user.getRole().equals("sadmin")) {return -1;}return 0;} else {return 0;}}//   admin index page   子管首页@GetMapping(value = {"", "/index"})public String index() {User user = (User) request.getAttribute("user");
//        LOGGER.info("index user:{}",user);//这部分还是用了session存储部分信息 后续可能修改//根据 user的id 判断 渲染页面if (user.getId() == -1) {LOGGER.info("超级管理员登录");session.setAttribute("instituteName", "超级管理员");session.setAttribute("ROLE", "sadmin");session.setAttribute("username", user.getUserName());return "admin/public-admin-index";}Institute institute = collegeService.selectCollege(adminMapper.selectByPrimaryKey(user.getId()).getIdInstitute());System.out.println(institute.getInstituteName());session.setAttribute("instituteName", institute.getInstituteName());session.setAttribute("ROLE", "admin");session.setAttribute("username", user.getUserName());return "admin/public-admin-index";}//    exit      退出登录@GetMapping("/exit")public String exit(HttpSession httpSession) {//将Cookie 中的token 置空Cookie cookie = new Cookie("token", null);cookie.setPath("/");response.addCookie(cookie);return "login";}
// login 在单独Controller//    updatePwd     更新密码@GetMapping("/updatePwd")public String updatePwd() {return "admin/updatePwd";}@PostMapping("/updatePwd")@ResponseBodypublic Msg updatePwd(@RequestBody Admin admin,HttpSession httpSession) {User user = (User) request.getAttribute("user");adminService.updatePwdByUserName(user.getUserName(),admin.getPwd());return Msg.success();}//    教研室@GetMapping("/SectionManagement")public String section() {return "admin/Department/SectionManagement";}@GetMapping("/sections")@ResponseBodypublic Msg getSections(@ModelAttribute("id_institute") long id_institute) {return Msg.success().add("sections", sectionService.getSections(id_institute));}@DeleteMapping("/section")@ResponseBodypublic Msg delSection(@RequestBody Section section) {return Msg.sqlChange((int) sectionService.delSection(section));}@PutMapping("/section")@ResponseBodypublic Msg updateSection(@RequestBody @Validated Section section, @ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) sectionService.updateSection(section, section.getSectionName(), id_institute));}@PostMapping("/section")@ResponseBodypublic Msg addSection(@RequestBody @Validated Section section, @ModelAttribute("id_institute") long id_institute) {return Msg.sqlChange((int) sectionService.addSection(section, id_institute));}//    专业方向@GetMapping("/SpecialtyManagement")public String specialty() {return "admin/Department/SpecialtyManagement";}@GetMapping("/specialtys")@ResponseBodypublic Msg getSpecialtys(@RequestParam Integer offset,@RequestParam(required = false) Long sectionId,@RequestParam(required = false) String keyWord,@ModelAttribute("id_institute") long id_institute) {long total = specialtyService.getSpecialtyCount(offset, keyWord, sectionId, id_institute);return Msg.success().add("specialtys", specialtyService.getSpecialtys(offset, keyWord, sectionId, id_institute)).add("total", total);}@ResponseBody@DeleteMapping("/specialty")public Msg delSpecialty(@RequestBody Specialty specialty,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) specialtyService.delSpecialty(specialty, id_institute));}@ResponseBody@PutMapping("/specialty")public Msg putSpecialty(@RequestBody @Validated({Update.class}) Specialty specialty,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) specialtyService.putSpecialty(specialty, id_institute));}@ResponseBody@PostMapping("/specialty")public Msg postSpecialty(@RequestBody @Validated({Add.class}) Specialty specialty,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) specialtyService.postSpecialty(specialty, id_institute));}//    班级@GetMapping("/ClassManagement")public String Class() {return "admin/Department/ClassManagement";
//    //获取管理员的 学院id
//    public static Long getIdInstitute(ModelMap modelMap) {
//        Subadmin subadmin = (Subadmin) modelMap.get("admin");
//        return subadmin.getIdInstitute();
//    }}@ResponseBody@GetMapping("/classes")public Msg getClasses(@RequestParam("offset") Integer offset,@RequestParam(required = false) Long specialtyId,@RequestParam(required = false) String keyWord,@ModelAttribute("id_institute") long id_institute) {long total = classService.getClassesCount(offset, keyWord, specialtyId, id_institute);return Msg.success().add("classes", classService.getClasses(offset, keyWord, specialtyId, id_institute)).add("total", total);}@ResponseBody@DeleteMapping("/class")public Msg delClass(@RequestBody MyClass myClass,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) classService.delClass(myClass, id_institute));}@ResponseBody@PutMapping("/class")public Msg putClass(@RequestBody @Validated({One.class}) MyClass myClass,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) classService.putClass(myClass, id_institute));}@ResponseBody@PostMapping("/class")public Msg postClass(@RequestBody @Validated({One.class}) MyClass myClass,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) classService.postClass(myClass, id_institute));}//    课题综合管理@GetMapping("/SourceManagement")public String source() {return "admin/Subject/SourceManagement";}@ResponseBody@GetMapping("/sources")public Msg getSources() {return Msg.success().add("sources", subjectService.selectSubjectSources());}@ResponseBody@PostMapping("/source")public Msg addSource(@RequestBody @Validated SubjectSource source) throws MyException {return Msg.sqlChange((int) subjectService.insertSubjectSource(source.getSourcename()));}@ResponseBody@DeleteMapping("/source")public Msg delSource(@RequestBody SubjectSource source) throws MyException {return Msg.sqlChange(subjectService.delSubjectSource(source.getId()));}@ResponseBody@PutMapping("/source")public Msg updateSource(@RequestBody @Validated SubjectSource source) {return Msg.sqlChange(subjectService.updateSubjectSource(source));}//课题类型@GetMapping("/TypeManagement")public String subjectType() {return "admin/Subject/TypeManagement";}@ResponseBody@GetMapping("/sujecttypes")public Msg getType() {return Msg.success().add("sujecttypes", subjectService.selectSubjectTypes());}@ResponseBody@PostMapping("/sujecttype")public Msg addType(@RequestBody @Validated SubjectType type) throws MyException {return Msg.sqlChange((int) subjectService.insertSubjectType(type.getTypename()));}@ResponseBody@DeleteMapping("/sujecttype")public Msg delType(@RequestBody SubjectType type) throws MyException {return Msg.sqlChange(subjectService.delSubjectType(type.getId()));}@ResponseBody@PutMapping("/sujecttype")public Msg updateType(@RequestBody @Validated SubjectType type) {return Msg.sqlChange(subjectService.updateSubjectType(type));}//课题管理@GetMapping("/SubjectManagement")public String Subject() {return "admin/Subject/SubjectManagement";}@ResponseBody@GetMapping("/subjects")public Msg getSubjects(@RequestParam Integer offset,@RequestParam(required = false) Long sectionId,@RequestParam(required = false) String keyWord,@ModelAttribute("id_institute") long id_institute) {long total = subjectService.selectSubjectsCount(offset, keyWord, sectionId, id_institute);return Msg.success().add("subjects", subjectService.selectSubjects(offset, keyWord, sectionId, id_institute)).add("total", total);}@ResponseBody@PostMapping("/subject")public Msg addSubject(@RequestBody @Validated(Add.class) SubjectWithBLOBs subject,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) subjectService.insertSubject(subject, id_institute));}@ResponseBody@DeleteMapping("/subject")public Msg delSubject(@RequestBody SubjectWithBLOBs subject,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange(subjectService.delSubject(subject, id_institute));}@ResponseBody@PutMapping("/subject")public Msg updateSubject(@RequestBody @Validated(Update.class) SubjectWithBLOBs subject,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange(subjectService.updateSuject(subject, id_institute));}//get学生选题的状态@GetMapping("/SRS")@ResponseBodypublic Msg getSelectSubjected(@ModelAttribute("id_institute") long id_institute) {System.out.println(subjectService.getSelectSubjected(null, id_institute));return Msg.success().add("SRS", subjectService.getSelectSubjected(null, id_institute));}//get 选某个课题的所有学生@GetMapping("/studentsBySubject")@ResponseBodypublic Msg getStuentBySubject(@RequestParam("id") Long id,@ModelAttribute("id_institute") long id_institute) {return subjectService.getStuentBySubject(id, id_institute);}//    教师管理 增删改查@GetMapping("/TeacherManagement")public String teacher() {return "admin/BasicInfo/TeacherManagement";}@ResponseBody@GetMapping("/teachers")public Msg getTeachers(@RequestParam Integer offset,@RequestParam(required = false) Long sectionId,@RequestParam(required = false) String keyWord,@ModelAttribute("id_institute") long id_institute) {long total = teacherService.selectTeachersCount(offset, keyWord, sectionId, id_institute);return Msg.success().add("teachers", teacherService.selectTeachers(offset, keyWord, sectionId, id_institute)).add("total", total);}@ResponseBody@DeleteMapping("/teacher")public Msg delTeacher(@RequestBody TeacherWithBLOBs teacher,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) teacherService.delTeacher(teacher, id_institute));}@ResponseBody@PostMapping("/teacher")public Msg addTeacher(@RequestBody @Validated(Add.class) TeacherWithBLOBs teacher,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) teacherService.addTeacher(teacher, id_institute));}@ResponseBody@PutMapping("/teacher")public Msg updateTeacher(@RequestBody @Validated({Update.class}) TeacherWithBLOBs teacher,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) teacherService.updateTeacher(teacher, id_institute));}//教师批量教师导入@PostMapping("/TeacherExcel")@ResponseBodypublic Msg addTeacherExcel(@RequestParam("excel") MultipartFile excelFile,@ModelAttribute("id_institute") long id_institute) throws MyException, IOException {return excelService.teacherExcelImport(excelFile, id_institute);}//教师批量导入模板@GetMapping("/TeacherExcelDemo")public void getTeacherExcelDemo(HttpServletResponse response) throws IOException {excelService.teacherExcelDownload(response);}//    学生管理@GetMapping("/StudentManagement")public String student() {return "admin/BasicInfo/StudentManagement";}@ResponseBody@GetMapping("/students")public Msg getStudents(@RequestParam Integer offset,@RequestParam(required = false) Long classId,@RequestParam(required = false) Long specialtyId,@RequestParam(required = false) String keyWord,@ModelAttribute("id_institute") long id_institute) throws MyException {long total = studentService.selectStudentsCount(offset, keyWord, classId, specialtyId, id_institute);return Msg.success().add("students", studentService.selectStudents(offset, keyWord, classId, specialtyId, id_institute)).add("total", total);}@ResponseBody@DeleteMapping("/student")public Msg delStudent(@RequestBody StudentWithBLOBs student,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) studentService.delStudent(student, id_institute));}@ResponseBody@PostMapping("/student")public Msg addStudent(@RequestBody @Validated(Add.class) StudentWithBLOBs student,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) studentService.addStudent(student, id_institute));}@ResponseBody@PutMapping("/student")public Msg updateStudent(@RequestBody @Validated({Update.class}) StudentWithBLOBs student,@ModelAttribute("id_institute") long id_institute) throws MyException {return Msg.sqlChange((int) studentService.updateStudent(student, id_institute));}//    批量导入模板@GetMapping("/StudentExcelDemo")public void getStudentExcelDemo(HttpServletResponse response) throws IOException {excelService.studentExcelDownload(response);}//批量学生导入@PostMapping("/StudentExcel")@ResponseBodypublic Msg addStudentExcel(@RequestParam("excel") MultipartFile excelFile,@ModelAttribute("id_institute") long id_institute) throws MyException, IOException {return excelService.studentExcelImport(excelFile, id_institute);}//    生成一览表//课题一览表@GetMapping("/SubjectExcel")public void getSubjectExcel(HttpServletResponse response,HttpServletRequest request,@ModelAttribute("id_institute") long id_institute) throws IOException {excelService.subjectExcelDownload(response, request, id_institute);}}

 源码获取:博客首页 "资源" 里下载!

相关文章:

mysql更改数据文件目录及my.ini位置| MySQL命令详解

需求&#xff1a;更改mysql数据数据文件目录及my.ini位置。 步骤&#xff1a; 1、查找my.ini位置&#xff0c;可通过windows服务所对应mysql启动项&#xff0c;查看其对应属性->可执行文件路径&#xff0c;获取my.ini路径。 "D:\MySQL\MySQL Server 5.5\bin\mysqld&quo…

私有云管理-Windows Azure Pack

今天是2014年的第一天&#xff0c;今年的第一篇博客关于私有云&#xff0c;而我在2014年的主要目标也是针对私有云。随着Windows Azure在中国的落地&#xff0c;大家逐渐的熟悉了在Windows Azure中的云体验。而微软针对私有云、混合云推出了一个管理自助门户&#xff0c;Window…

面向对象(类的概念,属性,方法,属性的声明,面向对象编程思维

1 面向对象 1.1 你是如何认识新事物的&#xff1f; 从过往的事物中总结事物的特点(特征)&#xff0c;并比对新事物&#xff0c;把新事物进行归类。 1.2 类(Class)的概念(A) 类是对一组具有相同特征和行为的对象的抽象描述。 理解: [1] 类包含了两个要素:特性和行为 > 同一类…

cannot find main module 解决办法

做6.824 实验的过程中想要跑测试&#xff0c;发现go test -run 2A时 出现cannot find main module问题&#xff0c;测试跑不起来。 原因 这个原因是从GO1.11 版本开始引入了go.mod文件来对项目中的go源码的编译相关的内容进行管理&#xff0c;经常使用GO的同学可能深受go get…

Java项目:网上选课系统(java+SSM+jsp+mysql+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能&#xff1a; 系统分为三个角色。最高权限管理员&#xff0c;学生&#xff0c;教师&#xff0c;包括 学生管理&#xff0c;教师管理&#xff0c;课程管理&#xff0c;选课&#xff0c;退课…

C#中类的继承 override virtual new的作用以及代码分析

继承中override virtual new的作用 virtual 父类中需要注明允许重写的方法&#xff1b; override 子类中必须显示声明该方法是重写的父类中的方法&#xff1b; new 子类中忽略父类的已存在的方法&#xff0c;“重写该方法“&#xff1b; C#中不支…

spring手动代码控制事务

为什么80%的码农都做不了架构师&#xff1f;>>> DataSourceTransactionManager tran new DataSourceTransactionManager(vjdbcTemplate.getDataSource());DefaultTransactionDefinition def new DefaultTransactionDefinition();//事务定义类def.setPropagationB…

tar命令-压缩,解压缩文件

tar&#xff1a; -c: 建立压缩档案 -x&#xff1a;解压 -t&#xff1a;查看内容 -r&#xff1a;向压缩归档文件末尾追加文件 -u&#xff1a;更新原压缩包中的文件 上面五个参数是独立的&#xff0c;压缩解压都要用到其中一个&#xff0c;可以和下面的命令连用但只能用其中一个。…

MIT 6.824 Lab2A (raft) -- Leader Election

文章目录实验要求Leader Election流程 及详细实现介绍基本角色关键超时变量关键的两个RPC实现RequestVote RPCAppendEntries RPCGo并发编程实现leader election调度本节记录的是完成MIT6.824 raft lab的leader Election部分实验。代码: https://github.com/BaronStack/MIT-6.82…

Java项目:在线考试系统(java+springboot+vue+jsp+mysql+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 本系统主要实现的功能有&#xff1a; 学生以及老师的注册登录&#xff0c;在线考试&#xff0c;错题查询&#xff0c;学生管理&#xff0c;问题管理&#xff0c;错题管理&#xff0c;错题查询…

写给自己的web开发资源

web开发给我的感觉就是乱七八糟&#xff0c;而且要学习感觉总是会有东西要学习&#xff0c;很乱很杂我也没空搞&#xff0c;&#xff08;其实学习这个的方法就是去用它&#xff0c;什么你直接用&#xff1f;学过js么学过jquery么&#xff1f;哈哈&#xff0c;我没有系统的看完过…

虚拟机VMWare“提示:软件虚拟化与此平台上的长模式不兼容”的解决方法

虚拟机VMWare“提示&#xff1a;软件虚拟化与此平台上的长模式不兼容”不少童鞋反映&#xff0c;在使用Windows7 64位操作系统时&#xff0c;无法运行VMWare或MS Virtual server等软件虚拟操作系统。提示为“提示&#xff1a;软件虚拟化与此平台上的长模式不兼容. 禁用长模式. …

如何在Vue项目中使用vw实现移动端适配(转)

有关于移动端的适配布局一直以来都是众说纷纭&#xff0c;对应的解决方案也是有很多种。在《使用Flexible实现手淘H5页面的终端适配》提出了Flexible的布局方案&#xff0c;随着viewport单位越来越受到众多浏览器的支持&#xff0c;因此在《再聊移动端页面的适配》一文中提出了…

Jsoncpp 在C++开发中的一些使用记录

jsoncpp 是一个C 语言实现的json库&#xff0c;非常方便得支持C得各种数据类型到json 以及 json到各种数据类型的转化。 一个json 类型的数据如下&#xff1a; {"code" : 10.01,"files" : "","msg" : "","uploadid&q…

Java项目:图书管理系统(java+SSM+jsp+mysql+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能包括(管理员和学生角色)&#xff1a; 管理员和学生登录&#xff0c;图书管理&#xff0c;图书添加删除修改&#xff0c;图书 借阅&#xff0c;图书归还&#xff0c;图书查看&#xff0c;学…

使用 Flash Builder 的 Apple iOS 开发过程

使用 Flash Builder 的 Apple iOS 开发过程 iOS 开发和部署过程概述 构建、调试或部署 iOS 应用程序前的准备工作 在测试、调试或安装 iOS 应用程序时选择的文件 将应用程序部署到 Apple App Store 时选择的文件 在使用 Flash Builder 开发 iOS 应用程序之前&#xff0c;必须…

grep之字符串搜索算法Boyer-Moore由浅入深(比KMP快3-5倍)

2019独角兽企业重金招聘Python工程师标准>>> 1. 简单介绍 在用于查找子字符串的算法当中&#xff0c;BM&#xff08;Boyer-Moore&#xff09;算法是目前被认为最高效的字符串搜索算法&#xff0c;它由Bob Boyer和J Strother Moore设计于1977年。 一般情况下&#xf…

多线程threading

threading用于提供线程相关的操作&#xff0c;线程是应用程序中工作的最小单元。python当前版本的多线程库没有实现优先级、线程组&#xff0c;线程也不能被停止、暂停、恢复、中断。 1. threading模块提供的类&#xff1a; Thread, Lock, Rlock, Condition, [Bounded]Sem…

一个简单的程序来使用WiredTiger 存储引擎

前言 WiredTiger 自 mongodb3.0 集成进来之后为mongodb拉回了大量的口碑&#xff0c;从而在mongodb-3.2 版本直接代替了in-memory存储引擎&#xff0c;作为了mongodb的默认存储引擎。其 通过支持Append-only btree lsm-tree 以及 针对磁盘/内存数据结构上的多核和无锁优化&am…

Java项目:网上商城系统(java+SSM+jsp+mysql+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述功能 javaweb 网上商城系统&#xff0c;前台&#xff0b;后台管理&#xff0c;用户注册&#xff0c;登录&#xff0c;上哦展示&#xff0c;分组展示&#xff0c;搜索&#xff0c;收货地址管理&…

Linux 启动详解之init

1.init初探 init是Linux系统操作中不可缺少的程序之一。init进程&#xff0c;它是一个由内核启动的用户级进程&#xff0c;然后由它来启动后面的任务&#xff0c;包括多用户环境&#xff0c;网络等。 内核会在过去曾使用过init的几个地方查找它&#xff0c;它的正确位置&#x…

mysql 相关命令

mysqladmin versionmysqladmin statusmysqlshow -u帐号 -p密码 mysqlshow -u帐号 -p密码 库名mysql -u帐号 -p密码 -e SELECT Host,Db,User From db mysqlmysqldump --quick mysql | gzip > /root/mysql.gzmysqladmin create dbtestgunzip < /root/mysql.gz | mysql…

maven 添加数据库驱动

1.电脑上需要安装 apache maven2.下载oracle的jar包 例如我下载的是ojdbc7-12.jar3.cmd执行命令 mvn install:install-file -DgroupIdcom.oracle -DartifactIdojdbc7 -Dversion12 -Dpackagingjar -Dfiled:\jar\ojdbc7-12.jar-Dfile jar包所存放的位置4.pom文件添加&#xff1…

Rocksdb 的 BlobDB key-value 分离存储插件

前言 还是回到传统的 LSM-tree 中&#xff0c;我们key-value 写入时以append形态存放到一个data-block中&#xff0c;多个data-blockmetablock 之类的数据组织成一个sst。当我们读数据以及compaction的时候读到key 之后则很方便得读取到对应的value&#xff0c;一次I/O能够将k…

Java项目:(前端vue后台java微服务)在线考试系统(java+vue+springboot+mysql+maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 考试流程&#xff1a; 用户前台注册成为学生 管理员后台添加老师&#xff0c;系统将该用户角色上升为老师 老师登录&#xff0c;添加考试,添加题目&#xff0c;发布考试 考生登录前台参加考试&#xff0c…

C++实现stack【栈】

要求&#xff1a; //****file: stack.h/*对stack进行初始化检查stack为空&#xff0c;或已满将整数压入到stack中从stack里弹出整数 不移除任何袁术&#xff0c;讲过stack的内容输出到标准输出Stack类的私有成员如下&#xff1a;一个用于打印错误信息的私有哦成员函数三个私有数…

c#操作Excel整理总结

大家好&#xff0c;这是我在工作中总结的关于C#操作Excel的帮助类&#xff0c;欢迎大家批评指正&#xff01; using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.IO; using Aspose.Cells;namespace MusicgrabTool {p…

C++ std::function<void(int)> 和 std::function<void()> 作为函数参数的注意事项

前言 std::function 作为标准库提供的函数指针&#xff0c;使用起来还是比较方便的&#xff0c;不过在使用过程中有一些需要注意的细节&#xff0c;这里做一个简单的记录。 基本使用 头文件: #include <functional>语法&#xff1a;std::function<return_type(args…

Java项目:网上电商系统(java+SSM+mysql+maven+tomcat)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能&#xff1a;本系统分用户前台和管理员后台。 前台展示后台管理&#xff0c;前台界面可实现用户登录&#xff0c;用户注 册&#xff0c;商品展示&#xff0c;商品明细展示&#xff0c;用户…

C# SQLiteHelper

1 public class SQLiteHelpers2 {3 /// <summary> 4 /// ConnectionString样例&#xff1a;DatasourceTest.db3;Poolingtrue;FailIfMissingfalse 5 /// </summary> 6 public static string ConnectionStri…