当前位置:   article > 正文

Java项目:SSM婚纱影楼摄影商城项目网站_电商拍摄ssm

电商拍摄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. 运行项目,在浏览器中输入http://localhost:8080/ 登录
用户账号/密码: user/123456

管理员账号/密码:admin/admin

运行截图

前台界面

 

 

 

 

 

后台界面

 

 

 

 

 

相关代码

用户控制器

  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.Users;
  9. import com.service.UsersService;
  10. import com.util.PageHelper;
  11. import com.util.VeDate;
  12. //定义为控制器
  13. @Controller
  14. // 设置路径
  15. @RequestMapping(value = "/users" , produces = "text/plain;charset=utf-8")
  16. public class UsersAction extends BaseAction {
  17. // 注入Service 由于标签的存在 所以不需要getter setter
  18. @Autowired
  19. @Resource
  20. private UsersService usersService;
  21. // 准备添加数据
  22. @RequestMapping("createUsers.action")
  23. public String createUsers() {
  24. return "admin/addusers";
  25. }
  26. // 添加数据
  27. @RequestMapping("addUsers.action")
  28. public String addUsers(Users users) {
  29. users.setRegdate(VeDate.getStringDateShort());
  30. this.usersService.insertUsers(users);
  31. return "redirect:/users/createUsers.action";
  32. }
  33. // 通过主键删除数据
  34. @RequestMapping("deleteUsers.action")
  35. public String deleteUsers(String id) {
  36. this.usersService.deleteUsers(id);
  37. return "redirect:/users/getAllUsers.action";
  38. }
  39. // 批量删除数据
  40. @RequestMapping("deleteUsersByIds.action")
  41. public String deleteUsersByIds() {
  42. String[] ids = this.getRequest().getParameterValues("usersid");
  43. for (String usersid : ids) {
  44. this.usersService.deleteUsers(usersid);
  45. }
  46. return "redirect:/users/getAllUsers.action";
  47. }
  48. // 更新数据
  49. @RequestMapping("updateUsers.action")
  50. public String updateUsers(Users users) {
  51. this.usersService.updateUsers(users);
  52. return "redirect:/users/getAllUsers.action";
  53. }
  54. // 显示全部数据
  55. @RequestMapping("getAllUsers.action")
  56. public String getAllUsers(String number) {
  57. List<Users> usersList = this.usersService.getAllUsers();
  58. PageHelper.getPage(usersList, "users", null, null, 10, number, this.getRequest(), null);
  59. return "admin/listusers";
  60. }
  61. // 按条件查询数据 (模糊查询)
  62. @RequestMapping("queryUsersByCond.action")
  63. public String queryUsersByCond(String cond, String name, String number) {
  64. Users users = new Users();
  65. if(cond != null){
  66. if ("username".equals(cond)) {
  67. users.setUsername(name);
  68. }
  69. if ("password".equals(cond)) {
  70. users.setPassword(name);
  71. }
  72. if ("realname".equals(cond)) {
  73. users.setRealname(name);
  74. }
  75. if ("sex".equals(cond)) {
  76. users.setSex(name);
  77. }
  78. if ("birthday".equals(cond)) {
  79. users.setBirthday(name);
  80. }
  81. if ("contact".equals(cond)) {
  82. users.setContact(name);
  83. }
  84. if ("regdate".equals(cond)) {
  85. users.setRegdate(name);
  86. }
  87. }
  88. List<String> nameList = new ArrayList<String>();
  89. List<String> valueList = new ArrayList<String>();
  90. nameList.add(cond);
  91. valueList.add(name);
  92. PageHelper.getPage(this.usersService.getUsersByLike(users), "users", nameList, valueList, 10, number, this.getRequest(), "query");
  93. name = null;
  94. cond = null;
  95. return "admin/queryusers";
  96. }
  97. // 按主键查询数据
  98. @RequestMapping("getUsersById.action")
  99. public String getUsersById(String id ) {
  100. Users users = this.usersService.getUsersById(id);
  101. this.getRequest().setAttribute("users", users);
  102. return "admin/editusers";
  103. }
  104. public UsersService getUsersService() { return usersService; }
  105. public void setUsersService(UsersService usersService) { this.usersService = usersService; }
  106. }

