作者主页:夜未央5788
?简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
本项目包含管理员与用户两种角色;
管理员角色包含以下功能:
管理员登录,联赛积分榜查询,联赛管理,联赛计分管理,球队战绩查询,球队信息管理,比赛结果管理,比赛结果查询,基础数据管理,用户管理,角色管理,模块管理等功能。
用户角色包含以下功能:
用户登录与注册,联赛积分榜查询,球队战绩查询,比赛结果查询等功能。
环境需要
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项目:是;
技术栈
1. 后端:Spring+SpringMVC+Mybatis
2. 前端:JSP+CSS+JavaScript+jQuery+bootstrap+layui
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入 http://localhost:8080/
运行截图
管理员角色
?
?
?
用户角色?
?
?
?
?
?相关代码
GameController
@Controller
public class GameController {
@Resource
private IFootballGameService fgService = null;
@Resource
private IFootballTeamService ftService = null;
@RequestMapping("view/game")
public ModelAndView toFootballGame(HttpServletRequest request,Model model){
request.setAttribute("teamList", ftService.selectFootballTeamList());
ModelAndView mav = new ModelAndView("view/football_game");
return mav;
}
@RequestMapping("view/showgame")
public ModelAndView toShowFootballGame(HttpServletRequest request,Model model){
ModelAndView mav = new ModelAndView("view/football_showgame");
return mav;
}
@ResponseBody
@RequestMapping(value="view/getGameListJson", method = RequestMethod.GET)
public String getGameListJson(Model model){
List<FootballGame> footballGameList = fgService.selectFootballGameList();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
JSONArray json = new JSONArray();
for(FootballGame footballGame : footballGameList){
JSONObject jo = new JSONObject();
jo.put("gameId", footballGame.getGameId());
jo.put("gameTeamIdFirst", footballGame.getGameTeamIdFirst());
jo.put("gameTeamNameFirst", footballGame.getGameTeamNameFirst());
jo.put("gameTeamIdSecond", footballGame.getGameTeamIdSecond());
jo.put("gameTeamNameSecond", footballGame.getGameTeamNameSecond());
jo.put("firstScore", footballGame.getFirstScore());
jo.put("secondScore", footballGame.getSecondScore());
jo.put("gameStartDate", sdf.format(footballGame.getGameStartDate()));
jo.put("createTime", sdf.format(footballGame.getCreateTime()));
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/saveGame", method = RequestMethod.POST)
public String saveGame(@RequestBody FootballGame footballGame){
if(footballGame.getGameId() == null || "".equals(footballGame.getGameId())){
fgService.insertSelective(footballGame);
}else{
fgService.updateByPrimaryKeySelective(footballGame);
}
return "true";
}
@ResponseBody
@RequestMapping(value="view/deleteGame", method = RequestMethod.POST)
public String deleteGame(@RequestBody FootballGame footballGame){
fgService.deleteByPrimaryKey(footballGame.getGameId());
return "true";
}
}
TeamController
@Controller
public class TeamController {
@Resource
private IFootballTeamService ftService = null;
@RequestMapping("view/team")
public ModelAndView toModule(Model model){
ModelAndView mav = new ModelAndView("view/football_team");
return mav;
}
@ResponseBody
@RequestMapping(value="view/getTeamListJson", method = RequestMethod.GET)
public String getTeamListJson(Model model){
List<FootballTeam> footballLeagueList = ftService.selectFootballTeamList();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
JSONArray json = new JSONArray();
for(FootballTeam footballTeam : footballLeagueList){
JSONObject jo = new JSONObject();
jo.put("teamId", footballTeam.getTeamId());
jo.put("teamName", footballTeam.getTeamName());
jo.put("teamInfo", footballTeam.getTeamInfo());
jo.put("createTime", sdf.format(footballTeam.getCreateTime()));
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/getTeamListJsonByLeagueId", method = RequestMethod.GET)
public String getTeamListJsonByLeagueId(HttpServletRequest request,Model model){
List<Integer> leagueTeamIdList = new ArrayList<Integer>();
if(!"".equals(request.getParameter("leagueId"))){
int leagueId = Integer.parseInt(request.getParameter("leagueId"));
List<FootballTeam> footballTeamByLeagueIdList = ftService.selectTeamListByLeagueId(leagueId);
for(FootballTeam footballTeam : footballTeamByLeagueIdList){
leagueTeamIdList.add(footballTeam.getTeamId());
}
}
List<FootballTeam> footballTeamList = ftService.selectFootballTeamList();
JSONArray json = new JSONArray();
for(FootballTeam footballTeam : footballTeamList){
JSONObject jo = new JSONObject();
jo.put("id", footballTeam.getTeamId());
jo.put("pId", "0");
jo.put("name", footballTeam.getTeamName());
jo.put("open", true);
if(leagueTeamIdList.contains(footballTeam.getTeamId())){
jo.put("checked", true);
}
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/saveTeam", method = RequestMethod.POST)
public String saveLeague(@RequestBody FootballTeam footballTeam){
if(footballTeam.getTeamId() == null || "".equals(footballTeam.getTeamId())){
ftService.insertSelective(footballTeam);
}else{
ftService.updateByPrimaryKeySelective(footballTeam);
}
return "true";
}
@ResponseBody
@RequestMapping(value="view/deleteTeam", method = RequestMethod.POST)
public String deleteTeam(@RequestBody FootballTeam footballTeam){
ftService.deleteByPrimaryKey(footballTeam.getTeamId());
return "true";
}
}
如果也想学习本系统,下面领取。回复:202ssm
|