作者主页:编程指南针
作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师
主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助
文末获取源码
本次设计开发的这套台球厅计时收费系统,主要基于SSM框架开发实现,前端结合JSP和Bootstrap来开发实现,系统主要实现为台球厅运营方提供一个计时收费的核心业务系统,主要包含三类用户:系统管理员,普通管理员,会员
系统管理员具有的功能: 可以管理所有的功能
普通管理员具有的功能: 主要进行业务管理
会员用户登陆:主要实现在线订桌和付费
语言环境:Java: jdk1.8
数据库:Mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
开发技术:SSM框架+JSP+JQUERY+Bootstrap
用户管理
package com.controller;
import com.entity.Yuangong;
import com.server.YuangongServer;
import com.util.PageBean;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 员工信息管理
*/
@Controller
public class YuangongController {
@Resource
private YuangongServer yuangongService;
/**
* 员工添加
* @param request
* @param yuangong
* @param session
* @return
* @throws SQLException
*/
@RequestMapping("addYuangong.do")
public String addYuangong(HttpServletRequest request,Yuangong yuangong,HttpSession session) throws SQLException{
Timestamp time=new Timestamp(System.currentTimeMillis());
yuangongService.add(yuangong);
session.setAttribute("backxx", "添加成功");
session.setAttribute("backurl", request.getHeader("Referer"));
return "redirect:postback.jsp";
//return "redirect:yonghuzhuceList.do";
}
/**
* 编辑员工
* @param id
* @param map
* @param yuangong
* @return
*/
@RequestMapping("doUpdateYuangong.do")
public String doUpdateYuangong(int id,ModelMap map,Yuangong yuangong){
yuangong=yuangongService.getById(id);
map.put("yuangong", yuangong);
return "yuangong_updt";
}
/**
* 查看员工信息
* @param id
* @param map
* @param yuangong
* @return
*/
@RequestMapping("yuangongDetail.do")
public String yuangongDetail(int id,ModelMap map,Yuangong yuangong){
yuangong=yuangongService.getById(id);
map.put("yuangong", yuangong);
return "yuangong_detail";
}
/**
* 编辑员工页面跳转
* @param id
* @param map
* @param yuangong
* @param request
* @param session
* @return
*/
@RequestMapping("updateYuangong.do")
public String updateYuangong(int id,ModelMap map,Yuangong yuangong,HttpServletRequest request,HttpSession session){
yuangongService.update(yuangong);
session.setAttribute("backxx", "修改成功");
session.setAttribute("backurl", request.getHeader("Referer"));
return "redirect:postback.jsp";
}
/**
* 分页查询员工信息
* @param page
* @param map
* @param session
* @param yuangong
* @param name
* @param mobile
* @return
*/
@RequestMapping("yuangongxinxiList.do")
public String yuangongxinxiList(@RequestParam(value="page",required=false)String page,
ModelMap map,HttpSession session,Yuangong yuangong, String name, String mobile){
if(page==null||page.equals("")){
page="1";
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 5);
Map pmap=new HashMap();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", 5);
if(name==null||name.equals("")){pmap.put("name", null);}else{pmap.put("name", name);}
if(mobile==null||mobile.equals("")){pmap.put("mobile", null);}else{pmap.put("mobile", mobile);}
int total=yuangongService.getCount(pmap);
pageBean.setTotal(total);
List list=yuangongService.getByPage(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 1);
return "yuangong_list";
}
/**
* 删除员工信息
* @param id
* @param request
* @return
*/
@RequestMapping("deleteYuangong.do")
public String deleteYuangong(int id,HttpServletRequest request){
yuangongService.delete(id);
String url = request.getHeader("Referer");
return "redirect:"+url;
}
}
订桌信息管理
package com.controller;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.PrintWriter;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import com.entity.Dingzhuoxinxi;
import com.server.DingzhuoxinxiServer;
import com.util.PageBean;
import net.sf.json.JSONObject;
import com.util.db;
import java.sql.SQLException;
import java.sql.*;
/**
* 订桌信息管理
*/
@Controller
public class DingzhuoxinxiController {
@Resource
private DingzhuoxinxiServer dingzhuoxinxiService;
@RequestMapping("addDingzhuoxinxi.do")
public String addDingzhuoxinxi(HttpServletRequest request,Dingzhuoxinxi dingzhuoxinxi,HttpSession session) throws SQLException{
Timestamp time=new Timestamp(System.currentTimeMillis());
dingzhuoxinxi.setAddtime(time.toString().substring(0, 19));
dingzhuoxinxiService.add(dingzhuoxinxi);
String sql="";
sql="update qiuzhuoxinxi set zhuangtai='已订' where qiuzhuohao='"+dingzhuoxinxi.getQiuzhuohao()+"'";
db dbo = new db();
dbo.hsgexecute(sql);
session.setAttribute("backxx", "添加成功");
session.setAttribute("backurl", request.getHeader("Referer"));
//session.setAttribute("backurl", "dingzhuoxinxiList.do");
return "redirect:postback.jsp";
//return "redirect:dingzhuoxinxiList.do";
}
// 处理编辑
@RequestMapping("doUpdateDingzhuoxinxi.do")
public String doUpdateDingzhuoxinxi(int id,ModelMap map,Dingzhuoxinxi dingzhuoxinxi){
dingzhuoxinxi=dingzhuoxinxiService.getById(id);
map.put("dingzhuoxinxi", dingzhuoxinxi);
return "dingzhuoxinxi_updt";
}
// 后台详细
@RequestMapping("dingzhuoxinxiDetail.do")
public String dingzhuoxinxiDetail(int id,ModelMap map,Dingzhuoxinxi dingzhuoxinxi){
dingzhuoxinxi=dingzhuoxinxiService.getById(id);
map.put("dingzhuoxinxi", dingzhuoxinxi);
return "dingzhuoxinxi_detail";
}
// 前台详细
@RequestMapping("dzxxDetail.do")
public String dzxxDetail(int id,ModelMap map,Dingzhuoxinxi dingzhuoxinxi){
dingzhuoxinxi=dingzhuoxinxiService.getById(id);
map.put("dingzhuoxinxi", dingzhuoxinxi);
return "dingzhuoxinxidetail";
}
//
@RequestMapping("updateDingzhuoxinxi.do")
public String updateDingzhuoxinxi(int id,ModelMap map,Dingzhuoxinxi dingzhuoxinxi,HttpServletRequest request,HttpSession session){
dingzhuoxinxiService.update(dingzhuoxinxi);
session.setAttribute("backxx", "修改成功");
session.setAttribute("backurl", request.getHeader("Referer"));
return "redirect:postback.jsp";
//String url = request.getHeader("Referer");
//return "redirect:"+url;
//return "redirect:dingzhuoxinxiList.do";
}
// 分页查询
@RequestMapping("dingzhuoxinxiList.do")
public String dingzhuoxinxiList(@RequestParam(value="page",required=false)String page,
ModelMap map,HttpSession session,Dingzhuoxinxi dingzhuoxinxi, String qiuzhuohao, String meixiaoshijifei1,String meixiaoshijifei2, String dingzhuoshijian, String huiyuanbianhao, String xingming, String huiyuandengji, String zhekou, String beizhu){
if(page==null||page.equals("")){
page="1";
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
Map pmap=new HashMap();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", 15);
if(qiuzhuohao==null||qiuzhuohao.equals("")){pmap.put("qiuzhuohao", null);}else{pmap.put("qiuzhuohao", qiuzhuohao);}
if(meixiaoshijifei1==null||meixiaoshijifei1.equals("")){pmap.put("meixiaoshijifei1", null);}else{pmap.put("meixiaoshijifei1", meixiaoshijifei1);}
if(meixiaoshijifei2==null||meixiaoshijifei2.equals("")){pmap.put("meixiaoshijifei2", null);}else{pmap.put("meixiaoshijifei2", meixiaoshijifei2);}
if(dingzhuoshijian==null||dingzhuoshijian.equals("")){pmap.put("dingzhuoshijian", null);}else{pmap.put("dingzhuoshijian", dingzhuoshijian);}
if(huiyuanbianhao==null||huiyuanbianhao.equals("")){pmap.put("huiyuanbianhao", null);}else{pmap.put("huiyuanbianhao", huiyuanbianhao);}
if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}
if(huiyuandengji==null||huiyuandengji.equals("")){pmap.put("huiyuandengji", null);}else{pmap.put("huiyuandengji", huiyuandengji);}
if(zhekou==null||zhekou.equals("")){pmap.put("zhekou", null);}else{pmap.put("zhekou", zhekou);}
if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}
int total=dingzhuoxinxiService.getCount(pmap);
pageBean.setTotal(total);
List list=dingzhuoxinxiService.getByPage(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 1);
return "dingzhuoxinxi_list";
}
@RequestMapping("dingzhuoxinxiList2.do")
public String dingzhuoxinxiList2(@RequestParam(value="page",required=false)String page,
ModelMap map,HttpSession session,Dingzhuoxinxi dingzhuoxinxi, String qiuzhuohao, String meixiaoshijifei1,String meixiaoshijifei2, String dingzhuoshijian, String huiyuanbianhao, String xingming, String huiyuandengji, String zhekou, String beizhu,HttpServletRequest request){
/*if(session.getAttribute("user")==null){
return "login";
}*/
if(page==null||page.equals("")){
page="1";
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
Map pmap=new HashMap();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", 15);
pmap.put("huiyuanbianhao", (String)request.getSession().getAttribute("username"));
if(qiuzhuohao==null||qiuzhuohao.equals("")){pmap.put("qiuzhuohao", null);}else{pmap.put("qiuzhuohao", qiuzhuohao);}
if(meixiaoshijifei1==null||meixiaoshijifei1.equals("")){pmap.put("meixiaoshijifei1", null);}else{pmap.put("meixiaoshijifei1", meixiaoshijifei1);}
if(meixiaoshijifei2==null||meixiaoshijifei2.equals("")){pmap.put("meixiaoshijifei2", null);}else{pmap.put("meixiaoshijifei2", meixiaoshijifei2);}
if(dingzhuoshijian==null||dingzhuoshijian.equals("")){pmap.put("dingzhuoshijian", null);}else{pmap.put("dingzhuoshijian", dingzhuoshijian);}
if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}
if(huiyuandengji==null||huiyuandengji.equals("")){pmap.put("huiyuandengji", null);}else{pmap.put("huiyuandengji", huiyuandengji);}
if(zhekou==null||zhekou.equals("")){pmap.put("zhekou", null);}else{pmap.put("zhekou", zhekou);}
if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}
int total=dingzhuoxinxiService.getCount(pmap);
pageBean.setTotal(total);
List list=dingzhuoxinxiService.getByPage(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 1);
return "dingzhuoxinxi_list2";
}
@RequestMapping("dzxxList.do")
public String dzxxList(@RequestParam(value="page",required=false)String page,
ModelMap map,HttpSession session,Dingzhuoxinxi dingzhuoxinxi, String qiuzhuohao, String meixiaoshijifei1,String meixiaoshijifei2, String dingzhuoshijian, String huiyuanbianhao, String xingming, String huiyuandengji, String zhekou, String beizhu){
if(page==null||page.equals("")){
page="1";
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
Map pmap=new HashMap();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", 15);
if(qiuzhuohao==null||qiuzhuohao.equals("")){pmap.put("qiuzhuohao", null);}else{pmap.put("qiuzhuohao", qiuzhuohao);}
if(meixiaoshijifei1==null||meixiaoshijifei1.equals("")){pmap.put("meixiaoshijifei1", null);}else{pmap.put("meixiaoshijifei1", meixiaoshijifei1);}
if(meixiaoshijifei2==null||meixiaoshijifei2.equals("")){pmap.put("meixiaoshijifei2", null);}else{pmap.put("meixiaoshijifei2", meixiaoshijifei2);}
if(dingzhuoshijian==null||dingzhuoshijian.equals("")){pmap.put("dingzhuoshijian", null);}else{pmap.put("dingzhuoshijian", dingzhuoshijian);}
if(huiyuanbianhao==null||huiyuanbianhao.equals("")){pmap.put("huiyuanbianhao", null);}else{pmap.put("huiyuanbianhao", huiyuanbianhao);}
if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}
if(huiyuandengji==null||huiyuandengji.equals("")){pmap.put("huiyuandengji", null);}else{pmap.put("huiyuandengji", huiyuandengji);}
if(zhekou==null||zhekou.equals("")){pmap.put("zhekou", null);}else{pmap.put("zhekou", zhekou);}
if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}
int total=dingzhuoxinxiService.getCount(pmap);
pageBean.setTotal(total);
List list=dingzhuoxinxiService.getByPage(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 1);
return "dingzhuoxinxilist";
}
@RequestMapping("deleteDingzhuoxinxi.do")
public String deleteDingzhuoxinxi(int id,HttpServletRequest request){
dingzhuoxinxiService.delete(id);
String url = request.getHeader("Referer");
return "redirect:"+url;
//return "redirect:dingzhuoxinxiList.do";
}
}
球桌信息管理
package com.controller;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.PrintWriter;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import com.entity.Qiuzhuoxinxi;
import com.server.QiuzhuoxinxiServer;
import com.util.PageBean;
import net.sf.json.JSONObject;
import com.util.db;
import java.sql.SQLException;
import java.sql.*;
/**
* 球桌信息管理
*/
@Controller
public class QiuzhuoxinxiController {
@Resource
private QiuzhuoxinxiServer qiuzhuoxinxiService;
@RequestMapping("addQiuzhuoxinxi.do")
public String addQiuzhuoxinxi(HttpServletRequest request,Qiuzhuoxinxi qiuzhuoxinxi,HttpSession session) throws SQLException{
Timestamp time=new Timestamp(System.currentTimeMillis());
qiuzhuoxinxi.setAddtime(time.toString().substring(0, 19));
qiuzhuoxinxiService.add(qiuzhuoxinxi);
session.setAttribute("backxx", "添加成功");
session.setAttribute("backurl", request.getHeader("Referer"));
//session.setAttribute("backurl", "qiuzhuoxinxiList.do");
return "redirect:postback.jsp";
//return "redirect:qiuzhuoxinxiList.do";
}
// 处理编辑
@RequestMapping("doUpdateQiuzhuoxinxi.do")
public String doUpdateQiuzhuoxinxi(int id,ModelMap map,Qiuzhuoxinxi qiuzhuoxinxi){
qiuzhuoxinxi=qiuzhuoxinxiService.getById(id);
map.put("qiuzhuoxinxi", qiuzhuoxinxi);
return "qiuzhuoxinxi_updt";
}
// 后台详细
@RequestMapping("qiuzhuoxinxiDetail.do")
public String qiuzhuoxinxiDetail(int id,ModelMap map,Qiuzhuoxinxi qiuzhuoxinxi){
qiuzhuoxinxi=qiuzhuoxinxiService.getById(id);
map.put("qiuzhuoxinxi", qiuzhuoxinxi);
return "qiuzhuoxinxi_detail";
}
// 前台详细
@RequestMapping("qzxxDetail.do")
public String qzxxDetail(int id,ModelMap map,Qiuzhuoxinxi qiuzhuoxinxi){
qiuzhuoxinxi=qiuzhuoxinxiService.getById(id);
map.put("qiuzhuoxinxi", qiuzhuoxinxi);
return "qiuzhuoxinxidetail";
}
//
@RequestMapping("updateQiuzhuoxinxi.do")
public String updateQiuzhuoxinxi(int id,ModelMap map,Qiuzhuoxinxi qiuzhuoxinxi,HttpServletRequest request,HttpSession session){
qiuzhuoxinxiService.update(qiuzhuoxinxi);
session.setAttribute("backxx", "修改成功");
session.setAttribute("backurl", request.getHeader("Referer"));
return "redirect:postback.jsp";
//String url = request.getHeader("Referer");
//return "redirect:"+url;
//return "redirect:qiuzhuoxinxiList.do";
}
// 分页查询
@RequestMapping("qiuzhuoxinxiList.do")
public String qiuzhuoxinxiList(@RequestParam(value="page",required=false)String page,
ModelMap map,HttpSession session,Qiuzhuoxinxi qiuzhuoxinxi, String qiuzhuohao, String zhuangtai, String meixiaoshijifei, String beizhu){
if(page==null||page.equals("")){
page="1";
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
Map pmap=new HashMap();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", 15);
if(qiuzhuohao==null||qiuzhuohao.equals("")){pmap.put("qiuzhuohao", null);}else{pmap.put("qiuzhuohao", qiuzhuohao);}
if(zhuangtai==null||zhuangtai.equals("")){pmap.put("zhuangtai", null);}else{pmap.put("zhuangtai", zhuangtai);}
if(meixiaoshijifei==null||meixiaoshijifei.equals("")){pmap.put("meixiaoshijifei", null);}else{pmap.put("meixiaoshijifei", meixiaoshijifei);}
if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}
int total=qiuzhuoxinxiService.getCount(pmap);
pageBean.setTotal(total);
List list=qiuzhuoxinxiService.getByPage(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 1);
return "qiuzhuoxinxi_list";
}
@RequestMapping("qzxxList.do")
public String qzxxList(@RequestParam(value="page",required=false)String page,
ModelMap map,HttpSession session,Qiuzhuoxinxi qiuzhuoxinxi, String qiuzhuohao, String zhuangtai, String meixiaoshijifei, String beizhu){
if(page==null||page.equals("")){
page="1";
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
Map pmap=new HashMap();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", 15);
if(qiuzhuohao==null||qiuzhuohao.equals("")){pmap.put("qiuzhuohao", null);}else{pmap.put("qiuzhuohao", qiuzhuohao);}
if(zhuangtai==null||zhuangtai.equals("")){pmap.put("zhuangtai", null);}else{pmap.put("zhuangtai", zhuangtai);}
if(meixiaoshijifei==null||meixiaoshijifei.equals("")){pmap.put("meixiaoshijifei", null);}else{pmap.put("meixiaoshijifei", meixiaoshijifei);}
if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}
int total=qiuzhuoxinxiService.getCount(pmap);
pageBean.setTotal(total);
List list=qiuzhuoxinxiService.getByPage(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 1);
return "qiuzhuoxinxilist";
}
@RequestMapping("qiuzhuoxinxiList2.do")
public String qiuzhuoxinxiList2(@RequestParam(value="page",required=false)String page,
ModelMap map,HttpSession session,Qiuzhuoxinxi qiuzhuoxinxi, String qiuzhuohao, String zhuangtai, String meixiaoshijifei, String beizhu){
if(page==null||page.equals("")){
page="1";
}
PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
Map pmap=new HashMap();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", 15);
if(qiuzhuohao==null||qiuzhuohao.equals("")){pmap.put("qiuzhuohao", null);}else{pmap.put("qiuzhuohao", qiuzhuohao);}
if(zhuangtai==null||zhuangtai.equals("")){pmap.put("zhuangtai", null);}else{pmap.put("zhuangtai", zhuangtai);}
if(meixiaoshijifei==null||meixiaoshijifei.equals("")){pmap.put("meixiaoshijifei", null);}else{pmap.put("meixiaoshijifei", meixiaoshijifei);}
if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}
int total=qiuzhuoxinxiService.getCount(pmap);
pageBean.setTotal(total);
List list=qiuzhuoxinxiService.getByPage(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 1);
return "qiuzhuoxinxi_list2";
}
@RequestMapping("deleteQiuzhuoxinxi.do")
public String deleteQiuzhuoxinxi(int id,HttpServletRequest request){
qiuzhuoxinxiService.delete(id);
String url = request.getHeader("Referer");
return "redirect:"+url;
//return "redirect:qiuzhuoxinxiList.do";
}
}
本项目整体功能完整,用户角色齐全,符合实际运行要求,界面简洁大方,操作方便,人机交互较好,用户很容易适应系统的基本操作,可以作为毕业设计或课程设计使用。