上传控制器

  1. package com.action;
  2. import java.io.File;
  3. import javax.servlet.http.HttpServletRequest;
  4. import org.springframework.stereotype.Controller;
  5. import org.springframework.ui.ModelMap;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestParam;
  8. import org.springframework.web.multipart.MultipartFile;
  9. import com.util.VeDate;
  10. @Controller
  11. @RequestMapping("/upload")
  12. public class UploadAction {
  13. @RequestMapping(value = "/image.action")
  14. public String upload(@RequestParam(value = "image", required = false) MultipartFile file,
  15. HttpServletRequest request, ModelMap model) {
  16. String path = request.getSession().getServletContext().getRealPath("/") + "upfiles/";
  17. String fileName = file.getOriginalFilename();
  18. int i = fileName.lastIndexOf(".");
  19. String name = String.valueOf(VeDate.getStringDatex());
  20. String type = fileName.substring(i + 1);
  21. fileName = name + "." + type;
  22. File targetFile = new File(path, fileName);
  23. if (!targetFile.exists()) {
  24. targetFile.mkdirs();
  25. }
  26. // 保存
  27. try {
  28. file.transferTo(targetFile);
  29. } catch (Exception e) {
  30. e.printStackTrace();
  31. }
  32. model.addAttribute("imageFileName", fileName);
  33. return "saveimage";
  34. }
  35. @RequestMapping(value = "/files.action")
  36. public String files(@RequestParam(value = "image", required = false) MultipartFile file, HttpServletRequest request,
  37. ModelMap model) {
  38. String path = request.getSession().getServletContext().getRealPath("/") + "upfiles/";
  39. String fileName = file.getOriginalFilename();
  40. int i = fileName.lastIndexOf(".");
  41. String name = String.valueOf(VeDate.getStringDatex());
  42. String type = fileName.substring(i + 1);
  43. fileName = name + "." + type;
  44. File targetFile = new File(path, fileName);
  45. if (!targetFile.exists()) {
  46. targetFile.mkdirs();
  47. }
  48. // 保存
  49. try {
  50. file.transferTo(targetFile);
  51. } catch (Exception e) {
  52. e.printStackTrace();
  53. }
  54. model.addAttribute("imageFileName", fileName);
  55. return "savefile";
  56. }
  57. }

主题控制器

  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.Topic;
  9. import com.service.TopicService;
  10. import com.entity.Users;
  11. import com.entity.Jiancai;
  12. import com.service.UsersService;
  13. import com.service.JiancaiService;
  14. import com.util.PageHelper;
  15. //定义为控制器
  16. @Controller
  17. // 设置路径
  18. @RequestMapping(value = "/topic" , produces = "text/plain;charset=utf-8")
  19. public class TopicAction extends BaseAction {
  20. // 注入Service 由于标签的存在 所以不需要getter setter
  21. @Autowired
  22. @Resource
  23. private TopicService topicService;
  24. @Autowired
  25. @Resource
  26. private UsersService usersService;
  27. @Autowired
  28. @Resource
  29. private JiancaiService jiancaiService;
  30. // 准备添加数据
  31. @RequestMapping("createTopic.action")
  32. public String createTopic() {
  33. List<Users> usersList = this.usersService.getAllUsers();
  34. this.getRequest().setAttribute("usersList", usersList);
  35. List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
  36. this.getRequest().setAttribute("jiancaiList", jiancaiList);
  37. return "admin/addtopic";
  38. }
  39. // 添加数据
  40. @RequestMapping("addTopic.action")
  41. public String addTopic(Topic topic) {
  42. this.topicService.insertTopic(topic);
  43. return "redirect:/topic/createTopic.action";
  44. }
  45. // 通过主键删除数据
  46. @RequestMapping("deleteTopic.action")
  47. public String deleteTopic(String id) {
  48. this.topicService.deleteTopic(id);
  49. return "redirect:/topic/getAllTopic.action";
  50. }
  51. // 批量删除数据
  52. @RequestMapping("deleteTopicByIds.action")
  53. public String deleteTopicByIds() {
  54. String[] ids = this.getRequest().getParameterValues("topicid");
  55. for (String topicid : ids) {
  56. this.topicService.deleteTopic(topicid);
  57. }
  58. return "redirect:/topic/getAllTopic.action";
  59. }
  60. // 更新数据
  61. @RequestMapping("updateTopic.action")
  62. public String updateTopic(Topic topic) {
  63. this.topicService.updateTopic(topic);
  64. return "redirect:/topic/getAllTopic.action";
  65. }
  66. // 显示全部数据
  67. @RequestMapping("getAllTopic.action")
  68. public String getAllTopic(String number) {
  69. List<Topic> topicList = this.topicService.getAllTopic();
  70. PageHelper.getPage(topicList, "topic", null, null, 10, number, this.getRequest(), null);
  71. return "admin/listtopic";
  72. }
  73. // 按条件查询数据 (模糊查询)
  74. @RequestMapping("queryTopicByCond.action")
  75. public String queryTopicByCond(String cond, String name, String number) {
  76. Topic topic = new Topic();
  77. if(cond != null){
  78. if ("username".equals(cond)) {
  79. topic.setUsername(name);
  80. }
  81. if ("jiancainame".equals(cond)) {
  82. topic.setJiancainame(name);
  83. }
  84. if ("num".equals(cond)) {
  85. topic.setNum(name);
  86. }
  87. if ("contents".equals(cond)) {
  88. topic.setContents(name);
  89. }
  90. if ("addtime".equals(cond)) {
  91. topic.setAddtime(name);
  92. }
  93. }
  94. List<String> nameList = new ArrayList<String>();
  95. List<String> valueList = new ArrayList<String>();
  96. nameList.add(cond);
  97. valueList.add(name);
  98. PageHelper.getPage(this.topicService.getTopicByLike(topic), "topic", nameList, valueList, 10, number, this.getRequest(), "query");
  99. name = null;
  100. cond = null;
  101. return "admin/querytopic";
  102. }
  103. // 按主键查询数据
  104. @RequestMapping("getTopicById.action")
  105. public String getTopicById(String id ) {
  106. Topic topic = this.topicService.getTopicById(id);
  107. this.getRequest().setAttribute("topic", topic);
  108. List<Users> usersList = this.usersService.getAllUsers();
  109. this.getRequest().setAttribute("usersList", usersList);
  110. List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
  111. this.getRequest().setAttribute("jiancaiList", jiancaiList);
  112. return "admin/edittopic";
  113. }
  114. public TopicService getTopicService() { return topicService; }
  115. public void setTopicService(TopicService topicService) { this.topicService = topicService; }
  116. }

