作者:计算机学长阿伟
开发技术:SpringBoot、SSM、Vue、MySQL、ElementUI等,“文末源码”。
开发运行环境
- 开发语言:Java
- 数据库:MySQL
- 技术:SpringBoot、Vue、Mybaits Plus、ELementUI
- 工具:IDEA/Ecilpse、Navicat、Maven
源码下载地址:
Java项目-基于springboot框架的学习选课系统项目实战(附源码+文档)资源-CSDN文库
一、项目简介
学生选课系统是一个面向学生和教师的在线选课平台,其设计简洁明了,便于用户快速上手。系统以绿色和白色为主色调,营造出清新舒适的视觉体验。在页面顶部,系统标题清晰明了,导航栏则提供了多个功能选项卡,如“个人信息”、“课程管理”等,用户可以通过点击这些选项卡来访问相应的功能区域。整个系统提供了包括修改密码、学生管理、教师管理、课程信息管理、选课信息管理、作业信息管理以及学生成绩管理等一系列实用功能,全面满足用户在使用过程中的各种需求。
二、系统项目部分截图
2.1后台系统部分页面效果
三、部分核心代码
package com.controller;import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;import com.entity.JiaoshiEntity;
import com.entity.view.JiaoshiView;import com.service.JiaoshiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;/*** 教师* 后端接口*/
@RestController
@RequestMapping("/jiaoshi")
public class JiaoshiController {@Autowiredprivate JiaoshiService jiaoshiService;@Autowiredprivate TokenService tokenService;/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {JiaoshiEntity user = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("gonghao", username));if(user==null || !user.getMima().equals(password)) {return R.error("账号或密码不正确");}String token = tokenService.generateToken(user.getId(), username,"jiaoshi", "教师" );return R.ok().put("token", token);}/*** 注册*/@IgnoreAuth@RequestMapping("/register")public R register(@RequestBody JiaoshiEntity jiaoshi){//ValidatorUtils.validateEntity(jiaoshi);JiaoshiEntity user = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("gonghao", jiaoshi.getGonghao()));if(user!=null) {return R.error("注册用户已存在");}Long uId = new Date().getTime();jiaoshi.setId(uId);jiaoshiService.insert(jiaoshi);return R.ok();}/*** 退出*/@RequestMapping("/logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrUser(HttpServletRequest request){Long id = (Long)request.getSession().getAttribute("userId");JiaoshiEntity user = jiaoshiService.selectById(id);return R.ok().put("data", user);}/*** 密码重置*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request){JiaoshiEntity user = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("gonghao", username));if(user==null) {return R.error("账号不存在");}user.setMima("123456");jiaoshiService.updateById(user);return R.ok("密码已重置为:123456");}/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,JiaoshiEntity jiaoshi,HttpServletRequest request){EntityWrapper<JiaoshiEntity> ew = new EntityWrapper<JiaoshiEntity>();PageUtils page = jiaoshiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiaoshi), params), params));return R.ok().put("data", page);}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,JiaoshiEntity jiaoshi, HttpServletRequest request){EntityWrapper<JiaoshiEntity> ew = new EntityWrapper<JiaoshiEntity>();PageUtils page = jiaoshiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiaoshi), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( JiaoshiEntity jiaoshi){EntityWrapper<JiaoshiEntity> ew = new EntityWrapper<JiaoshiEntity>();ew.allEq(MPUtil.allEQMapPre( jiaoshi, "jiaoshi")); return R.ok().put("data", jiaoshiService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(JiaoshiEntity jiaoshi){EntityWrapper< JiaoshiEntity> ew = new EntityWrapper< JiaoshiEntity>();ew.allEq(MPUtil.allEQMapPre( jiaoshi, "jiaoshi")); JiaoshiView jiaoshiView = jiaoshiService.selectView(ew);return R.ok("查询教师成功").put("data", jiaoshiView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);return R.ok().put("data", jiaoshi);}/*** 前端详情*/@IgnoreAuth@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);return R.ok().put("data", jiaoshi);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request){jiaoshi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(jiaoshi);JiaoshiEntity user = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("gonghao", jiaoshi.getGonghao()));if(user!=null) {return R.error("用户已存在");}jiaoshi.setId(new Date().getTime());jiaoshiService.insert(jiaoshi);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request){jiaoshi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(jiaoshi);JiaoshiEntity user = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("gonghao", jiaoshi.getGonghao()));if(user!=null) {return R.error("用户已存在");}jiaoshi.setId(new Date().getTime());jiaoshiService.insert(jiaoshi);return R.ok();}/*** 修改*/@RequestMapping("/update")@Transactionalpublic R update(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request){//ValidatorUtils.validateEntity(jiaoshi);jiaoshiService.updateById(jiaoshi);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){jiaoshiService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 提醒接口*/@RequestMapping("/remind/{columnName}/{type}")public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) {map.put("column", columnName);map.put("type", type);if(type.equals("2")) {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");Calendar c = Calendar.getInstance();Date remindStartDate = null;Date remindEndDate = null;if(map.get("remindstart")!=null) {Integer remindStart = Integer.parseInt(map.get("remindstart").toString());c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindStart);remindStartDate = c.getTime();map.put("remindstart", sdf.format(remindStartDate));}if(map.get("remindend")!=null) {Integer remindEnd = Integer.parseInt(map.get("remindend").toString());c.setTime(new Date());c.add(Calendar.DAY_OF_MONTH,remindEnd);remindEndDate = c.getTime();map.put("remindend", sdf.format(remindEndDate));}}Wrapper<JiaoshiEntity> wrapper = new EntityWrapper<JiaoshiEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}int count = jiaoshiService.selectCount(wrapper);return R.ok().put("count", count);}}
获取源码或文档
如需对应的论文或文档,以及其他定制需求,也可以下方添加联系我。