ssm+vue游戏攻略网站源码和论文052
开发工具:idea
数据库mysql5.7+
数据库链接工具:navcat,小海豚等
技术:ssm
一、主要内容和基本要求
游戏攻略网站分为管理员与用户两种角色。
管理员的功能包括登录,用户管理,游戏分类管理,游戏攻略管理,游戏资讯管理等。
登录功能:管理员需要登录进入系统后台。
用户管理:实现用户信息的查询,修改,删除,用户禁言,取消禁言等操作,禁言的用户不能参与游戏攻略的评论操作。
游戏分类管理:实现游戏分类信息的增删改操作。
游戏攻略管理:实现游戏攻略信息的增删改查操作,可以查看用户对游戏攻略的评论。
游戏资讯管理:实现游戏资讯信息的增删改查操作。
用户的功能包括注册登录,游戏攻略,游戏资讯,修改个人信息,我的收藏等功能。
注册登录:用户需要先注册,再登录系统进入系统前台。
游戏攻略:用户查看游戏攻略信息,可以下载游戏攻略文件,可以收藏游戏攻略,可以评论游戏攻略,用户也能发布游戏攻略信息让其他人查看。
游戏资讯:用户查询查看游戏资讯信息。
修改个人信息:用户对个人资料进行查看和修改。
我的收藏:用户查看已经收藏的游戏攻略信息。
游戏攻略网站是属于JavaWeb项目,采用的开发框架为SSM框架,也就是Spring mvc、Spring、MyBatis这三个框架,页面设计用的是jsp技术作为动态页面文件设计,jsp文件里可以对实现html等界面布局的代码,采用SpringMVC替代传统的struts2框架,主要对jsp访问的拦截和控制,Spring作为整个控制的核心,通过控制反转技术和面向切面技术,让Spring自动对使用的类文件进行调用和导入,MyBatis主要作为底层操作数据库,不牵扯业务逻辑,开发工具采用MyEclipse,服务器用的是tomcat。编码语言是Java,数据库采用Mysql。
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.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.YouxigonglueEntity;
import com.entity.view.YouxigonglueView;import com.service.YouxigonglueService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;/*** 游戏攻略* 后端接口* @author * @email * @date 2021-02-22 15:48:18*/
@RestController
@RequestMapping("/youxigonglue")
public class YouxigonglueController {@Autowiredprivate YouxigonglueService youxigonglueService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,YouxigonglueEntity youxigonglue, HttpServletRequest request){EntityWrapper<YouxigonglueEntity> ew = new EntityWrapper<YouxigonglueEntity>();PageUtils page = youxigonglueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, youxigonglue), params), params));return R.ok().put("data", page);}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,YouxigonglueEntity youxigonglue, HttpServletRequest request){EntityWrapper<YouxigonglueEntity> ew = new EntityWrapper<YouxigonglueEntity>();PageUtils page = youxigonglueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, youxigonglue), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( YouxigonglueEntity youxigonglue){EntityWrapper<YouxigonglueEntity> ew = new EntityWrapper<YouxigonglueEntity>();ew.allEq(MPUtil.allEQMapPre( youxigonglue, "youxigonglue")); return R.ok().put("data", youxigonglueService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(YouxigonglueEntity youxigonglue){EntityWrapper< YouxigonglueEntity> ew = new EntityWrapper< YouxigonglueEntity>();ew.allEq(MPUtil.allEQMapPre( youxigonglue, "youxigonglue")); YouxigonglueView youxigonglueView = youxigonglueService.selectView(ew);return R.ok("查询游戏攻略成功").put("data", youxigonglueView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){YouxigonglueEntity youxigonglue = youxigonglueService.selectById(id);youxigonglue.setClicknum(youxigonglue.getClicknum()+1);youxigonglue.setClicktime(new Date());youxigonglueService.updateById(youxigonglue);return R.ok().put("data", youxigonglue);}/*** 前端详情*/@IgnoreAuth@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){YouxigonglueEntity youxigonglue = youxigonglueService.selectById(id);youxigonglue.setClicknum(youxigonglue.getClicknum()+1);youxigonglue.setClicktime(new Date());youxigonglueService.updateById(youxigonglue);return R.ok().put("data", youxigonglue);}/*** 赞或踩*/@RequestMapping("/thumbsup/{id}")public R thumbsup(@PathVariable("id") String id,String type){YouxigonglueEntity youxigonglue = youxigonglueService.selectById(id);if(type.equals("1")) {youxigonglue.setThumbsupnum(youxigonglue.getThumbsupnum()+1);} else {youxigonglue.setCrazilynum(youxigonglue.getCrazilynum()+1);}youxigonglueService.updateById(youxigonglue);return R.ok();}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody YouxigonglueEntity youxigonglue, HttpServletRequest request){youxigonglue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(youxigonglue);youxigonglueService.insert(youxigonglue);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody YouxigonglueEntity youxigonglue, HttpServletRequest request){youxigonglue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(youxigonglue);youxigonglueService.insert(youxigonglue);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody YouxigonglueEntity youxigonglue, HttpServletRequest request){//ValidatorUtils.validateEntity(youxigonglue);youxigonglueService.updateById(youxigonglue);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){youxigonglueService.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<YouxigonglueEntity> wrapper = new EntityWrapper<YouxigonglueEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}int count = youxigonglueService.selectCount(wrapper);return R.ok().put("count", count);}/*** 前端智能排序*/@IgnoreAuth@RequestMapping("/autoSort")public R autoSort(@RequestParam Map<String, Object> params,YouxigonglueEntity youxigonglue, HttpServletRequest request,String pre){EntityWrapper<YouxigonglueEntity> ew = new EntityWrapper<YouxigonglueEntity>();Map<String, Object> newMap = new HashMap<String, Object>();Map<String, Object> param = new HashMap<String, Object>();Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();while (it.hasNext()) {Map.Entry<String, Object> entry = it.next();String key = entry.getKey();String newKey = entry.getKey();if (pre.endsWith(".")) {newMap.put(pre + newKey, entry.getValue());} else if (StringUtils.isEmpty(pre)) {newMap.put(newKey, entry.getValue());} else {newMap.put(pre + "." + newKey, entry.getValue());}}params.put("sort", "clicknum");params.put("order", "desc");PageUtils page = youxigonglueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, youxigonglue), params), params));return R.ok().put("data", page);}}