🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
1.技术选型
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
2.数据库表结构
10张
3.开发工具
idea、navicat
4.功能
4.1【角色】
管理员、用户、教师
4.2【用户功能模块】
- 登录注册
- 首页
- 个人中心
- 项目申报管理
- 选题审核管理
- 项目进度管理
- 公告信息管理
4.3【教师功能模块】
- 登录注册
- 首页
- 个人中心
- 学生管理
- 项目申报管理
- 选题审核管理
- 项目进度管理
- 公告信息管理
4.4【管理员功能模块】
- 登录
- 首页
- 个人中心
- 管理员管理
- 指导教师管理
- 学生管理
- 项目申报管理
- 选题审核管理
- 项目进度管理
- 基础数据管理
- 公告信息管理
5.项目演示截图
5.1 登录
5.2 指导教师管理
5.3 项目申报管理
5.4 选题审核管理
5.5 项目进度管理
5.6 项目类型管理
6.数据库文件设计
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=22 DEFAULT CHARSET=utf8 COMMENT='字典';CREATE TABLE `jiaoshi` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`username` varchar(200) DEFAULT NULL COMMENT '账户',`password` varchar(200) DEFAULT NULL COMMENT '密码',`jiaoshi_name` varchar(200) DEFAULT NULL COMMENT '教师名称 Search111 ',`jiaoshi_phone` varchar(200) DEFAULT NULL COMMENT '教师手机号',`jiaoshi_photo` varchar(200) DEFAULT NULL COMMENT '教师头像',`sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111',`jiaoshi_email` varchar(200) DEFAULT NULL COMMENT '教师邮箱',`jiaoshi_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`jiaoshi_time` date DEFAULT NULL COMMENT '入职时间',`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 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` longtext 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=5 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 `xiangmujindu` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`xuantishenhe_id` int(11) DEFAULT NULL COMMENT '选题审核',`xiangmujindu_file` varchar(200) DEFAULT NULL COMMENT '项目文件',`xiangmujindu_content` longtext COMMENT '项目详情',`xiangmujindu_yesno_types` int(11) DEFAULT NULL COMMENT '进度审核 Search111',`xiangmujindu_yesno_text` longtext COMMENT '审核结果 ',`xiangmujindu_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COMMENT='项目进度';CREATE TABLE `xuantishenhe` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`xiangmu_id` int(11) DEFAULT NULL COMMENT '项目',`yonghu_id` int(11) DEFAULT NULL COMMENT '学生',`xuantishenhe_yesno_types` int(11) DEFAULT NULL COMMENT '选题申请 Search111',`xuantishenhe_yesno_text` longtext COMMENT '申请结果',`xuantishenhe_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 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_phone` varchar(200) DEFAULT NULL COMMENT '学生手机号',`yonghu_photo` varchar(200) DEFAULT NULL COMMENT '学生头像',`sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111',`yonghu_email` varchar(200) DEFAULT NULL COMMENT '学生邮箱',`yonghu_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`yonghu_time` date DEFAULT NULL COMMENT '入职时间',`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='学生';
7.核心代码
7.1 教师Controller
package com.controller;/*** 指导教师* 后端接口* @author 计算机编程-吉哥* @email
*/
@RestController
@Controller
@RequestMapping("/jiaoshi")
public class JiaoshiController {private static final Logger logger = LoggerFactory.getLogger(JiaoshiController.class);private static final String TABLE_NAME = "jiaoshi";@Autowiredprivate JiaoshiService jiaoshiService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate NewsService newsService;//公告信息@Autowiredprivate XiangmuService xiangmuService;//项目申报@Autowiredprivate XiangmujinduService xiangmujinduService;//项目进度@Autowiredprivate XuantishenheService xuantishenheService;//选题审核@Autowiredprivate YonghuService yonghuService;//学生@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> 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"));params.put("jiaoshiDeleteStart",1);params.put("jiaoshiDeleteEnd",1);CommonUtil.checkMap(params);PageUtils page = jiaoshiService.queryPage(params);//字典表数据转换List<JiaoshiView> list =(List<JiaoshiView>)page.getList();for(JiaoshiView 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);JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);if(jiaoshi !=null){//entity转viewJiaoshiView view = new JiaoshiView();BeanUtils.copyProperties( jiaoshi , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,jiaoshi:{}",this.getClass().getName(),jiaoshi.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<JiaoshiEntity> queryWrapper = new EntityWrapper<JiaoshiEntity>().eq("username", jiaoshi.getUsername()).or().eq("jiaoshi_phone", jiaoshi.getJiaoshiPhone()).eq("jiaoshi_delete", 1);logger.info("sql语句:"+queryWrapper.getSqlSegment());JiaoshiEntity jiaoshiEntity = jiaoshiService.selectOne(queryWrapper);if(jiaoshiEntity==null){jiaoshi.setJiaoshiDelete(1);jiaoshi.setInsertTime(new Date());jiaoshi.setCreateTime(new Date());jiaoshi.setPassword("123456");jiaoshiService.insert(jiaoshi);return R.ok();}else {return R.error(511,"账户或者教师手机号已经被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,jiaoshi:{}",this.getClass().getName(),jiaoshi.toString());JiaoshiEntity oldJiaoshiEntity = jiaoshiService.selectById(jiaoshi.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");if("".equals(jiaoshi.getJiaoshiPhoto()) || "null".equals(jiaoshi.getJiaoshiPhoto())){jiaoshi.setJiaoshiPhoto(null);}jiaoshiService.updateById(jiaoshi);//根据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<JiaoshiEntity> oldJiaoshiList =jiaoshiService.selectBatchIds(Arrays.asList(ids));//要删除的数据ArrayList<JiaoshiEntity> list = new ArrayList<>();for(Integer id:ids){JiaoshiEntity jiaoshiEntity = new JiaoshiEntity();jiaoshiEntity.setId(id);jiaoshiEntity.setJiaoshiDelete(2);list.add(jiaoshiEntity);}if(list != null && list.size() >0){jiaoshiService.updateBatchById(list);}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");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<JiaoshiEntity> jiaoshiList = new ArrayList<>();//上传的东西Map<String, List<String>> 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<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环JiaoshiEntity jiaoshiEntity = new JiaoshiEntity();jiaoshiList.add(jiaoshiEntity);//把要查询是否重复的字段放入map中//账户if(seachFields.containsKey("username")){List<String> username = seachFields.get("username");username.add(data.get(0));//要改的}else{List<String> username = new ArrayList<>();username.add(data.get(0));//要改的seachFields.put("username",username);}//教师手机号if(seachFields.containsKey("jiaoshiPhone")){List<String> jiaoshiPhone = seachFields.get("jiaoshiPhone");jiaoshiPhone.add(data.get(0));//要改的}else{List<String> jiaoshiPhone = new ArrayList<>();jiaoshiPhone.add(data.get(0));//要改的seachFields.put("jiaoshiPhone",jiaoshiPhone);}}//查询是否重复//账户List<JiaoshiEntity> jiaoshiEntities_username = jiaoshiService.selectList(new EntityWrapper<JiaoshiEntity>().in("username", seachFields.get("username")).eq("jiaoshi_delete", 1));if(jiaoshiEntities_username.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(JiaoshiEntity s:jiaoshiEntities_username){repeatFields.add(s.getUsername());}return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());}//教师手机号List<JiaoshiEntity> jiaoshiEntities_jiaoshiPhone = jiaoshiService.selectList(new EntityWrapper<JiaoshiEntity>().in("jiaoshi_phone", seachFields.get("jiaoshiPhone")).eq("jiaoshi_delete", 1));if(jiaoshiEntities_jiaoshiPhone.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(JiaoshiEntity s:jiaoshiEntities_jiaoshiPhone){repeatFields.add(s.getJiaoshiPhone());}return R.error(511,"数据库的该表中的 [教师手机号] 字段已经存在 存在数据为:"+repeatFields.toString());}jiaoshiService.insertBatch(jiaoshiList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {JiaoshiEntity jiaoshi = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("username", username));if(jiaoshi==null || !jiaoshi.getPassword().equals(password))return R.error("账号或密码不正确");else if(jiaoshi.getJiaoshiDelete() != 1)return R.error("账户已被删除");String token = tokenService.generateToken(jiaoshi.getId(),username, "jiaoshi", "指导教师");R r = R.ok();r.put("token", token);r.put("role","指导教师");r.put("username",jiaoshi.getJiaoshiName());r.put("tableName","jiaoshi");r.put("userId",jiaoshi.getId());return r;}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request) {
// ValidatorUtils.validateEntity(user);Wrapper<JiaoshiEntity> queryWrapper = new EntityWrapper<JiaoshiEntity>().eq("username", jiaoshi.getUsername()).or().eq("jiaoshi_phone", jiaoshi.getJiaoshiPhone()).andNew().eq("jiaoshi_delete", 1);JiaoshiEntity jiaoshiEntity = jiaoshiService.selectOne(queryWrapper);if(jiaoshiEntity != null)return R.error("账户或者教师手机号已经被使用");jiaoshi.setJiaoshiDelete(1);jiaoshi.setInsertTime(new Date());jiaoshi.setCreateTime(new Date());jiaoshiService.insert(jiaoshi);return R.ok();}/*** 重置密码*/@GetMapping(value = "/resetPassword")public R resetPassword(Integer id, HttpServletRequest request) {JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);jiaoshi.setPassword("123456");jiaoshiService.updateById(jiaoshi);return R.ok();}/*** 修改密码*/@GetMapping(value = "/updatePassword")public R updatePassword(String oldPassword, String newPassword, HttpServletRequest request) {JiaoshiEntity jiaoshi = jiaoshiService.selectById((Integer)request.getSession().getAttribute("userId"));if(newPassword == null){return R.error("新密码不能为空") ;}if(!oldPassword.equals(jiaoshi.getPassword())){return R.error("原密码输入错误");}if(newPassword.equals(jiaoshi.getPassword())){return R.error("新密码不能和原密码一致") ;}jiaoshi.setPassword(newPassword);jiaoshiService.updateById(jiaoshi);return R.ok();}/*** 忘记密码*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request) {JiaoshiEntity jiaoshi = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("username", username));if(jiaoshi!=null){jiaoshi.setPassword("123456");jiaoshiService.updateById(jiaoshi);return R.ok();}else{return R.error("账号不存在");}}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrJiaoshi(HttpServletRequest request){Integer id = (Integer)request.getSession().getAttribute("userId");JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);if(jiaoshi !=null){//entity转viewJiaoshiView view = new JiaoshiView();BeanUtils.copyProperties( jiaoshi , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}}
7.2 教师Service
package com.service;import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.JiaoshiEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;/*** 指导教师 服务类*/
public interface JiaoshiService extends IService<JiaoshiEntity> {/*** @param params 查询参数* @return 带分页的查询出来的数据*/PageUtils queryPage(Map<String, Object> params);}
7.3 教师ServiceImpl
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.JiaoshiDao;
import com.entity.JiaoshiEntity;
import com.service.JiaoshiService;
import com.entity.view.JiaoshiView;/*** 指导教师 服务实现类*/
@Service("jiaoshiService")
@Transactional
public class JiaoshiServiceImpl extends ServiceImpl<JiaoshiDao, JiaoshiEntity> implements JiaoshiService {@Overridepublic PageUtils queryPage(Map<String,Object> params) {Page<JiaoshiView> page =new Query<JiaoshiView>(params).getPage();page.setRecords(baseMapper.selectListView(page,params));return new PageUtils(page);}}
7.4 教师DAO
package com.dao;import com.entity.JiaoshiEntity;
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.JiaoshiView;/*** 指导教师 Dao 接口** @author */
public interface JiaoshiDao extends BaseMapper<JiaoshiEntity> {List<JiaoshiView> selectListView(Pagination page,@Param("params")Map<String,Object> params);}
8.参考文档
你可能还有感兴趣的项目👇🏻👇🏻👇🏻
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论