• 大小: 435KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-01
  • 语言: 数据库
  • 标签: mybatis  

资源简介

spring+springmvc+mybastis+mysql的学生成绩管理页面,可实现学生信息和成绩的增删查改

资源截图

代码片段和文件信息

package com.zhouxiaobo.mvc.controller;

import com.zhouxiaobo.mvc.model.Exam;
import com.zhouxiaobo.mvc.model.Student;
import com.zhouxiaobo.mvc.model.StudentScore;
import com.zhouxiaobo.mvc.model.Subject;
import com.zhouxiaobo.mvc.model.page.StudentScorePage;
import com.zhouxiaobo.mvc.pagination.Page;
import com.zhouxiaobo.mvc.service.StudentScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping(“/“)
public class ScoreController {

@Autowired
protected StudentScoreService studentScoreService;


private void initdrowdown(Model model){
List subjects = studentScoreService.listAllSubject();
List students = studentScoreService.listAllStudent();
List exams = studentScoreService.listAllExam();
model.addAttribute(“dropdownSubject“ subjects);
model.addAttribute(“dropdownStudent“ students);
model.addAttribute(“dropdownExam“ exams);
}

@RequestMapping(method = RequestMethod.GET)
public String printWelcome(Model model) {
initdrowdown(model);
return “scores“;
}

@RequestMapping(value = “/rest/getStudent/{id}“ method = RequestMethod.POST)
@ResponseBody
public Student getStudent(@PathVariable String id){
Student st = studentScoreService.getStudent(Integer.parseInt(id));
return st;
}

@RequestMapping(value = “/rest/updateScore“ method = RequestMethod.POST)
@ResponseBody
public Map updateScore(@RequestBody StudentScore studentScore){
Map result = new HashMap();
try{
studentScoreService.updateScore(studentScore);
result.put(“flag““success“);
}catch(Exception e){
result.put(“flag““fail“);
}
return result;
}

@RequestMapping(value = “/listscore“ method = RequestMethod.POST)
public String queryStudent(Model model@ModelAttribute StudentScorePage studentScorePage){
initdrowdown(model);

List scores = studentScoreService.listStudentScore(studentScorePage);
model.addAttribute(“scores“scores);
model.addAttribute(“queryCondition“studentScorePage);
return “scores“;
}

@RequestMapping(value = “/delscore/{delId}“)
public String delScore(Model model@PathVariable String delId@ModelAttribute StudentScorePage studentScorePage){
studentScoreService.deleteScore(Integer.parseInt(delId));
queryStudent(model studentScorePage);
return “scores“;
}

@RequestMapping(value = “/insertscore“method = RequestMethod.POST)
public String insertScore(Model model@ModelAttribute StudentScore insertScore){

studentScoreService.insertScore(insertScore);
StudentScorePage studentScorePage = new StudentScorePage();
if(insertScore != null && insertScore.getStudent() != null){
Student st = studentScoreService.getStudent(insertScore.getStudent

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6148  2015-09-09 21:52  scoredemo\trunk\.DS_Store

     文件          6  2015-11-27 09:53  scoredemo\trunk\.idea\.name

     文件        277  2015-11-27 09:53  scoredemo\trunk\.idea\artifacts\mydemo_war.xml

     文件       4330  2015-11-27 09:53  scoredemo\trunk\.idea\artifacts\mydemo_war_exploded.xml

     文件       1174  2015-11-27 09:53  scoredemo\trunk\.idea\compiler.xml

     文件         74  2015-11-27 09:53  scoredemo\trunk\.idea\copyright\profiles_settings.xml

     文件        502  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__aopalliance_aopalliance_1_0.xml

     文件        556  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__ch_qos_logback_logback_classic_1_1_1.xml

     文件        535  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__ch_qos_logback_logback_core_1_1_1.xml

     文件        560  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__commons_logging_commons_logging_1_1_3.xml

     文件        632  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_annotations_2_3_0.xml

     文件        583  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_core_2_3_1.xml

     文件        611  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_databind_2_3_1.xml

     文件        724  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_3_1.xml

     文件        529  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__com_googlecode_log4jdbc_log4jdbc_1_2.xml

     文件        503  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__com_google_code_gson_gson_2_3_1.xml

     文件        566  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__javax_servlet_javax_servlet_api_3_0_1.xml

     文件        461  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__javax_servlet_jstl_1_2.xml

     文件        443  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__junit_junit_4_11.xml

     文件        562  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__mysql_mysql_connector_java_5_1_20.xml

     文件        499  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__opensymphony_sitemesh_2_4_2.xml

     文件        558  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_apache_commons_commons_lang3_3_2_1.xml

     文件        547  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_apache_tomcat_tomcat_jdbc_7_0_52.xml

     文件        547  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_apache_tomcat_tomcat_juli_7_0_52.xml

     文件        502  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_aspectj_aspectjrt_1_7_4.xml

     文件        530  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_aspectj_aspectjweaver_1_7_4.xml

     文件        587  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_codehaus_jackson_jackson_core_asl_1_9_4.xml

     文件        601  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_codehaus_jackson_jackson_mapper_asl_1_9_4.xml

     文件        520  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_hamcrest_hamcrest_core_1_3.xml

     文件        488  2015-11-27 09:53  scoredemo\trunk\.idea\libraries\Maven__org_mybatis_mybatis_3_2_8.xml

............此处省略138个文件信息

评论

共有 条评论