基于javaweb+mysql的ssm+maven动漫影视管理系统视频播放系统(java+ssm+jsp+jquery+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven动漫影视管理系统(java+ssm+jsp+jquery+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版本; 6.是否Maven项目:是;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jQuery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
@RequestMapping(value = "/listAll")
public String listAll(Comment comment, Model model, HttpServletRequest request, HttpServletResponse response){
List<Comment> listAll = commentService.listAll();
model.addAttribute("list", listAll);
return "comment/comment";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(Comment comment, Model model, HttpServletRequest request, HttpServletResponse response){
List<Comment> listAll = commentService.listAllByEntity(comment);
model.addAttribute("list", listAll);
return "comment/comment";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByMap")
public String listByMap(Comment comment, Model model, HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(comment.getUserId())){
params.put("userId", comment.getUserId());
}
if(!isEmpty(comment.getFilmId())){
params.put("filmId", comment.getFilmId());
}
if(!isEmpty(comment.getContent())){
params.put("content", comment.getContent());
}
if(!isEmpty(comment.getAddTime())){
params.put("addTime", comment.getAddTime());
}
*/
@RequestMapping(value = "/listByMap")
public String listByMap(User user, Model model, HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(user.getNickname())){
params.put("nickname", user.getNickname());
}
if(!isEmpty(user.getName())){
params.put("name", user.getName());
}
if(!isEmpty(user.getPhone())){
params.put("phone", user.getPhone());
}
if(!isEmpty(user.getIdCard())){
params.put("idCard", user.getIdCard());
}
if(!isEmpty(user.getPassword())){
params.put("password", user.getPassword());
}
if(!isEmpty(user.getEmail())){
params.put("email", user.getEmail());
}
if(!isEmpty(user.getIsDelete())){
params.put("isDelete", user.getIsDelete());
}
List<User> listAll = userService.listByMap(params);
model.addAttribute("list", listAll);
return "user/user";
}
/*********************************查询列表【分页】***********************************************/
/**
* 分页查询 返回list对象(通过对象)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<User> pagers = userService.findByEntity(user);
@RequestMapping("/comment")
public class CommentController extends BaseController {
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private CommentService commentService;
// --------------------------------------- 华丽分割线 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(Comment comment, Model model, HttpServletRequest request, HttpServletResponse response){
List<Comment> listAll = commentService.listAll();
model.addAttribute("list", listAll);
return "comment/comment";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(Comment comment, Model model, HttpServletRequest request, HttpServletResponse response){
List<Comment> listAll = commentService.listAllByEntity(comment);
model.addAttribute("list", listAll);
return "comment/comment";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
}
// --------------------------------------- 华丽分割线 ------------------------------
}
/**
* @ClassName:
* @Description:
*/
return jsonObject.toString();
}
/**
* 单文件上传
* @param file
* @param request
* @param model
* @return
*/
@RequestMapping(value = "/saveFile")
public String saveFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, Model model) {
System.out.println("开始");
String path = request.getSession().getServletContext().getRealPath("/upload");
String fileName = file.getOriginalFilename();
System.out.println(path);
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* springMvc多文件上传
* @param files
* @param id
* @return
*/
@RequestMapping(value = "/saveFiles")
public String saveFiles(@RequestParam("file") CommonsMultipartFile[] files,Integer id,HttpServletRequest request){
for(int i = 0;i<files.length;i++){
System.out.println("fileName---------->" + files[i].getOriginalFilename());
if(!files[i].isEmpty()){
int pre = (int) System.currentTimeMillis();
try {
//拿到输出流,同时重命名上传的文件
if(!isEmpty(user.getPassword())){
params.put("password", user.getPassword());
}
if(!isEmpty(user.getEmail())){
params.put("email", user.getEmail());
}
if(!isEmpty(user.getIsDelete())){
params.put("isDelete", user.getIsDelete());
}
List<User> listAll = userService.listByMap(params);
model.addAttribute("list", listAll);
return "user/user";
}
/*********************************查询列表【分页】***********************************************/
/**
* 分页查询 返回list对象(通过对象)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<User> pagers = userService.findByEntity(user);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", user);
return "user/user";
}
/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM user WHERE isDelete = 0 ";
if(!isEmpty(user.getNickname())){
sql += " and nickname like '%"+user.getNickname()+"%'";
}
if(!isEmpty(user.getName())){
sql += " and name like '%"+user.getName()+"%'";
}
JSONObject jsonObject = new JSONObject();
if(byEntity == null){
return "redirect:/login/uIndex.action";
}else{
request.getSession().setAttribute("role", 1);
request.getSession().setAttribute("mid", byEntity.getId());
request.getSession().setAttribute("xm",byEntity.getName());
return "redirect:/login/uIndex.action";
}
}
@RequestMapping("/res")
public String res(User user) {
user.setIsDelete(0);
userService.insert(user);
return "redirect:/login/uIndex.action";
}
/**
* 用户首页查询数据
* @param openId
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/uIndex")
public String uIndex(Integer type,String name, Model model, HttpServletRequest request, HttpServletResponse response) {
String sql = "SELECT * FROM film WHERE isDelete = 0 ";
if (type != null ){
sql+=" and type = "+type;
}
if (StringUtils.isNoneBlank(name)){
sql += " and name like '%"+name+"%'";
}
sql+=" order by id desc";
Pager<Film> findBySqlRerturnEntity = filmService.findBySqlRerturnEntity(sql);
model.addAttribute("type", type);
model.addAttribute("name", name);
model.addAttribute("pagers", findBySqlRerturnEntity);
String sql2 = "SELECT * FROM film WHERE isDelete = 0 order by id desc limit 0,10 ";
List<Film> findBySqlRerturnEntity2 = filmService.listBySqlReturnEntity(sql2);
model.addAttribute("pagers2", findBySqlRerturnEntity2);
return "login/uIndex";
}
/**
* @ClassName:
* @Description:
*/
@Controller
@RequestMapping("/collect")
public class CollectController extends BaseController {
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private CollectService collectService;
// --------------------------------------- 华丽分割线 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAll")
sql += " and userId like '%"+collect.getUserId()+"%'";
}
if(!isEmpty(collect.getFilmId())){
sql += " and filmId like '%"+collect.getFilmId()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Collect> pagers = collectService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", collect);
return "collect/collect";
}
/**
* 分页查询 返回list对象(通过Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Collect collect, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(collect.getUserId())){
params.put("userId", collect.getUserId());
}
if(!isEmpty(collect.getFilmId())){
params.put("filmId", collect.getFilmId());
}
//分页查询
Pager<Collect> pagers = collectService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", collect);
return "collect/collect";
}
/**********************************【增删改】******************************************************/
/**
* 跳至添加页面
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "collect/add";
}
/**
* 跳至详情页面
//拿到输出流,同时重命名上传的文件
String filePath = request.getRealPath("/upload");
File f=new File(filePath);
if(!f.exists()){
f.mkdirs();
}
String fileNmae=new Date().getTime() + files[i].getOriginalFilename();
File file=new File(filePath+"/"+pre + files[i].getOriginalFilename());
if(!file.exists()){
file.createNewFile();
}
files[i].transferTo(file);
} catch (Exception e) {
e.printStackTrace();
System.out.println("上传出错");
}
}
}
return "";
}
// --------------------------------------- 华丽分割线 ------------------------------
}
/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAllJson", method = RequestMethod.POST)
@ResponseBody
public String listAllJson(Comment comment, HttpServletRequest request, HttpServletResponse response){
List<Comment> listAll = commentService.listAll();
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", comment);
return jsonObject.toString();
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntityJson", method = RequestMethod.POST)
@ResponseBody
public String listByEntityJson(Comment comment, HttpServletRequest request, HttpServletResponse response){
List<Comment> listAll = commentService.listAllByEntity(comment);
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", comment);
return jsonObject.toString();
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
return "user/user";
}
/*********************************查询列表【分页】***********************************************/
/**
* 分页查询 返回list对象(通过对象)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<User> pagers = userService.findByEntity(user);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", user);
return "user/user";
}
/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM user WHERE isDelete = 0 ";
if(!isEmpty(user.getNickname())){
sql += " and nickname like '%"+user.getNickname()+"%'";
}
if(!isEmpty(user.getName())){
sql += " and name like '%"+user.getName()+"%'";
}
if(!isEmpty(user.getPhone())){
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private FilmService filmService;
@Autowired
private FilmDetailService filmDetailService;
// --------------------------------------- 华丽分割线 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(Film film, Model model, HttpServletRequest request, HttpServletResponse response){
List<Film> listAll = filmService.listAll();
model.addAttribute("list", listAll);
return "film/film";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(Film film, Model model, HttpServletRequest request, HttpServletResponse response){
List<Film> listAll = filmService.listAllByEntity(film);
model.addAttribute("list", listAll);
return "film/film";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
}
if(!isEmpty(comment.getAddTime())){
sql += " and addTime like '%"+comment.getAddTime()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Comment> pagers = commentService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", comment);
return "comment/comment";
}
/**
* 分页查询 返回list对象(通过Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Comment comment, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(comment.getUserId())){
params.put("userId", comment.getUserId());
}
if(!isEmpty(comment.getFilmId())){
params.put("filmId", comment.getFilmId());
}
if(!isEmpty(comment.getContent())){
params.put("content", comment.getContent());
}
if(!isEmpty(comment.getAddTime())){
params.put("addTime", comment.getAddTime());
}
//分页查询
Pager<Comment> pagers = commentService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", comment);
return "comment/comment";
@Controller
@RequestMapping("/login")
public class LoginController extends BaseController{
@Autowired
private ManageService manageService;
@Autowired
private UserService userService;
@Autowired
private CommentService commentService;
@Autowired
private FilmService filmService;
@Autowired
private CollectService collectService;
/**
* 跳转登陆
* @return
*/
@RequestMapping("/login")
public String login(){
return "login/login";
}
@RequestMapping("/uLogin")
public String uLogin(){
return "login/uLogin";
}
@RequestMapping("/index")
public String index(){
return "login/index";
}
params.put("num", filmDetail.getNum());
}
if(!isEmpty(filmDetail.getUrl())){
params.put("url", filmDetail.getUrl());
}
List<FilmDetail> listAll = filmDetailService.listByMap(params);
model.addAttribute("list", listAll);
return "filmDetail/filmDetail";
}
/*********************************查询列表【分页】***********************************************/
/**
* 分页查询 返回list对象(通过对象)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(FilmDetail filmDetail, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<FilmDetail> pagers = filmDetailService.findByEntity(filmDetail);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", filmDetail);
return "filmDetail/filmDetail";
}
/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
}
/**
* @ClassName:
* @Description:
*/
@Controller
@RequestMapping("/manage")
public class ManageController extends BaseController {
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private ManageService manageService;
// --------------------------------------- 华丽分割线 ------------------------------