基于javaweb+mysql的ssm+maven学生管理系统(java+ssm+js+jsp+mysql)

基于javaweb+mysql的ssm+maven学生管理系统(java+ssm+js+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM+Maven学生管理系统(java+ssm+js+jsp+mysql)

项目介绍

管理员操作包含以下功能: 管理员登录,学生管理,成绩管理,教师信息管理,课程信息管理,学院管理,专业管理,班级信息管理,用户管理等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
    @ResponseBody
    public JSONArray getMajorList(String departmentKey) {
        List<Map<String, Object>> list = studentService.getMajorList(departmentKey);
        if (list.size() > 0) {
            JSONArray jsonArray = JSONArray.fromObject(list);
            return jsonArray;
        }
        return null;
    }

    /**
     * 获取班级列表Controller
     */
    @RequestMapping(value = "/getClassList", method = RequestMethod.POST)
    @ResponseBody
    public JSONArray getClassList(String majorKey) {
        List<Map<String, Object>> list = studentService.getClassList(majorKey);
        if (list.size() > 0) {
            JSONArray jsonArray = JSONArray.fromObject(list);
            return jsonArray;
        }
        return null;
    }

    /**
     * 获取学生列表Controller
     */
    @RequestMapping(value = "/getStudentList", method = RequestMethod.POST)
    @ResponseBody
    public JSONArray getStudentList(String classKey) {
        List<Map<String, Object>> list = studentService.getStudentList(classKey);
        if (list.size() > 0) {
            JSONArray jsonArray = JSONArray.fromObject(list);
            return jsonArray;
        }
        return null;
    }

    /**
     * 添加学生信息
        if (list.size() > 0) {
            JSONArray jsonArray = JSONArray.fromObject(list);
            return jsonArray;
        }
        return null;
    }

}

/**
 * 列表查询工具类
 *
 * @ClassName DataGridUtil
 **/
public class DataGridUtil {

    @Resource
    private BaseMapper baseMapper;
    @Resource
    private CommonService service;

    public void selectDataGrid(HttpServletResponse response, Map<String, Object> dataMap) throws Exception {
        String page = (dataMap.get("page") == null ? 1 : dataMap.get("page")) + "";//起始页
        String rows = (dataMap.get("rows") == null ? 10 : dataMap.get("rows")) + "";//每页条数
        String table = dataMap.get("table") + "";//表名
        String where = dataMap.get("where") + "";
        PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
        Map<String, Object> map = new HashMap<>();
        map.put("start", pageBean.getStart());
        map.put("size", pageBean.getPageSize());
     * @throws Exception
     */
    @RequestMapping(value = "/delete/{pkids}", method = RequestMethod.DELETE)
    @ResponseBody
    public Result delete(@PathVariable(value = "pkids") String pkids) throws Exception {
        String[] pkidArr = pkids.split(",");
        courseService.delete(pkidArr);
        return ResultGenerator.genSuccessResult();
    }

    /**
     * 删除班级信息
     *
     * @param pkids
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteClass/{pkids}", method = RequestMethod.DELETE)
    @ResponseBody
    public Result deleteClass(@PathVariable(value = "pkids") String pkids) throws Exception {
        String[] pkidArr = pkids.split(",");
        courseService.delete(pkidArr);
        return ResultGenerator.genSuccessResult();
    }

}

/**
 * 教师信息管理Controller类
 */
@Controller
@RequestMapping("/teacher")
public class TeacherController {

/**Ø
 * 教师信息管理Controller类
 */
@Controller
@RequestMapping("/baseData")
public class BaseDataController {

    @Resource
    private BaseDataService baseDataService;

    /**
     * 添加学院信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addDepartment", method = RequestMethod.POST)
    @ResponseBody
    public Result addDepartment(@RequestBody Department department) throws Exception {
        int resultTotal;
        resultTotal = baseDataService.addDepartment(department);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改学院信息
     *
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addSave", method = RequestMethod.POST)
    @ResponseBody
    public Result addSave(@RequestBody Course course) throws Exception {
        int resultTotal;
        resultTotal = courseService.addCourse(course);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改课程信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "updateSave", method = RequestMethod.POST)
    @ResponseBody
    public Result updateSave(@RequestBody Course course) throws Exception {
        int resultTotal;
        resultTotal = courseService.updateCourse(course);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 获取课程列表Controller
     */
    @RequestMapping(value = "/getCourseList", method = RequestMethod.POST)
    @ResponseBody
    public JSONArray getCourseList(String classKey) {
        List<Map<String, Object>> list = courseService.getCourseList(classKey);
        if (list.size() > 0) {
            JSONArray jsonArray = JSONArray.fromObject(list);
            return jsonArray;
        }
        return null;
    }

    /**
     * 删除
     *
     * @param pkids
     * @return
        baseDataService.deleteMajor(pkidArr);
        return ResultGenerator.genSuccessResult();
    }

    /**
     * 添加班级信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addClass", method = RequestMethod.POST)
    @ResponseBody
    public Result addClass(@RequestBody Class cls) throws Exception {
        int resultTotal;
        resultTotal = baseDataService.addClass(cls);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改班级信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "updateClass", method = RequestMethod.POST)
    @ResponseBody
    public Result updateClass(@RequestBody Class cls) throws Exception {
        int resultTotal;
        resultTotal = baseDataService.updateClass(cls);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 删除班级信息
        return ResultGenerator.genSuccessResult();
    }

    /**
     * 添加学生成绩
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addScore", method = RequestMethod.POST)
    @ResponseBody
    public Result addScore(@RequestBody Score score) throws Exception {
        int resultTotal;
        resultTotal = scoreService.addScore(score);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改学生成绩
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "updateScore", method = RequestMethod.POST)
    @ResponseBody
    public Result updateScore(@RequestBody Score score) throws Exception {
        int resultTotal;
        resultTotal = scoreService.updateScore(score);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 删除
     *
     * @param pkids
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteScore/{pkids}", method = RequestMethod.DELETE)
     */
    @RequestMapping(value = "/deleteDepartment/{pkids}", method = RequestMethod.DELETE)
    @ResponseBody
    public Result deleteDepartment(@PathVariable(value = "pkids") String pkids) throws Exception {
        String[] pkidArr = pkids.split(",");
        baseDataService.deleteDepartment(pkidArr);
        return ResultGenerator.genSuccessResult();
    }

    /**
     * 添加专业信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addMajor", method = RequestMethod.POST)
    @ResponseBody
    public Result addMajor(@RequestBody Major major) throws Exception {
        int resultTotal;
        resultTotal = baseDataService.addMajor(major);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改专业信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "updateMajor", method = RequestMethod.POST)
    @ResponseBody
    public Result updateMajor(@RequestBody Major major) throws Exception {
        int resultTotal;
        resultTotal = baseDataService.updateMajor(major);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改学生信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "updateSave", method = RequestMethod.POST)
    @ResponseBody
    public Result updateSave(@RequestBody Student student) throws Exception {
        int resultTotal;
        resultTotal = studentService.updateStudent(student);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 删除
     *
     * @param pkids
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/delete/{pkids}", method = RequestMethod.DELETE)
    @ResponseBody
    public Result delete(@PathVariable(value = "pkids") String pkids) throws Exception {
        String[] pkidArr = pkids.split(",");
        studentService.deleteStudent(pkidArr);
        return ResultGenerator.genSuccessResult();
    }

    /**
     * 添加学生成绩
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addScore", method = RequestMethod.POST)
}

/*
  * @Description 用户管理Controller类
  */
@Controller
@RequestMapping("/users")
public class UserController {

    @Resource
    private UserService userService;
    private static final Logger log = Logger.getLogger(UserController.class);// 日志文件

    /*
      * @Description 登录
      * @param [user]
      * @return com.wq.common.Result
      * @throws
      */
    @RequestMapping(value = "/cookie", method = RequestMethod.POST)
    @ResponseBody
    public Result login(User user) {
        try {
            String MD5pwd = MD5Util.MD5Encode(user.getPassword(), "UTF-8");
            user.setPassword(MD5pwd);
        } catch (Exception e) {
		if (resultTotal > 0) {
			return ResultGenerator.genSuccessResult();
		} else {
			return ResultGenerator.genFailResult("FAIL");
		}
	}

}

/*
  * @Description 用户管理Controller类
  */
@Controller
@RequestMapping("/users")
public class UserController {

    @Resource
    private UserService userService;
    private static final Logger log = Logger.getLogger(UserController.class);// 日志文件

    /*
      * @Description 登录
      * @param [user]
      * @return com.wq.common.Result
      * @throws
      */
    @RequestMapping(value = "/cookie", method = RequestMethod.POST)
    @ResponseBody
    public Result login(User user) {
        try {
            String MD5pwd = MD5Util.MD5Encode(user.getPassword(), "UTF-8");
            user.setPassword(MD5pwd);
        } catch (Exception e) {
            user.setPassword("");
    @ResponseBody
    public Result save(@RequestBody User user) throws Exception {
        int resultTotal;
        String MD5pwd = MD5Util.MD5Encode(user.getPassword(), "UTF-8");
        user.setPassword(MD5pwd);
        resultTotal = userService.addUser(user);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /*
      * @Description 修改用户
      * @param [user]
      * @return com.wq.common.Result
      * @throws
      */
    @RequestMapping(value = "updateSave", method = RequestMethod.POST)
    @ResponseBody
    public Result update(@RequestBody User user) throws Exception {
        String MD5pwd = MD5Util.MD5Encode(user.getPassword(), "UTF-8");
        user.setPassword(MD5pwd);
        int resultTotal = userService.updateUser(user);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /*
      * @Description 删除用户
      * @param [ids]
      * @return com.wq.common.Result
      * @throws
      */
    @RequestMapping(value = "/delete/{pkids}", method = RequestMethod.DELETE)
    @ResponseBody

}

/*
  * @Description 用户管理Controller类
  */
@Controller
@RequestMapping("/users")
public class UserController {

    @Resource
    private UserService userService;
    private static final Logger log = Logger.getLogger(UserController.class);// 日志文件

    /*
      * @Description 登录
      * @param [user]
      * @return com.wq.common.Result
      * @throws
      */
    @RequestMapping(value = "/cookie", method = RequestMethod.POST)
    @ResponseBody
    public Result login(User user) {
        try {
	@RequestMapping(value = "addSave", method = RequestMethod.POST)
	@ResponseBody
	public Result save(@RequestBody Map<String, Object> dataMap) throws Exception {
		int resultTotal = 0;
		if (resultTotal > 0) {
			return ResultGenerator.genSuccessResult();
		} else {
			return ResultGenerator.genFailResult("FAIL");
		}
	}

}

/*
  * @Description 用户管理Controller类
  */
@Controller
@RequestMapping("/users")
public class UserController {

    @Resource
    private UserService userService;
    private static final Logger log = Logger.getLogger(UserController.class);// 日志文件

    /*
      * @Description 登录
      * @param [user]
      * @return com.wq.common.Result
      * @throws
    }

    /**
     * 删除专业信息
     *
     * @param pkids
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteMajor/{pkids}", method = RequestMethod.DELETE)
    @ResponseBody
    public Result deleteMajor(@PathVariable(value = "pkids") String pkids) throws Exception {
        String[] pkidArr = pkids.split(",");
        baseDataService.deleteMajor(pkidArr);
        return ResultGenerator.genSuccessResult();
    }

    /**
     * 添加班级信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addClass", method = RequestMethod.POST)
    @ResponseBody
    public Result addClass(@RequestBody Class cls) throws Exception {
        int resultTotal;
        resultTotal = baseDataService.addClass(cls);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改班级信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "updateClass", method = RequestMethod.POST)
    @ResponseBody
    public Result updateClass(@RequestBody Class cls) throws Exception {
        int resultTotal;
        resultTotal = baseDataService.updateClass(cls);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 删除
     *
     * @param pkids
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/delete/{pkids}", method = RequestMethod.DELETE)
    @ResponseBody
    public Result delete(@PathVariable(value = "pkids") String pkids) throws Exception {
        String[] pkidArr = pkids.split(",");
        studentService.deleteStudent(pkidArr);
        return ResultGenerator.genSuccessResult();
    }

    /**
     * 添加学生成绩
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addScore", method = RequestMethod.POST)
    @ResponseBody
    public Result addScore(@RequestBody Score score) throws Exception {
        int resultTotal;
        resultTotal = scoreService.addScore(score);
        if (resultTotal > 0) {
            return ResultGenerator.genSuccessResult();
        } else {
            return ResultGenerator.genFailResult("FAIL");
        }
    }

    /**
     * 修改学生成绩
     *
     * @return
 **/
public class DataGridUtil {

    @Resource
    private BaseMapper baseMapper;
    @Resource
    private CommonService service;

    public void selectDataGrid(HttpServletResponse response, Map<String, Object> dataMap) throws Exception {
        String page = (dataMap.get("page") == null ? 1 : dataMap.get("page")) + "";//起始页
        String rows = (dataMap.get("rows") == null ? 10 : dataMap.get("rows")) + "";//每页条数
        String table = dataMap.get("table") + "";//表名
        String where = dataMap.get("where") + "";
        PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
        Map<String, Object> map = new HashMap<>();
        map.put("start", pageBean.getStart());
        map.put("size", pageBean.getPageSize());
        map.put("table", table);
        map.put("where", where);
        List<Map<String, Object>> list = baseMapper.findGridData(map);
        Long total = baseMapper.getGridTotal(map);
        JSONObject result = new JSONObject();
        JSONArray jsonArray = JSONArray.fromObject(list);
        result.put("rows", jsonArray);
        result.put("total", total);
        ResponseUtil.write(response, result);
    }

    /**
      * @Description 公共新增方法
      * @param [dataMap]
      * @return int
      * @throws
      */
    public int addSave(Map<String, Object> dataMap) {
        return service.addSave(dataMap);
    }
}

/**
 */
@Controller
@RequestMapping("/common")
public class CommonController {

	@Autowired
	private DataGridUtil dataGridUtil;
	private static final Logger log = Logger.getLogger(CommonController.class);// 日志文件

	/**
	 * @param page
	 * @param rows
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/dataGrid", method = RequestMethod.POST)
	public String list(@RequestParam(value = "page", required = false) String page, @RequestParam(value = "rows", required = false) String rows,
			@RequestParam(value = "table") String table,
			HttpServletResponse response,
			@RequestParam(value = "xm",required = false) String xm,
			@RequestParam(value = "teacherName",required = false) String teacherName,
			@RequestParam(value = "courseName",required = false) String courseName,
			@RequestParam(value = "majorName",required = false) String majorName,
			@RequestParam(value = "department_name",required = false) String department_name,
			@RequestParam(value = "className",required = false) String className,
			@RequestParam(value = "user_name",required = false) String user_name
			
			) throws Exception {
		boolean flag = false;
		Map<String, Object> map = new HashMap<>();
		if(xm == null) {
			map.put("where", "where 1 = 1");
		}else if(xm != null){
			flag = true;
			map.put("where", "where xm like '%"+xm+"%'");
		}
		if(teacherName == null&&flag == false) {
			map.put("where", "where 1 = 1");
		}else if(teacherName != null){
			flag = true;
			map.put("where", "where teacherName like '%"+teacherName+"%'");
		}

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
springmvc是一种基于Spring框架的MVC(Model View Controller)开发模式的Web开发框架。它能够帮助开发者更好地管理请求和响应,让开发过程更加简洁和灵活。MyBatis是一个优秀的持久层框架,可以与Spring相结合进行数据库操作。它能够通过注解或XML配置文件实现数据库的增删改查操作,使开发者能够高效地操作数据库。电商项目是一种在线购物平台,用户可以浏览商品信息、下单购买、查看订单等。Java商城源码是这种电商项目的实现代码,通过使用SpringMVC和MyBatis,能够快速搭建一个完整的电商网站。 SSM框架是指Spring+SpringMVC+MyBatis的组合,是一种常用的JavaWeb开发框架。Spring是一个轻量级的开源框架,提供了很多实用的功能,包括IOC(控制反转)和AOP(面向切面编程)等。SpringMVC是基于Spring的MVC框架,可以实现请求的分发和处理。MyBatis是一个持久层框架,可以与SpringMVC结合使用,完成数据库的操作。Maven是一种软件项目管理工具,可以自动下载和配置项目所需的第三方库和工具。 对于这个电商项目的Java商城源码,使用SSM框架和Maven进行开发是一个不错的选择。首先,可以使用Maven来管理项目所需的依赖库,避免手动下载和配置的繁琐过程。其次,使用Spring来提供IOC容器和AOP功能,可以简化开发过程,并且使代码更加易于维护。然后,使用SpringMVC来处理请求和响应,实现网站的跳转和业务逻辑的处理。最后,使用MyBatis来完成与数据库的交互,实现商品信息的增删改查等功能。 综上所述,使用SSM框架和Maven进行开发的电商项目Java商城源码,能够快速搭建一个完整的电商网站,实现商品的展示、购买和订单的管理等功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值