订单控制器

  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.Orders;
  9. import com.service.OrdersService;
  10. import com.entity.Users;
  11. import com.service.UsersService;
  12. import com.util.PageHelper;
  13. //定义为控制器
  14. @Controller
  15. // 设置路径
  16. @RequestMapping(value = "/orders" , produces = "text/plain;charset=utf-8")
  17. public class OrdersAction extends BaseAction {
  18. // 注入Service 由于标签的存在 所以不需要getter setter
  19. @Autowired
  20. @Resource
  21. private OrdersService ordersService;
  22. @Autowired
  23. @Resource
  24. private UsersService usersService;
  25. // 准备添加数据
  26. @RequestMapping("createOrders.action")
  27. public String createOrders() {
  28. List<Users> usersList = this.usersService.getAllUsers();
  29. this.getRequest().setAttribute("usersList", usersList);
  30. return "admin/addorders";
  31. }
  32. // 添加数据
  33. @RequestMapping("addOrders.action")
  34. public String addOrders(Orders orders) {
  35. this.ordersService.insertOrders(orders);
  36. return "redirect:/orders/createOrders.action";
  37. }
  38. // 通过主键删除数据
  39. @RequestMapping("deleteOrders.action")
  40. public String deleteOrders(String id) {
  41. this.ordersService.deleteOrders(id);
  42. return "redirect:/orders/getAllOrders.action";
  43. }
  44. // 批量删除数据
  45. @RequestMapping("deleteOrdersByIds.action")
  46. public String deleteOrdersByIds() {
  47. String[] ids = this.getRequest().getParameterValues("ordersid");
  48. for (String ordersid : ids) {
  49. this.ordersService.deleteOrders(ordersid);
  50. }
  51. return "redirect:/orders/getAllOrders.action";
  52. }
  53. // 更新数据
  54. @RequestMapping("updateOrders.action")
  55. public String updateOrders(Orders orders) {
  56. this.ordersService.updateOrders(orders);
  57. return "redirect:/orders/getAllOrders.action";
  58. }
  59. // 显示全部数据
  60. @RequestMapping("getAllOrders.action")
  61. public String getAllOrders(String number) {
  62. List<Orders> ordersList = this.ordersService.getAllOrders();
  63. PageHelper.getPage(ordersList, "orders", null, null, 10, number, this.getRequest(), null);
  64. return "admin/listorders";
  65. }
  66. // 按条件查询数据 (模糊查询)
  67. @RequestMapping("queryOrdersByCond.action")
  68. public String queryOrdersByCond(String cond, String name, String number) {
  69. Orders orders = new Orders();
  70. if(cond != null){
  71. if ("ordercode".equals(cond)) {
  72. orders.setOrdercode(name);
  73. }
  74. if ("username".equals(cond)) {
  75. orders.setUsername(name);
  76. }
  77. if ("total".equals(cond)) {
  78. orders.setTotal(name);
  79. }
  80. if ("status".equals(cond)) {
  81. orders.setStatus(name);
  82. }
  83. if ("addtime".equals(cond)) {
  84. orders.setAddtime(name);
  85. }
  86. }
  87. List<String> nameList = new ArrayList<String>();
  88. List<String> valueList = new ArrayList<String>();
  89. nameList.add(cond);
  90. valueList.add(name);
  91. PageHelper.getPage(this.ordersService.getOrdersByLike(orders), "orders", nameList, valueList, 10, number, this.getRequest(), "query");
  92. name = null;
  93. cond = null;
  94. return "admin/queryorders";
  95. }
  96. // 按主键查询数据
  97. @RequestMapping("getOrdersById.action")
  98. public String getOrdersById(String id ) {
  99. Orders orders = this.ordersService.getOrdersById(id);
  100. this.getRequest().setAttribute("orders", orders);
  101. List<Users> usersList = this.usersService.getAllUsers();
  102. this.getRequest().setAttribute("usersList", usersList);
  103. return "admin/editorders";
  104. }
  105. public OrdersService getOrdersService() { return ordersService; }
  106. public void setOrdersService(OrdersService ordersService) { this.ordersService = ordersService; }
  107. }

如果也想学习本系统,下面领取。回复:190ssm 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/792162
推荐阅读
相关标签
  

闽ICP备14008679号