基于javaweb+mysql的ssm+maven足球联赛管理系统(java+ssm+jsp+bootstrap+layui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven足球联赛管理系统(java+ssm+jsp+bootstrap+layui+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+bootstrap+layui
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入 http://localhost:8080/
@RequestMapping(value="view/saveDict", method = RequestMethod.POST)
public ModelAndView saveDict(@RequestBody SystemDict systemDict){
//System.out.println("接收到提交的保存角色的信息!" + systemRole.getRoleId());
if(systemDict.getDictId() == null){
sdService.insert(systemDict);
}else{
sdService.updateByPrimaryKeySelective(systemDict);
}
ModelAndView mav = new ModelAndView("view/system_dict");
return mav;
}
@ResponseBody
@RequestMapping(value="view/deleteDict", method = RequestMethod.POST)
public ModelAndView deleteDict(@RequestBody SystemDict systemDict){
sdService.deleteByPrimaryKey(systemDict.getDictId());
ModelAndView mav = new ModelAndView("view/system_dict");
return mav;
}
}
@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()));
}
@ResponseBody
@RequestMapping(value="view/saveUser", method = RequestMethod.POST)
public ModelAndView saveRole(@RequestBody SystemUser systemUser){
//System.out.println("接收到提交的保存角色的信息!" + systemRole.getRoleId());
if(systemUser.getUserId() == null){
systemUser.setPassword("123456");
suService.insert(systemUser);
}else{
suService.updateByPrimaryKeySelective(systemUser);
}
ModelAndView mav = new ModelAndView("view/system_user");
return mav;
}
@ResponseBody
@RequestMapping(value="view/deleteUser", method = RequestMethod.POST)
public ModelAndView deleteUser(@RequestBody SystemUser systemUser){
suService.updateByPrimaryKeySelective(systemUser);
ModelAndView mav = new ModelAndView("view/system_user");
return mav;
}
}
@ResponseBody
@RequestMapping(value="view/saveModule", method = RequestMethod.POST)
public ModelAndView saveModule(@RequestBody SystemModule systemModule){
smService.updateByPrimaryKey(systemModule);
ModelAndView mav = new ModelAndView("view/system_module");
return mav;
}
}
@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){
@ResponseBody
@RequestMapping(value="view/saveLeague", method = RequestMethod.POST)
public String saveLeague(@RequestBody FootballLeague footballLeague){
//System.out.println("接收到提交的保存角色的信息!" + systemRole.getRoleId());
if(footballLeague.getLeagueId() == null){
flService.insertSelective(footballLeague);
}else{
flService.updateByPrimaryKeySelective(footballLeague);
}
return "true";
}
@ResponseBody
@RequestMapping(value="view/deleteLeague", method = RequestMethod.POST)
public String deleteLeague(@RequestBody FootballLeague footballLeague){
flService.deleteByPrimaryKey(footballLeague.getLeagueId());
return "true";
}
}
@Controller
public class RoleController {
@Resource
private ISystemRoleService srService;
@RequestMapping("view/role")
}
@ResponseBody
@RequestMapping(value="view/saveRole", method = RequestMethod.POST)
public ModelAndView saveRole(@RequestBody SystemRole systemRole){
//System.out.println("接收到提交的保存角色的信息!" + systemRole.getRoleId());
if(systemRole.getRoleId() == null){
srService.insert(systemRole);
}else{
srService.updateByPrimaryKey(systemRole);
}
ModelAndView mav = new ModelAndView("view/system_role");
return mav;
}
@ResponseBody
@RequestMapping(value="view/deleteRole", method = RequestMethod.POST)
public ModelAndView deleteRole(@RequestBody SystemRole systemRole){
srService.updateByPrimaryKey(systemRole);
ModelAndView mav = new ModelAndView("view/system_role");
return mav;
}
}
suService.insertSelective(systemUser);
HttpSession session = request.getSession();
session.setMaxInactiveInterval(3600);
session.setAttribute("user", systemUser);
return "true";
}else{
return "false";
}
}
@RequestMapping("view/index")
public String toIndex(HttpServletRequest request,Model model){
HttpSession session = request.getSession();
if(session == null){
return "view/login";
}else{
SystemUser systemUser = (SystemUser)session.getAttribute("user");
if(systemUser == null){
return "view/login";
}
else{
int roleId = systemUser.getRoleId();
request.setAttribute("moduleList", smService.selectSystemModuleListByRoleId(roleId));
return "view/index";
}
}
}
}
if(!"".equals(request.getParameter("roleId"))){
int roleId = Integer.parseInt(request.getParameter("roleId"));
List<SystemModule> systemRoleIdModuleList = smService.selectSystemModuleListByRoleId(roleId);
for(SystemModule systemModule : systemRoleIdModuleList){
roleModuleIdList.add(systemModule.getModuleId());
}
}
List<SystemModule> systemModuleList = smService.selectSystemModuleList();
JSONArray json = new JSONArray();
for(SystemModule systemModule : systemModuleList){
SystemModule pModule = null;
String pName = "根节点";
if(systemModule.getParentId() != 1){
pModule = smService.selectByPrimaryKey(systemModule.getParentId());
pName = pModule.getModuleName();
}
JSONObject jo = new JSONObject();
jo.put("id", systemModule.getModuleId());
jo.put("pId", systemModule.getParentId());
jo.put("name", systemModule.getModuleName());
jo.put("curUrl", systemModule.getModuleUrl());
jo.put("isEnable", systemModule.getIsEnable());
jo.put("pName", pName);
jo.put("open", true);
if(roleModuleIdList.contains(systemModule.getModuleId())){
jo.put("checked", true);
}
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/saveModule", method = RequestMethod.POST)
public ModelAndView saveModule(@RequestBody SystemModule systemModule){
smService.updateByPrimaryKey(systemModule);
ModelAndView mav = new ModelAndView("view/system_module");
return mav;
}
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);
public String saveLeagueTeamList(@RequestBody List<FootballTeamLeague> footballTeamLeagueList){
ftlService.deleteByLeagueId(footballTeamLeagueList.get(0).getLeagueId());
for(FootballTeamLeague footballTeamLeague: footballTeamLeagueList){
ftlService.insertSelective(footballTeamLeague);
}
return "true";
}
@ResponseBody
@RequestMapping(value="view/getTeamLeagueListJson", method = RequestMethod.GET)
public List<FootballTeamLeague> getTeamLeagueListJson(Model model){
List<FootballTeamLeague> footballTeamLeagueList = ftlService.selectFootballTeamLeagueList();
return footballTeamLeagueList;
}
@ResponseBody
@RequestMapping(value="view/saveScore", method = RequestMethod.POST)
public String saveScore(@RequestBody FootballTeamLeague footballTeamLeague){
ftlService.updateByPrimaryKeySelective(footballTeamLeague);
return "true";
}
}
@Controller
@RequestMapping(value="view/getDictTypeListJson", method = RequestMethod.GET)
public String getDictTypeListJson(Model model){
List<SystemDict> systemDictList = sdService.selectSystemDictTypeList();
JSONArray json = new JSONArray();
for(SystemDict systemDict : systemDictList){
JSONObject jo = new JSONObject();
jo.put("id", systemDict.getDictId());
jo.put("pId", 0);
jo.put("typeName", systemDict.getDictTypeName());
jo.put("name", systemDict.getDictInfo());
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/getDictListJsonByDictTypeName", method = RequestMethod.GET)
public String getDictListJsonByDictTypeName(HttpServletRequest request,Model model){
String dictTypeName = request.getParameter("dictTypeName");
List<SystemDict> systemDictList = null;
if(dictTypeName != null){
systemDictList = sdService.selectSystemDictListByTypeName(dictTypeName);
}else{
systemDictList = sdService.selectSystemDictList();
}
JSONArray json = new JSONArray();
for(SystemDict systemDict : systemDictList){
JSONObject jo = new JSONObject();
jo.put("dictId", systemDict.getDictId());
jo.put("dictTypeName", systemDict.getDictTypeName());
jo.put("dictValue", systemDict.getDictValue());
jo.put("dictInfo", systemDict.getDictInfo());
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/saveDict", method = RequestMethod.POST)
public ModelAndView saveDict(@RequestBody SystemDict systemDict){
}else{
sdService.updateByPrimaryKeySelective(systemDict);
}
ModelAndView mav = new ModelAndView("view/system_dict");
return mav;
}
@ResponseBody
@RequestMapping(value="view/deleteDict", method = RequestMethod.POST)
public ModelAndView deleteDict(@RequestBody SystemDict systemDict){
sdService.deleteByPrimaryKey(systemDict.getDictId());
ModelAndView mav = new ModelAndView("view/system_dict");
return mav;
}
}
}
@Controller
public class TeamLeagueController {
@Resource
private IFootballTeamLeagueService ftlService = null;
@RequestMapping("view/showscore")
public ModelAndView toShowScore(Model model){
ModelAndView mav = new ModelAndView("view/football_showscore");
return mav;
}
@RequestMapping("view/score")
public ModelAndView toScore(Model model){
ModelAndView mav = new ModelAndView("view/football_score");
return mav;
}
@ResponseBody
@RequestMapping(value="view/saveLeagueTeamList", method = RequestMethod.POST)
public String saveLeagueTeamList(@RequestBody List<FootballTeamLeague> footballTeamLeagueList){
@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";
}
}
@Controller
public class DictController {
@Resource
private ISystemDictService sdService;
@RequestMapping("view/dict")
public ModelAndView toModule(Model model){
@Controller
public class LeagueController {
@Resource
private IFootballLeagueService flService;
@RequestMapping("view/league")
public ModelAndView toModule(Model model){
ModelAndView mav = new ModelAndView("view/football_league");
return mav;
}
@ResponseBody
@RequestMapping(value="view/getLeagueListJson", method = RequestMethod.GET)
public String getLeagueListJson(Model model){
List<FootballLeague> footballLeagueList = flService.selectFootballLeagueList();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
JSONArray json = new JSONArray();
for(FootballLeague footballLeague : footballLeagueList){
JSONObject jo = new JSONObject();
jo.put("leagueId", footballLeague.getLeagueId());
jo.put("leagueName", footballLeague.getLeagueName());
jo.put("leaguePeriod", footballLeague.getLeaguePeriod());
jo.put("leaguePrincipal", footballLeague.getLeaguePrincipal());
jo.put("leagueInfo", footballLeague.getLeagueInfo());
jo.put("leagueStatus", footballLeague.getLeagueStatus());
jo.put("createTime", sdf.format(footballLeague.getCreateTime()));
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/saveLeague", method = RequestMethod.POST)
public String saveLeague(@RequestBody FootballLeague footballLeague){
//System.out.println("接收到提交的保存角色的信息!" + systemRole.getRoleId());
if(footballLeague.getLeagueId() == null){
flService.insertSelective(footballLeague);
}else{
flService.updateByPrimaryKeySelective(footballLeague);
}
return "true";
}
@ResponseBody
@RequestMapping(value="view/deleteLeague", method = RequestMethod.POST)
public String deleteLeague(@RequestBody FootballLeague footballLeague){
flService.deleteByPrimaryKey(footballLeague.getLeagueId());
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";
}
}
@Controller
public class UserController {
@Controller
public class RoleModuleController {
@Resource
private ISystemRoleModuleService smrService = null;
@ResponseBody
@RequestMapping(value="view/saveRoleModule", method = RequestMethod.POST)
public ModelAndView saveRoleModule(@RequestBody List<SystemRoleModuleKey> systemRoleModuleKeyList){
smrService.deleteByRoleId(systemRoleModuleKeyList.get(0).getRoleId());
//System.out.println("接收到提交的保存角色的信息!" + systemRoleModuleKeyList);
for(Iterator<SystemRoleModuleKey> srmIter = systemRoleModuleKeyList.iterator(); srmIter.hasNext();){
SystemRoleModuleKey systemRoleModuleKey= srmIter.next();
smrService.insert(systemRoleModuleKey);
}
ModelAndView mav = new ModelAndView("view/role");
return mav;
}
}
public class UserInterceptor implements HandlerInterceptor {
//拦截前处理
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {
Object sessionObj = request.getSession().getAttribute("user");
String uri = request.getRequestURI();