🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
目录
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
12张
idea、navicat
学生、教师、管理员

-
- CREATE TABLE `chengji` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `chengji_name` varchar(200) DEFAULT NULL COMMENT '成绩标题 Search111',
- `chengji_types` int(11) DEFAULT NULL COMMENT '成绩类型 Search111',
- `xuenfen_number` int(11) DEFAULT NULL COMMENT '成绩',
- `chengji_content` text COMMENT '备注',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '学生',
- `chengji_delete` int(11) DEFAULT '1' COMMENT '假删',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='学生成绩';
-
-
-
- CREATE TABLE `config` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `name` varchar(100) DEFAULT NULL COMMENT '配置参数名称',
- `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='配置文件';
-
-
- CREATE TABLE `dictionary` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
- `dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
- `code_index` int(11) DEFAULT NULL COMMENT '编码',
- `index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',
- `super_id` int(11) DEFAULT NULL COMMENT '父字段id',
- `beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='字典';
-
-
-
- CREATE TABLE `jiaoshi` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `jiaoshi_uuid_number` varchar(200) DEFAULT NULL COMMENT '工号 ',
- `username` varchar(200) DEFAULT NULL COMMENT '账户',
- `password` varchar(200) DEFAULT NULL COMMENT '密码',
- `jiaoshi_name` varchar(200) DEFAULT NULL COMMENT '教师姓名 Search111 ',
- `jiaoshi_photo` varchar(255) DEFAULT NULL COMMENT '头像',
- `sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
- `jiaoshi_phone` varchar(200) DEFAULT NULL COMMENT '联系方式',
- `jiaoshi_email` varchar(200) DEFAULT NULL COMMENT '邮箱',
- `banji_types` int(11) DEFAULT NULL COMMENT '班级 Search111 ',
- `jiaoshi_delete` int(11) DEFAULT '1' COMMENT '假删',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='教师';
-
-
-
- CREATE TABLE `kecheng` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `kecheng_uuid_number` varchar(200) DEFAULT NULL COMMENT '课程编号 ',
- `kecheng_name` varchar(200) DEFAULT NULL COMMENT '课程名称 Search111',
- `kecheng_types` int(11) DEFAULT NULL COMMENT '课程类型 Search111',
- `xuenfen_number` int(11) DEFAULT NULL COMMENT '学分',
- `kecheng_content` text COMMENT '课程详情',
- `kecheng_delete` int(11) DEFAULT '1' COMMENT '假删',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='课程信息';
-
-
-
- CREATE TABLE `news` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `news_name` varchar(200) DEFAULT NULL COMMENT '公告标题 Search111 ',
- `news_types` int(11) DEFAULT NULL COMMENT '公告类型 Search111 ',
- `news_photo` varchar(200) DEFAULT NULL COMMENT '公告图片',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
- `news_content` text COMMENT '公告详情',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='公告信息';
-
-
-
- CREATE TABLE `paike` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `kecheng_id` int(11) DEFAULT NULL COMMENT '课程',
- `shangke_time` timestamp NULL DEFAULT NULL COMMENT '上课时间',
- `xiake_time` timestamp NULL DEFAULT NULL COMMENT '结束时间',
- `jieke_types` int(11) DEFAULT NULL COMMENT '第几节 Search111',
- `xueqi_types` int(11) DEFAULT NULL COMMENT '学期 Search111',
- `xingqi_types` int(11) DEFAULT NULL COMMENT '周次 Search111',
- `paike_address` varchar(200) DEFAULT NULL COMMENT '上课地点',
- `jiaoshi_id` int(11) DEFAULT NULL COMMENT '教师',
- `paike_delete` int(11) DEFAULT '1' COMMENT '假删',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='排课信息';
-
-
-
- CREATE TABLE `token` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `userid` bigint(20) NOT NULL COMMENT '学生id',
- `username` varchar(100) NOT NULL COMMENT '学生名',
- `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
- `role` varchar(100) DEFAULT NULL COMMENT '角色',
- `token` varchar(200) NOT NULL COMMENT '密码',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='token表';
-
-
-
- CREATE TABLE `users` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(100) NOT NULL COMMENT '学生名',
- `password` varchar(100) NOT NULL COMMENT '密码',
- `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理员';
-
-
- CREATE TABLE `xuanke` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `kecheng_id` int(11) DEFAULT NULL COMMENT '课程',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '学生',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '选课时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='选课信息';
-
-
-
- CREATE TABLE `xuankexianzhi` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `xuankexianzhi_number` int(11) DEFAULT NULL COMMENT '选课数量',
- `kaishi_time` timestamp NULL DEFAULT NULL COMMENT '开始时间',
- `jieshu_time` timestamp NULL DEFAULT NULL COMMENT '结束时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='选课限制';
-
-
-
- CREATE TABLE `yonghu` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `yonghu_uuid_number` varchar(200) DEFAULT NULL COMMENT '学号 ',
- `username` varchar(200) DEFAULT NULL COMMENT '账户',
- `password` varchar(200) DEFAULT NULL COMMENT '密码',
- `yonghu_name` varchar(200) DEFAULT NULL COMMENT '学生名称 Search111 ',
- `yonghu_photo` varchar(255) DEFAULT NULL COMMENT '头像',
- `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '学生手机号',
- `yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '学生身份证号 ',
- `sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
- `banji_types` int(11) DEFAULT NULL COMMENT '班级 Search111 ',
- `yonghu_email` varchar(200) DEFAULT NULL COMMENT '邮箱',
- `yonghu_delete` int(11) DEFAULT '1' COMMENT '假删',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='学生';
- package com.controller;
-
- /**
- * 选课信息
- * 后端接口
- * @author 计算机编程-吉哥
- * @email
- */
- @RestController
- @Controller
- @RequestMapping("/xuanke")
- public class XuankeController {
- private static final Logger logger = LoggerFactory.getLogger(XuankeController.class);
-
- private static final String TABLE_NAME = "xuanke";
-
- @Autowired
- private XuankeService xuankeService;
-
-
- @Autowired
- private TokenService tokenService;
-
- @Autowired
- private ChengjiService chengjiService;//学生成绩
- @Autowired
- private DictionaryService dictionaryService;//字典
- @Autowired
- private JiaoshiService jiaoshiService;//教师
- @Autowired
- private KechengService kechengService;//课程信息
- @Autowired
- private NewsService newsService;//公告信息
- @Autowired
- private PaikeService paikeService;//排课信息
- @Autowired
- private XuankexianzhiService xuankexianzhiService;//选课限制
- @Autowired
- private YonghuService yonghuService;//学生
- @Autowired
- private UsersService usersService;//管理员
-
-
- /**
- * 后端列表
- */
- @RequestMapping("/page")
- public R page(@RequestParam Map
params, HttpServletRequest request) { - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(false)
- return R.error(511,"永不会进入");
- else if("学生".equals(role))
- params.put("yonghuId",request.getSession().getAttribute("userId"));
- else if("教师".equals(role))
- params.put("jiaoshiId",request.getSession().getAttribute("userId"));
- CommonUtil.checkMap(params);
- PageUtils page = xuankeService.queryPage(params);
-
- //字典表数据转换
- List
list =(List)page.getList(); - for(XuankeView c:list){
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(c, request);
- }
- return R.ok().put("data", page);
- }
-
- /**
- * 后端详情
- */
- @RequestMapping("/info/{id}")
- public R info(@PathVariable("id") Long id, HttpServletRequest request){
- logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
- XuankeEntity xuanke = xuankeService.selectById(id);
- if(xuanke !=null){
- //entity转view
- XuankeView view = new XuankeView();
- BeanUtils.copyProperties( xuanke , view );//把实体数据重构到view中
- //级联表 学生
- //级联表
- YonghuEntity yonghu = yonghuService.selectById(xuanke.getYonghuId());
- if(yonghu != null){
- BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
- view.setYonghuId(yonghu.getId());
- }
- //级联表 课程信息
- //级联表
- KechengEntity kecheng = kechengService.selectById(xuanke.getKechengId());
- if(kecheng != null){
- BeanUtils.copyProperties( kecheng , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
- view.setKechengId(kecheng.getId());
- }
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
-
- }
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody XuankeEntity xuanke, HttpServletRequest request){
- logger.debug("save方法:,,Controller:{},,xuanke:{}",this.getClass().getName(),xuanke.toString());
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(false)
- return R.error(511,"永远不会进入");
- else if("学生".equals(role))
- xuanke.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
-
- Wrapper
queryWrapper = new EntityWrapper() - .eq("kecheng_id", xuanke.getKechengId())
- .eq("yonghu_id", xuanke.getYonghuId())
- ;
-
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- XuankeEntity xuankeEntity = xuankeService.selectOne(queryWrapper);
- if(xuankeEntity==null){
- List
xuankexianzhiEntities = xuankexianzhiService.selectList(null); - if(xuankexianzhiEntities.size()<0){
- return R.error("选课限制表无数据");
- }
- if(xuankexianzhiEntities.get(0).getKaishiTime().getTime() > new Date().getTime() || new Date().getTime() > xuankexianzhiEntities.get(0).getJieshuTime().getTime()){
- return R.error("不在选课限制时间之内");
- }
- Wrapper
xuankeList = new EntityWrapper() - .eq("yonghu_id", xuanke.getYonghuId())
- ;
- List
xuankeEntities = xuankeService.selectList(xuankeList); - Integer xuankeshuliang = xuankeEntities.size()+1;
- if(xuankeshuliang > xuankexianzhiEntities.get(0).getXuankexianzhiNumber()){
- return R.error("当前选("+xuankeEntities.size()+")课,选课限制为:"+xuankexianzhiEntities.get(0).getXuankexianzhiNumber());
- }
- xuanke.setInsertTime(new Date());
- xuanke.setCreateTime(new Date());
- xuankeService.insert(xuanke);
- return R.ok();
- }else {
- return R.error(511,"请不要重复选课");
- }
- }
-
- /**
- * 后端修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody XuankeEntity xuanke, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
- logger.debug("update方法:,,Controller:{},,xuanke:{}",this.getClass().getName(),xuanke.toString());
- XuankeEntity oldXuankeEntity = xuankeService.selectById(xuanke.getId());//查询原先数据
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
-
- xuankeService.updateById(xuanke);//根据id更新
- return R.ok();
- }
-
-
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
- logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
- List
oldXuankeList =xuankeService.selectBatchIds(Arrays.asList(ids));//要删除的数据 - xuankeService.deleteBatchIds(Arrays.asList(ids));
-
- return R.ok();
- }
-
-
- /**
- * 批量上传
- */
- @RequestMapping("/batchInsert")
- public R save( String fileName, HttpServletRequest request){
- logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
- Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
- List
xuankeList = new ArrayList<>();//上传的东西 - Map
> seachFields= new HashMap<>();//要查询的字段 - Date date = new Date();
- int lastIndexOf = fileName.lastIndexOf(".");
- if(lastIndexOf == -1){
- return R.error(511,"该文件没有后缀");
- }else{
- String suffix = fileName.substring(lastIndexOf);
- if(!".xls".equals(suffix)){
- return R.error(511,"只支持后缀为xls的excel文件");
- }else{
- URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
- File file = new File(resource.getFile());
- if(!file.exists()){
- return R.error(511,"找不到上传文件,请联系管理员");
- }else{
- List
> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
- dataList.remove(0);//删除第一行,因为第一行是提示
- for(List
data:dataList){ - //循环
- XuankeEntity xuankeEntity = new XuankeEntity();
- xuankeList.add(xuankeEntity);
-
- //把要查询是否重复的字段放入map中
- }
-
- //查询是否重复
- xuankeService.insertBatch(xuankeList);
- return R.ok();
- }
- }
- }
- }catch (Exception e){
- e.printStackTrace();
- return R.error(511,"批量插入数据异常,请联系管理员");
- }
- }
-
- }
-
- package com.service;
-
- import com.baomidou.mybatisplus.service.IService;
- import com.utils.PageUtils;
- import com.entity.XuankeEntity;
- import java.util.Map;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.lang.Nullable;
- import java.util.List;
-
- /**
- * 选课信息 服务类
- */
- public interface XuankeService extends IService
{ -
- /**
- * @param params 查询参数
- * @return 带分页的查询出来的数据
- */
- PageUtils queryPage(Map
params) ; -
- }
- package com.service.impl;
-
- import com.utils.StringUtil;
- import com.service.DictionaryService;
- import com.utils.ClazzDiff;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.lang.reflect.Field;
- import java.util.*;
- import com.baomidou.mybatisplus.plugins.Page;
- import com.baomidou.mybatisplus.service.impl.ServiceImpl;
- import org.springframework.transaction.annotation.Transactional;
- import com.utils.PageUtils;
- import com.utils.Query;
- import org.springframework.web.context.ContextLoader;
- import javax.servlet.ServletContext;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.lang.Nullable;
- import org.springframework.util.Assert;
- import com.dao.XuankeDao;
- import com.entity.XuankeEntity;
- import com.service.XuankeService;
- import com.entity.view.XuankeView;
-
- /**
- * 选课信息 服务实现类
- */
- @Service("xuankeService")
- @Transactional
- public class XuankeServiceImpl extends ServiceImpl
implements XuankeService { -
- @Override
- public PageUtils queryPage(Map
params) { - Page
page =new Query(params).getPage(); - page.setRecords(baseMapper.selectListView(page,params));
- return new PageUtils(page);
- }
-
-
- }
- package com.dao;
-
- import com.entity.XuankeEntity;
- import com.baomidou.mybatisplus.mapper.BaseMapper;
- import java.util.List;
- import java.util.Map;
- import com.baomidou.mybatisplus.plugins.pagination.Pagination;
-
- import org.apache.ibatis.annotations.Param;
- import com.entity.view.XuankeView;
-
- /**
- * 选课信息 Dao 接口
- *
- * @author
- */
- public interface XuankeDao extends BaseMapper
{ -
- List
selectListView(Pagination page,@Param("params")Map params) ; -
- }

你可能还有感兴趣的项目👇🏻👇🏻👇🏻
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论