博主主页:猫头鹰源码
博主简介:Java领域优质创作者、博客专家、公司架构师、全网粉丝5万+、专注Java技术领域和毕业设计项目实战
主要内容:毕业设计(Javaweb项目|小程序等)、简历模板、学习资料、面试题库、技术咨询
项目介绍:
该系统使用ssm整合,数据层为MyBatis,mysql数据库,具有完整的业务逻辑,适合选题:ssm、在线教学、算法演示、视频网站等。
项目功能:
系统角色分为学生和老师,网站类型,分为前后台。
学生角色:前台学生注册系统后,登录系统进入首页,首页展示不同算法类别的视频,每个类别展示几个,如果点击类别名称可以进入类别页面,查看该类别全部视频。在网站上方有搜索框,可以搜索视频学习,在视频详情界面,视频显示播放量,可以收藏,有视频简介,也可以进行登录后评论,学生可以到达个人中心查看自己的个人信息,或修改个人信息,并查看收藏及评论记录。
老师角色:登录功能,视频内容管理模块(视频的查看,上传,修改,删除),分类管理模块(分类的增加,删除,修改,查看),教师信息管理模块(教师的查看,修改,增加,删除),学生管理模块(增加,删除,修改,查询)。
数据库表结构文档:
系统包含技术:
技术:Spring,SpringMVC,Mybatis
开发工具:eclipse
数据库:mysql 5.7
JDK版本:jdk1.8
服务器:tomcat8
部分截图说明:
下面是首页
算法列表,可以根据分类查看算法
热门排行算法,根据收藏数排行
详情查看,可以查看视频,可以进行评论
个人中心
后台登录
后台首页
后台对学生进行管理
后台对分类维护
后台对算法维护
后台查看评论
部分代码截图:
视频操作
//返回到前台首页
@RequestMapping(value = "/index")
public String index(HttpServletRequest request,ModelMap model) {
String path = request.getContextPath();
System.out.println(path);
List<Video> allvideo=videoService.ReadByProperty();
List<Guanggao> guanggaolist=guanggaoService.queryImg(1);
List<Category> allcategory=categoryService.queryAll();
//System.out.println(allvideo);
//图片数量
model.addAttribute("guanggaolist", guanggaolist);
model.addAttribute("allcategory", allcategory);
model.addAttribute("resultvideovod", allvideo);
model.addAttribute("pre", "/OnlineMovie");
return "front/videomain";
}
//按照ID查询视频
@RequestMapping("/videobyId/{videoid}")
public ModelAndView videobyId(@PathVariable("videoid") Integer id,ModelMap model,HttpServletRequest request) throws Exception{
ModelAndView mv = new ModelAndView();
HttpSession session = request.getSession();
int s = 0;
if(session.getAttribute("uid") == null){
s=1;
}else{
String uid = session.getAttribute("uid").toString();
int userid = Integer.parseInt(uid);
List<Star> ss = starService.queryUidVid(userid,id);
if(ss.size() == 0){
s=1;
}else{
s=2;
}
}
Video video=videoService.queryByID(id);
List<Comments> comments=commentsService.queryById(id);
int total = comments.size();
Category category = categoryService.queryById(video.getCategoryid());
model.addAttribute("video", video);
model.addAttribute("comments", comments);
model.addAttribute("total", total);
model.addAttribute("ss", s);
model.addAttribute("categoryname", category.getName());
mv.setViewName("front/videodetail");
model.addAttribute("pre", "/OnlineMovie");
return mv;
}
//留言成功后界面按照ID查询视频
@RequestMapping("/videobyIdCC/{videoid}")
public ModelAndView videobyIdCC(@PathVariable("videoid") Integer id,HttpServletRequest request,ModelMap model) throws Exception{
ModelAndView mv = new ModelAndView();
HttpSession session = request.getSession();
int s = 0;
if(session.getAttribute("uid") == null){
s=1;
}else{
String uid = session.getAttribute("uid").toString();
int userid = Integer.parseInt(uid);
List<Star> ss = starService.queryUidVid(userid,id);
if(ss.size() == 0){
s=1;
}else{
s=2;
}
}
Video video=videoService.queryByID(id);
List<Comments> comments=commentsService.queryById(id);
int total = comments.size();
Category category = categoryService.queryById(video.getCategoryid());
model.addAttribute("video", video);
model.addAttribute("comments", comments);
model.addAttribute("total", total);
model.addAttribute("ss", s);
model.addAttribute("categoryname", category.getName());
mv.setViewName("front/videodetail");
model.addAttribute("pre", "/OnlineMovie");
return mv;
}
//跳转到算法列表
@RequestMapping("/list")
public ModelAndView video(ModelMap model) throws Exception{
ModelAndView mv = new ModelAndView();
List<Category> allcategory=categoryService.queryAll();
model.addAttribute("allcategory", allcategory);
mv.setViewName("front/movieList");
return mv;
}
//按照分类查找算法
@RequestMapping("/queryByCategory/{cid}/{aid}")
public ModelAndView queryByCategory(@PathVariable("cid") Integer cid,@PathVariable("aid") Integer aid,ModelMap model) throws Exception{
ModelAndView mv = new ModelAndView();
int pageSize=18;
int pageCode=aid;
PageBean<Video> videoPageBean = videoService.queryAllbycat(cid,pageCode, pageSize);
int tt = videoPageBean.getTotalPage();
model.addAttribute("videoPageBean", videoPageBean);
List<Category> allcategory=categoryService.queryAll();
model.addAttribute("allcategory", allcategory);
mv.setViewName("front/movieList");
return mv;
}
//按照分类显示全部算法
@RequestMapping("/queryByCategory2/{cid}/{aid}")
public ModelAndView queryByCategory2(@PathVariable("cid") Integer cid,@PathVariable("aid") Integer aid,ModelMap model) throws Exception{
ModelAndView mv = new ModelAndView();
int pageSize=18;
int pageCode=aid;
PageBean<Video> videoPageBean = videoService.findAllarticleByPage(cid, pageCode, pageSize);
int tt = videoPageBean.getTotalPage();
model.addAttribute("videoPageBean", videoPageBean);
List<Category> allcategory=categoryService.queryAll();
model.addAttribute("allcategory", allcategory);
mv.setViewName("front/movieList");
return mv;
}
//模糊查询算法算法
@RequestMapping("/queryVideo")
public ModelAndView queryVideo(ModelMap model,HttpServletRequest request) throws Exception{
ModelAndView mv = new ModelAndView();
String search = request.getParameter("searchMovie");
List<Video> videobycategory=videoService.queryVideo(search);
model.addAttribute("videobycategory", videobycategory);
mv.setViewName("front/movieSearch");
return mv;
}
//下载算法
@RequestMapping("/upload/{id}")
public ResponseEntity<byte[]> upload(@PathVariable("id") Integer id,HttpServletRequest request, HttpServletResponse response,ModelMap model) throws Exception{
ModelAndView mv = new ModelAndView();
Video video = videoService.queryByID(id);
// 文件保存路径
String filePath = "D:/upload" + video.getUrl();
// 转存文件
String fileNames = video.getUrl().substring(video.getUrl().lastIndexOf("/")+1);
String downloadFileName = URLEncoder.encode(fileNames,"UTF-8");
File file = new File(filePath);
byte[] body = null;
InputStream is = new FileInputStream(file);
body = new byte[is.available()];
is.read(body);
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition", "attchement;filename="+downloadFileName);
HttpStatus statusCode = HttpStatus.OK;
ResponseEntity<byte[]> entity = new ResponseEntity<byte[]>(body, headers, statusCode);
return entity;
}
//热门排行
@RequestMapping("/rank")
public ModelAndView rank(ModelMap model) throws Exception{
ModelAndView mv = new ModelAndView();
List<Video> videorank = videoService.videorank();
model.addAttribute("videorank", videorank);
mv.setViewName("front/movieRank");
return mv;
}
学生登录
//学生登录
@RequestMapping(value = "/userLogin")
public ModelAndView userLogin(String email, String password ,ModelMap map,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
ModelAndView modelAndView = new ModelAndView();
User user = userService.check(email);
if(user==null) {
session.setAttribute("msg", "对不起,登录名错误,请重试!");
modelAndView.setViewName("front/login");
return modelAndView;
}else {
if(user.getPassword().equals(password)) {
String uname = user.getName();
int uid = user.getUid();
session.setAttribute("uname", uname);
session.setAttribute("uid", uid);
modelAndView.setViewName("redirect:/video/index");
return modelAndView;
}else {
session.setAttribute("msg", "对不起,密码错误,请重试!");
modelAndView.setViewName("front/login");
return modelAndView;
}
}
}
以上就是部分功能展示,从整体上来看,本系统功能是十分完整的,界面设计简洁大方,交互友好,数据库设计也很合理,规模适中,代码工整,清晰,适合学习使用。
好了,今天就到这儿吧,小伙伴们点赞、收藏、评论,一键三连走起呀,下期见~~