• Java项目:SSM实现的儿童摄影预约网站平台


    作者主页:夜未央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

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

    3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置;

    4. 运行项目,输入localhost:8080/ 登录

    运行截图

    前台界面-用户角色

     

     

     

     

     

     后台界面-管理员角色

     

     

     

     

     

     

    相关代码

    AdminServiceImpl

    1. package com.service.impl;
    2. import java.util.List;
    3. import javax.annotation.Resource;
    4. import org.springframework.beans.factory.annotation.Autowired;
    5. import org.springframework.stereotype.Service;
    6. import com.dao.AdminDAO;
    7. import com.entity.Admin;
    8. import com.service.AdminService;
    9. @Service("adminService")
    10. public class AdminServiceImpl implements AdminService {
    11. @Autowired
    12. @Resource
    13. private AdminDAO adminDAO;
    14. @Override // 继承接口的新增 返回值0(失败),1(成功)
    15. public int insertAdmin(Admin admin) {
    16. return this.adminDAO.insertAdmin(admin);
    17. }
    18. @Override // 继承接口的更新 返回值0(失败),1(成功)
    19. public int updateAdmin(Admin admin) {
    20. return this.adminDAO.updateAdmin(admin);
    21. }
    22. @Override // 继承接口的删除 返回值0(失败),1(成功)
    23. public int deleteAdmin(String adminid) {
    24. return this.adminDAO.deleteAdmin(adminid);
    25. }
    26. @Override // 继承接口的查询全部
    27. public List getAllAdmin() {
    28. return this.adminDAO.getAllAdmin();
    29. }
    30. @Override // 继承接口的按条件精确查询
    31. public List getAdminByCond(Admin admin) {
    32. return this.adminDAO.getAdminByCond(admin);
    33. }
    34. @Override // 继承接口的按条件模糊查询
    35. public List getAdminByLike(Admin admin) {
    36. return this.adminDAO.getAdminByLike(admin);
    37. }
    38. @Override // 继承接口的按主键查询 返回Entity实例
    39. public Admin getAdminById(String adminid) {
    40. return this.adminDAO.getAdminById(adminid);
    41. }
    42. }

    AjaxAction

    1. package com.action;
    2. import java.util.List;
    3. import javax.annotation.Resource;
    4. import org.json.JSONArray;
    5. import org.json.JSONException;
    6. import org.json.JSONObject;
    7. import org.springframework.beans.factory.annotation.Autowired;
    8. import org.springframework.stereotype.Controller;
    9. import org.springframework.web.bind.annotation.RequestMapping;
    10. import org.springframework.web.bind.annotation.ResponseBody;
    11. import com.entity.Peihuo;
    12. import com.service.PeihuoService;
    13. //定义为控制器
    14. @Controller
    15. // 设置路径
    16. @RequestMapping(value = "/ajax", produces = "text/plain;charset=utf-8")
    17. public class AjaxAction extends BaseAction {
    18. @Autowired
    19. @Resource
    20. private PeihuoService peihuoService;
    21. // 准备添加数据
    22. @RequestMapping("getPeihuo.action")
    23. @ResponseBody
    24. public String getPeihuo() throws JSONException {
    25. String cityid = this.getRequest().getParameter("cityid");
    26. Peihuo peihuo = new Peihuo();
    27. peihuo.setCityid(cityid);
    28. List peihuoList = this.peihuoService.getPeihuoByCond(peihuo);
    29. JSONArray peihuoid = new JSONArray(); // 存放ID
    30. JSONArray peihuoname = new JSONArray(); // 存放名称
    31. for (Peihuo c : peihuoList) {
    32. peihuoid.put(c.getPeihuoid());
    33. peihuoname.put(c.getPeihuoname());
    34. }
    35. JSONObject json = new JSONObject();
    36. json.put("peihuoid", peihuoid.toString().replaceAll("\"", ""));
    37. json.put("peihuoname", peihuoname.toString().replaceAll("\"", ""));
    38. System.out.println(json.toString());
    39. return json.toString();
    40. }
    41. }

    公告Action

    1. package com.action;
    2. import java.util.ArrayList;
    3. import java.util.List;
    4. import javax.annotation.Resource;
    5. import org.springframework.beans.factory.annotation.Autowired;
    6. import org.springframework.stereotype.Controller;
    7. import org.springframework.web.bind.annotation.RequestMapping;
    8. import com.entity.Article;
    9. import com.service.ArticleService;
    10. import com.util.PageHelper;
    11. import com.util.VeDate;
    12. //定义为控制器
    13. @Controller
    14. // 设置路径
    15. @RequestMapping(value = "/article", produces = "text/plain;charset=utf-8")
    16. public class ArticleAction extends BaseAction {
    17. // 注入Service 由于标签的存在 所以不需要getter setter
    18. @Autowired
    19. @Resource
    20. private ArticleService articleService;
    21. // 准备添加数据
    22. @RequestMapping("createArticle.action")
    23. public String createArticle() {
    24. return "admin/addarticle";
    25. }
    26. // 添加数据
    27. @RequestMapping("addArticle.action")
    28. public String addArticle(Article article) {
    29. article.setAddtime(VeDate.getStringDateShort());
    30. article.setHits("0");
    31. this.articleService.insertArticle(article);
    32. return "redirect:/article/createArticle.action";
    33. }
    34. // 通过主键删除数据
    35. @RequestMapping("deleteArticle.action")
    36. public String deleteArticle(String id) {
    37. this.articleService.deleteArticle(id);
    38. return "redirect:/article/getAllArticle.action";
    39. }
    40. // 批量删除数据
    41. @RequestMapping("deleteArticleByIds.action")
    42. public String deleteArticleByIds() {
    43. String[] ids = this.getRequest().getParameterValues("articleid");
    44. for (String articleid : ids) {
    45. this.articleService.deleteArticle(articleid);
    46. }
    47. return "redirect:/article/getAllArticle.action";
    48. }
    49. // 更新数据
    50. @RequestMapping("updateArticle.action")
    51. public String updateArticle(Article article) {
    52. this.articleService.updateArticle(article);
    53. return "redirect:/article/getAllArticle.action";
    54. }
    55. // 显示全部数据
    56. @RequestMapping("getAllArticle.action")
    57. public String getAllArticle(String number) {
    58. List
      articleList = this.articleService.getAllArticle();
    59. PageHelper.getPage(articleList, "article", null, null, 10, number, this.getRequest(), null);
    60. return "admin/listarticle";
    61. }
    62. // 按条件查询数据 (模糊查询)
    63. @RequestMapping("queryArticleByCond.action")
    64. public String queryArticleByCond(String cond, String name, String number) {
    65. Article article = new Article();
    66. if (cond != null) {
    67. if ("title".equals(cond)) {
    68. article.setTitle(name);
    69. }
    70. if ("image".equals(cond)) {
    71. article.setImage(name);
    72. }
    73. if ("contents".equals(cond)) {
    74. article.setContents(name);
    75. }
    76. if ("addtime".equals(cond)) {
    77. article.setAddtime(name);
    78. }
    79. if ("hits".equals(cond)) {
    80. article.setHits(name);
    81. }
    82. }
    83. List nameList = new ArrayList();
    84. List valueList = new ArrayList();
    85. nameList.add(cond);
    86. valueList.add(name);
    87. PageHelper.getPage(this.articleService.getArticleByLike(article), "article", nameList, valueList, 10, number, this.getRequest(),
    88. "query");
    89. name = null;
    90. cond = null;
    91. return "admin/queryarticle";
    92. }
    93. // 按主键查询数据
    94. @RequestMapping("getArticleById.action")
    95. public String getArticleById(String id) {
    96. Article article = this.articleService.getArticleById(id);
    97. this.getRequest().setAttribute("article", article);
    98. return "admin/editarticle";
    99. }
    100. public ArticleService getArticleService() {
    101. return articleService;
    102. }
    103. public void setArticleService(ArticleService articleService) {
    104. this.articleService = articleService;
    105. }
    106. }

     

    1. package com.action;
    2. import java.util.ArrayList;
    3. import java.util.List;
    4. import javax.annotation.Resource;
    5. import org.springframework.beans.factory.annotation.Autowired;
    6. import org.springframework.stereotype.Controller;
    7. import org.springframework.web.bind.annotation.RequestMapping;
    8. import com.entity.Jiancai;
    9. import com.service.JiancaiService;
    10. import com.entity.Cate;
    11. import com.service.CateService;
    12. import com.util.PageHelper;
    13. //定义为控制器
    14. @Controller
    15. // 设置路径
    16. @RequestMapping(value = "/jiancai", produces = "text/plain;charset=utf-8")
    17. public class JiancaiAction extends BaseAction {
    18. // 注入Service 由于标签的存在 所以不需要getter setter
    19. @Autowired
    20. @Resource
    21. private JiancaiService jiancaiService;
    22. @Autowired
    23. @Resource
    24. private CateService cateService;
    25. // 准备添加数据
    26. @RequestMapping("createJiancai.action")
    27. public String createJiancai() {
    28. List cateList = this.cateService.getAllCate();
    29. this.getRequest().setAttribute("cateList", cateList);
    30. return "admin/addjiancai";
    31. }
    32. // 添加数据
    33. @RequestMapping("addJiancai.action")
    34. public String addJiancai(Jiancai jiancai) {
    35. jiancai.setHits("0");
    36. jiancai.setSellnum("0");
    37. this.jiancaiService.insertJiancai(jiancai);
    38. return "redirect:/jiancai/createJiancai.action";
    39. }
    40. // 通过主键删除数据
    41. @RequestMapping("deleteJiancai.action")
    42. public String deleteJiancai(String id) {
    43. this.jiancaiService.deleteJiancai(id);
    44. return "redirect:/jiancai/getAllJiancai.action";
    45. }
    46. // 批量删除数据
    47. @RequestMapping("deleteJiancaiByIds.action")
    48. public String deleteJiancaiByIds() {
    49. String[] ids = this.getRequest().getParameterValues("jiancaiid");
    50. for (String jiancaiid : ids) {
    51. this.jiancaiService.deleteJiancai(jiancaiid);
    52. }
    53. return "redirect:/jiancai/getAllJiancai.action";
    54. }
    55. // 更新数据
    56. @RequestMapping("updateJiancai.action")
    57. public String updateJiancai(Jiancai jiancai) {
    58. this.jiancaiService.updateJiancai(jiancai);
    59. return "redirect:/jiancai/getAllJiancai.action";
    60. }
    61. // 显示全部数据
    62. @RequestMapping("getAllJiancai.action")
    63. public String getAllJiancai(String number) {
    64. List jiancaiList = this.jiancaiService.getAllJiancai();
    65. PageHelper.getPage(jiancaiList, "jiancai", null, null, 10, number, this.getRequest(), null);
    66. return "admin/listjiancai";
    67. }
    68. // 按条件查询数据 (模糊查询)
    69. @RequestMapping("queryJiancaiByCond.action")
    70. public String queryJiancaiByCond(String cond, String name, String number) {
    71. Jiancai jiancai = new Jiancai();
    72. if (cond != null) {
    73. if ("jiancainame".equals(cond)) {
    74. jiancai.setJiancainame(name);
    75. }
    76. if ("image".equals(cond)) {
    77. jiancai.setImage(name);
    78. }
    79. if ("cateid".equals(cond)) {
    80. jiancai.setCatename(name);
    81. }
    82. if ("price".equals(cond)) {
    83. jiancai.setPrice(name);
    84. }
    85. if ("recommend".equals(cond)) {
    86. jiancai.setRecommend(name);
    87. }
    88. if ("thestart".equals(cond)) {
    89. jiancai.setThestart(name);
    90. }
    91. if ("theend".equals(cond)) {
    92. jiancai.setTheend(name);
    93. }
    94. if ("hits".equals(cond)) {
    95. jiancai.setHits(name);
    96. }
    97. if ("sellnum".equals(cond)) {
    98. jiancai.setSellnum(name);
    99. }
    100. if ("contents".equals(cond)) {
    101. jiancai.setContents(name);
    102. }
    103. }
    104. List nameList = new ArrayList();
    105. List valueList = new ArrayList();
    106. nameList.add(cond);
    107. valueList.add(name);
    108. PageHelper.getPage(this.jiancaiService.getJiancaiByLike(jiancai), "jiancai", nameList, valueList, 10, number, this.getRequest(), "query");
    109. name = null;
    110. cond = null;
    111. return "admin/queryjiancai";
    112. }
    113. // 按主键查询数据
    114. @RequestMapping("getJiancaiById.action")
    115. public String getJiancaiById(String id) {
    116. Jiancai jiancai = this.jiancaiService.getJiancaiById(id);
    117. this.getRequest().setAttribute("jiancai", jiancai);
    118. List cateList = this.cateService.getAllCate();
    119. this.getRequest().setAttribute("cateList", cateList);
    120. return "admin/editjiancai";
    121. }
    122. public JiancaiService getJiancaiService() {
    123. return jiancaiService;
    124. }
    125. public void setJiancaiService(JiancaiService jiancaiService) {
    126. this.jiancaiService = jiancaiService;
    127. }
    128. }

    如果也想学习本系统,下面领取。关注并回复:191ssm

  • 相关阅读:
    什么是恶意代码?
    【操作系统】保姆级教程(VMware)Ubuntu+qemu+xv6安装调试
    代码随想录训练营第五十八天|739. 每日温度、496.下一个更大元素 I
    大模型prompt-文章生成
    2023/09/21 day5 qt
    STM32单片机OLED俄罗斯方块单片机小游戏
    【动态规划刷题 14】最长递增子序列&& 摆动序列
    《asp.net core 3 高级编程(第8版)》学习笔记 02
    深度学习实验总结:PR-曲线、线性回归、卷积神经网络、GAN生成式对抗神经网络
    Java 变量类型2
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126358256