基于javaweb+mysql的ssm美容院预约管理系统(java+ssm+jsp+jquery+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM美容院预约管理系统(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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;
技术栈
-
后端:SpringBoot
-
前端:JSP+CSS+JavaScript+jQuery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
int maxPage = pageNumber;
if (maxPage % 12 == 0) {
maxPage = maxPage / 12;
} else {
maxPage = maxPage / 12 + 1;
}
if (number == null) {
number = "0";
}
int start = Integer.parseInt(number) * 12;
int over = (Integer.parseInt(number) + 1) * 12;
int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; i++) {
Jiancai x = tempList.get(i);
flimList.add(x);
}
String html = "";
StringBuffer buffer = new StringBuffer();
buffer.append(" 共为");
buffer.append(maxPage);
buffer.append("页 共有");
buffer.append(pageNumber);
buffer.append("条 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"index/hot.action?number=0\">首页</a>");
}
buffer.append(" ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"index/hot.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");
}
buffer.append(" ");
// 按主键查询数据
@RequestMapping("getCateById.action")
public String getCateById(String id) {
Cate cate = this.cateService.getCateById(id);
this.getRequest().setAttribute("cate", cate);
return "admin/editcate";
}
public CateService getCateService() {
return cateService;
}
public void setCateService(CateService cateService) {
this.cateService = cateService;
}
}
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/city", produces = "text/plain;charset=utf-8")
public class CityAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private CityService cityService;
// 准备添加数据
@RequestMapping("createCity.action")
public String createCity() {
return "admin/addcity";
}
// 添加数据
@RequestMapping("addCity.action")
public String addCity(City city) {
this.cityService.insertCity(city);
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/cate", produces = "text/plain;charset=utf-8")
public class CateAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private CateService cateService;
// 准备添加数据
@RequestMapping("createCate.action")
public String createCate() {
return "admin/addcate";
}
// 添加数据
@RequestMapping("addCate.action")
public String addCate(Cate cate) {
cate.setAddtime(VeDate.getStringDateShort());
this.cateService.insertCate(cate);
return "redirect:/cate/createCate.action";
}
// 通过主键删除数据
@RequestMapping("deleteCate.action")
public String deleteCate(String id) {
this.cateService.deleteCate(id);
return "redirect:/cate/getAllCate.action";
}
// 批量删除数据
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/topic" , produces = "text/plain;charset=utf-8")
public class TopicAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private TopicService topicService;
@Autowired
@Resource
private UsersService usersService;
@Autowired
@Resource
private JiancaiService jiancaiService;
// 准备添加数据
@RequestMapping("createTopic.action")
public String createTopic() {
List<Users> usersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
this.getRequest().setAttribute("jiancaiList", jiancaiList);
return "admin/addtopic";
}
// 添加数据
@RequestMapping("addTopic.action")
public String addTopic(Topic topic) {
this.topicService.insertTopic(topic);
return "redirect:/topic/createTopic.action";
}
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.adminService.getAdminByLike(admin), "admin", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryadmin";
}
// 按主键查询数据
@RequestMapping("getAdminById.action")
public String getAdminById(String id) {
Admin admin = this.adminService.getAdminById(id);
this.getRequest().setAttribute("admin", admin);
return "admin/editadmin";
}
public AdminService getAdminService() {
return adminService;
}
public void setAdminService(AdminService adminService) {
this.adminService = adminService;
}
}
this.topicService.deleteTopic(topicid);
}
return "redirect:/topic/getAllTopic.action";
}
// 更新数据
@RequestMapping("updateTopic.action")
public String updateTopic(Topic topic) {
this.topicService.updateTopic(topic);
return "redirect:/topic/getAllTopic.action";
}
// 显示全部数据
@RequestMapping("getAllTopic.action")
public String getAllTopic(String number) {
List<Topic> topicList = this.topicService.getAllTopic();
PageHelper.getPage(topicList, "topic", null, null, 10, number, this.getRequest(), null);
return "admin/listtopic";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryTopicByCond.action")
public String queryTopicByCond(String cond, String name, String number) {
Topic topic = new Topic();
if(cond != null){
if ("username".equals(cond)) {
topic.setUsername(name);
}
if ("jiancainame".equals(cond)) {
topic.setJiancainame(name);
}
if ("num".equals(cond)) {
topic.setNum(name);
}
if ("contents".equals(cond)) {
topic.setContents(name);
}
if ("addtime".equals(cond)) {
topic.setAddtime(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
buffer.append("首页");
} else {
buffer.append("<a href=\"index/article.action?number=0\">首页</a>");
}
buffer.append(" ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("下一页");
} else {
buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("尾页");
} else {
buffer.append("<a href=\"index/article.action?number=" + (maxPage - 1) + "\">尾页</a>");
}
html = buffer.toString();
this.getRequest().setAttribute("html", html);
this.getRequest().setAttribute("articleList", articleList);
return "users/article";
}
// 阅读公告
@RequestMapping("read.action")
public String read(String id) {
this.front();
Article article = this.articleService.getArticleById(id);
article.setHits("" + (Integer.parseInt(article.getHits()) + 1));
this.articleService.updateArticle(article);
this.getRequest().setAttribute("article", article);
return "users/read";
}
// 准备登录
@RequestMapping("preLogin.action")
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/peihuo", produces = "text/plain;charset=utf-8")
public class PeihuoAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private PeihuoService peihuoService;
@Autowired
@Resource
private CityService cityService;
// 准备添加数据
@RequestMapping("createPeihuo.action")
public String createPeihuo() {
List<City> cityList = this.cityService.getAllCity();
this.getRequest().setAttribute("cityList", cityList);
return "admin/addpeihuo";
}
// 添加数据
@RequestMapping("addPeihuo.action")
public String addPeihuo(Peihuo peihuo) {
this.peihuoService.insertPeihuo(peihuo);
return "redirect:/peihuo/createPeihuo.action";
}
// 通过主键删除数据
@RequestMapping("deletePeihuo.action")
public String deletePeihuo(String id) {
this.peihuoService.deletePeihuo(id);
return "redirect:/peihuo/getAllPeihuo.action";
}
// 批量删除数据
@RequestMapping("deletePeihuoByIds.action")
public String deletePeihuoByIds() {
String[] ids = this.getRequest().getParameterValues("peihuoid");
for (String peihuoid : ids) {
this.peihuoService.deletePeihuo(peihuoid);
}
return "redirect:/peihuo/getAllPeihuo.action";
}
private CateService cateService;
@Autowired
@Resource
private CityService cityService;
@Autowired
@Resource
private PeihuoService peihuoService;
@Autowired
@Resource
private JiancaiService jiancaiService;
@Autowired
@Resource
private CartService cartService;
@Autowired
@Resource
private OrdersService ordersService;
@Autowired
@Resource
private DetailsService detailsService;
@Autowired
@Resource
private TopicService topicService;
// 公共方法 提供公共查询数据
private void front() {
this.getRequest().setAttribute("title", "优品美容项目网-力作中国最大的美容项目网站");
List<Cate> cateList = this.cateService.getAllCate();
this.getRequest().setAttribute("cateList", cateList);
List<Jiancai> hotList = this.jiancaiService.getJiancaiByHot();
Collections.shuffle(hotList);
this.getRequest().setAttribute("hotList", hotList);
}
// 首页显示
@RequestMapping("index.action")
public String index() {
this.front();
List<Cate> cateList = this.cateService.getCateFront();
List<Cate> frontList = new ArrayList<Cate>();
for (Cate cate : cateList) {
List<Jiancai> flimList = this.jiancaiService.getJiancaiByCate(cate.getCateid());
cate.setFlimList(flimList);
frontList.add(cate);
}
this.getRequest().setAttribute("frontList", frontList);
return "users/index";
}
// 首页显示
@RequestMapping("network.action")
public String network() {
this.front();
@Resource
private JiancaiService jiancaiService;
// 准备添加数据
@RequestMapping("createTopic.action")
public String createTopic() {
List<Users> usersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
this.getRequest().setAttribute("jiancaiList", jiancaiList);
return "admin/addtopic";
}
// 添加数据
@RequestMapping("addTopic.action")
public String addTopic(Topic topic) {
this.topicService.insertTopic(topic);
return "redirect:/topic/createTopic.action";
}
// 通过主键删除数据
@RequestMapping("deleteTopic.action")
public String deleteTopic(String id) {
this.topicService.deleteTopic(id);
return "redirect:/topic/getAllTopic.action";
}
// 批量删除数据
@RequestMapping("deleteTopicByIds.action")
public String deleteTopicByIds() {
String[] ids = this.getRequest().getParameterValues("topicid");
for (String topicid : ids) {
this.topicService.deleteTopic(topicid);
}
return "redirect:/topic/getAllTopic.action";
}
// 更新数据
@RequestMapping("updateTopic.action")
public String updateTopic(Topic topic) {
this.topicService.updateTopic(topic);
return "redirect:/topic/getAllTopic.action";
}
return "users/network";
}
// 公告
@RequestMapping("article.action")
public String article(String number) {
this.front();
List<Article> articleList = new ArrayList<Article>();
List<Article> tempList = this.articleService.getAllArticle();
int pageNumber = tempList.size();
int maxPage = pageNumber;
if (maxPage % 12 == 0) {
maxPage = maxPage / 12;
} else {
maxPage = maxPage / 12 + 1;
}
if (number == null) {
number = "0";
}
int start = Integer.parseInt(number) * 12;
int over = (Integer.parseInt(number) + 1) * 12;
int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; i++) {
Article x = tempList.get(i);
articleList.add(x);
}
String html = "";
StringBuffer buffer = new StringBuffer();
buffer.append(" 共为");
buffer.append(maxPage);
buffer.append("页 共有");
buffer.append(pageNumber);
buffer.append("条 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"index/article.action?number=0\">首页</a>");
}
buffer.append(" ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");
}
*/
@Controller
public class BaseAction {
/* 日志 */
protected final Log log = LogFactory.getLog(getClass());
/* 获取基本环境 */
public Map<String, String[]> getParameters() {// 封装为Map的requestParameters
ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
return attrs.getRequest().getParameterMap();
}
public HttpServletRequest getRequest() {
ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
return attrs.getRequest();
}
public HttpSession getSession() {
HttpSession session = null;
try {
session = this.getRequest().getSession();
} catch (Exception e) {
}
return session;
}
/* 向客户端输出操作成功或失败信息 */
public void writeJsonResponse(String success) throws IOException, JSONException {
ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = attrs.getResponse();
response.setContentType("text/json;charset=UTF-8");
PrintWriter out = response.getWriter();
// 将要被返回到客户端的对象
JSONObject json = new JSONObject();
json.accumulate("result", success);
System.out.println(json.toString());
out.println(json.toString());
out.flush();
out.close();
}
}
// 显示全部数据
@RequestMapping("getAllAdmin.action")
public String getAllAdmin(String number) {
List<Admin> adminList = this.adminService.getAllAdmin();
PageHelper.getPage(adminList, "admin", null, null, 10, number, this.getRequest(), null);
return "admin/listadmin";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryAdminByCond.action")
public String queryAdminByCond(String cond, String name, String number) {
Admin admin = new Admin();
if (cond != null) {
if ("username".equals(cond)) {
admin.setUsername(name);
}
if ("password".equals(cond)) {
admin.setPassword(name);
}
if ("realname".equals(cond)) {
admin.setRealname(name);
}
if ("contact".equals(cond)) {
admin.setContact(name);
}
if ("addtime".equals(cond)) {
admin.setAddtime(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.adminService.getAdminByLike(admin), "admin", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryadmin";
}
// 按主键查询数据
Users users = this.usersService.getUsersById(id);
this.getRequest().setAttribute("users", users);
return "admin/editusers";
}
public UsersService getUsersService() { return usersService; }
public void setUsersService(UsersService usersService) { this.usersService = usersService; }
}
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/cate", produces = "text/plain;charset=utf-8")
public class CateAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private CateService cateService;
// 准备添加数据
@RequestMapping("createCate.action")
public String createCate() {
return "admin/addcate";
}
// 添加数据
@RequestMapping("addCate.action")
public String addCate(Cate cate) {
cate.setAddtime(VeDate.getStringDateShort());
this.cateService.insertCate(cate);
return "redirect:/cate/createCate.action";
}
// 通过主键删除数据
// 更新数据
@RequestMapping("updateUsers.action")
public String updateUsers(Users users) {
this.usersService.updateUsers(users);
return "redirect:/users/getAllUsers.action";
}
// 显示全部数据
@RequestMapping("getAllUsers.action")
public String getAllUsers(String number) {
List<Users> usersList = this.usersService.getAllUsers();
PageHelper.getPage(usersList, "users", null, null, 10, number, this.getRequest(), null);
return "admin/listusers";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryUsersByCond.action")
public String queryUsersByCond(String cond, String name, String number) {
Users users = new Users();
if(cond != null){
if ("username".equals(cond)) {
users.setUsername(name);
}
if ("password".equals(cond)) {
users.setPassword(name);
}
if ("realname".equals(cond)) {
users.setRealname(name);
}
if ("sex".equals(cond)) {
users.setSex(name);
}
if ("birthday".equals(cond)) {
users.setBirthday(name);
}
if ("contact".equals(cond)) {
users.setContact(name);
}
if ("regdate".equals(cond)) {
users.setRegdate(name);
}
}
return "redirect:/topic/getAllTopic.action";
}
// 更新数据
@RequestMapping("updateTopic.action")
public String updateTopic(Topic topic) {
this.topicService.updateTopic(topic);
return "redirect:/topic/getAllTopic.action";
}
// 显示全部数据
@RequestMapping("getAllTopic.action")
public String getAllTopic(String number) {
List<Topic> topicList = this.topicService.getAllTopic();
PageHelper.getPage(topicList, "topic", null, null, 10, number, this.getRequest(), null);
return "admin/listtopic";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryTopicByCond.action")
public String queryTopicByCond(String cond, String name, String number) {
Topic topic = new Topic();
if(cond != null){
if ("username".equals(cond)) {
topic.setUsername(name);
}
if ("jiancainame".equals(cond)) {
topic.setJiancainame(name);
}
if ("num".equals(cond)) {
topic.setNum(name);
}
if ("contents".equals(cond)) {
topic.setContents(name);
}
if ("addtime".equals(cond)) {
topic.setAddtime(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.topicService.getTopicByLike(topic), "topic", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/querytopic";
// 按主键查询数据
@RequestMapping("getOrdersById.action")
public String getOrdersById(String id ) {
Orders orders = this.ordersService.getOrdersById(id);
this.getRequest().setAttribute("orders", orders);
List<Users> usersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
return "admin/editorders";
}
public OrdersService getOrdersService() { return ordersService; }
public void setOrdersService(OrdersService ordersService) { this.ordersService = ordersService; }
}
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/article", produces = "text/plain;charset=utf-8")
public class ArticleAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private ArticleService articleService;
// 准备添加数据
@RequestMapping("createArticle.action")
public String createArticle() {
return "admin/addarticle";
}
// 添加数据
@RequestMapping("addArticle.action")
public String addArticle(Article article) {
article.setAddtime(VeDate.getStringDateShort());
article.setHits("0");
this.articleService.insertArticle(article);
return "redirect:/article/createArticle.action";
}
}
// 添加数据
@RequestMapping("addPeihuo.action")
public String addPeihuo(Peihuo peihuo) {
this.peihuoService.insertPeihuo(peihuo);
return "redirect:/peihuo/createPeihuo.action";
}
// 通过主键删除数据
@RequestMapping("deletePeihuo.action")
public String deletePeihuo(String id) {
this.peihuoService.deletePeihuo(id);
return "redirect:/peihuo/getAllPeihuo.action";
}
// 批量删除数据
@RequestMapping("deletePeihuoByIds.action")
public String deletePeihuoByIds() {
String[] ids = this.getRequest().getParameterValues("peihuoid");
for (String peihuoid : ids) {
this.peihuoService.deletePeihuo(peihuoid);
}
return "redirect:/peihuo/getAllPeihuo.action";
}
// 更新数据
@RequestMapping("updatePeihuo.action")
public String updatePeihuo(Peihuo peihuo) {
this.peihuoService.updatePeihuo(peihuo);
return "redirect:/peihuo/getAllPeihuo.action";
}
// 显示全部数据
@RequestMapping("getAllPeihuo.action")
public String getAllPeihuo(String number) {
List<Peihuo> peihuoList = this.peihuoService.getAllPeihuo();
PageHelper.getPage(peihuoList, "peihuo", null, null, 10, number, this.getRequest(), null);
return "admin/listpeihuo";
}
// 显示全部数据
@RequestMapping("getNetWork.action")