基于javaweb的SSM超市订单管理系统(java+ssm+jsp+bootstrap+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

330023202402

340023202402

350023202402

360023202402

370023202402

380023202402

390023202402

400023202402

基于javaweb的SSM超市订单管理系统(java+ssm+jsp+bootstrap+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版本;

技术栈

  1. 后端:Spring SpringMVC MyBatis 2. 前端:JSP+bootstrap+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 将项目中applicationContext-jdbc.xml配置文件中的数据库配置改为自己的配置 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 4. 运行项目,输入localhost:8080/ssm8/login 登录;其中ss8为项目名称,可自定义,但后面路径必须为/login;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	}
//根据ID查看订单
@RequestMapping("/viewOrder")
public String viewOrder(String id,Model md) {
Order order=new Order();
order=orderService.getOrderById(id);
md.addAttribute("order", order);
return "viewOrder";
}
}
package cn.smbms.controller;




@Controller
public class IndexController{
//用户登录处理界面
@RequestMapping("/userLoginGo")
public ModelAndView userLoginGo(User user,HttpSession session) {
ModelAndView mv =new ModelAndView();
mv.addObject("user",user);
session.setAttribute("userName","ddd");
mv.setViewName("success");
return mv;
}
//用户登录界面
@RequestMapping("/userLogin")
public String userLogin() {
return "userLogin";
}
@RequestMapping("/input")
public String input() {
return "input";
}

//@RequestMapping({"/index","/","/my"})
@RequestMapping(value="/index",method=RequestMethod.GET)
public String index(@RequestParam(value="username",required=false) String username,Model md) {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
		session.removeAttribute("user");
return "login";
}
//请求处理程序
@RequestMapping("/loginGo")
public String loginGo(String userCode,String userPassword,Model md,HttpSession session) {
User user=new User();
user=userService.checkLogin(userCode, userPassword);
if(null!=user) {
md.addAttribute("user",user);
session.setAttribute(Constants.USER_SESSION, user);
return "frame";
}else {
//md.addAttribute("msg","用户名或密码错误!");
throw new RuntimeException("用户名或密码错误!");
//return "login";
}
}
//异常处理
// @ExceptionHandler(value= {RuntimeException.class})
// public String handlerException(RuntimeException e,HttpServletRequest req) {
// req.setAttribute("e", e);
// return "error";
// }
@RequestMapping("/main")
public String main(HttpSession session) {
//检查是否登录
if(session.getAttribute("user")==null) {
return "redirect:login";
}
return "main";
}
//查询用户列表
@RequestMapping("/getUserList")
public String getUserList(String userName,String roleName,String pageIndex,Model md) {
//设置页面容量
int pageSize = Constants.pageSize;
//当前页码
int currentPageNo = 1;
if(pageIndex != null){
try{
currentPageNo = Integer.valueOf(pageIndex);
}catch(NumberFormatException e){
return "redirect:/user/syserror.html";
//response.sendRedirect("syserror.jsp");
}
}
//总数量(表)
if(StringUtils.isEmpty(userName))
userName="";
if(StringUtils.isEmpty(roleName))
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39


@Controller
public class ProviderController {
//引入业务层的资源
@Autowired
ProviderService proService;
//添加供应商处理方法
@RequestMapping("/providerAddGo")
public String providerAddGo(Provider provider,HttpSession session) {
Provider pro=new Provider();
pro=provider;
Integer uid=null;
uid=((User) session.getAttribute(Constants.USER_SESSION)).getId();
if(null!=uid) {
pro.setCreatedBy(uid);
if(proService.providerAdd(pro))
return "redirect:getProviders";
else
return "redirect:providerAdd";
}
else
return "redirect:login";
}
//添加供应商界面
@RequestMapping("/providerAdd")
public String providerAdd() {
return "providerAdd";
}
@RequestMapping("/getProviders")
public String getProviderList(String proName,Model md,String pageIndex) {
String strName="";
if(!StringUtils.isEmpty(proName)) {
strName=proName;
}
Integer currentPageNo=1;
Integer pageSize=Constants.pageSize;
if(!StringUtils.isEmpty(pageIndex)) {
currentPageNo=Integer.parseInt(pageIndex);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
public String modifyUserGo(User user,HttpSession session) {
Integer uid=((User)session.getAttribute(Constants.USER_SESSION)).getId();
if(null!=user) {
user.setModifyBy(uid);
user.setModifyDate(new Date());
userService.modifyUser(user);
}
return "redirect:getUserList";
}
//添加修改用户的界面路由
@RequestMapping("/modifyUser")
public String modifyUser(String id,Model md) {
User user=new User();
user=userService.getUserById(id);
md.addAttribute("user", user);
return "modifyUser";
}
//修改密码实现方法
@RequestMapping("/modifyPasswordGo")
public String modifyPasswordGo(String userCode,String userPassword,String newPassword,Model md) {
String msg="";
if(userService.modifyPasswd(userCode, userPassword, newPassword))
msg="修改密码成功!";
else
msg="修改密码失败!";
md.addAttribute("msg",msg);
return "modifyPasswordFinish";
}
//添加用户打开修改密码的界面
@RequestMapping("/modifyPasswd")
public String modifyPasswd() {
return "modifyPasswd";
}
//添加用户处理方法
@RequestMapping("addUserGo")
public String addUserGo(User user,HttpSession session,HttpServletRequest request,
@RequestParam(value ="midPicPath", required = false) MultipartFile attach,
@RequestParam(value ="mworkPicPath", required = false) MultipartFile attach1,
Model md) {
String strIdPicPath=null;
String strWorkPicPath=null;
Map<String,String> msgMap=new HashMap<String,String>();
String savePath= request.getSession().getServletContext().getRealPath("uploads");
msgMap=UploadHelper.saveFile(savePath, attach);
if(msgMap.get("flag")=="fail") {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
			user1.setCreatedBy(uid);
user1.setIdPicPath(strIdPicPath);
user1.setWorkPicPath(strWorkPicPath);
if(userService.addUser(user1))
return "redirect:getUserList";
else {
md.addAttribute("error","您还没有登录,请登录!");
return "redirect:addUser";
}
}
else
return "redirect:login";
}
//添加用户界面
@RequestMapping("addUser")
public String addUser() {
return "addUser";
}
//请求登录界面
@RequestMapping("/login")
public String login() {
return "login";
}
//退出界面
@RequestMapping("/logout")
public String logout(HttpSession session){
session.removeAttribute("user");
return "login";
}
//请求处理程序
@RequestMapping("/loginGo")
public String loginGo(String userCode,String userPassword,Model md,HttpSession session) {
User user=new User();
user=userService.checkLogin(userCode, userPassword);
if(null!=user) {
md.addAttribute("user",user);
session.setAttribute(Constants.USER_SESSION, user);
return "frame";
}else {
//md.addAttribute("msg","用户名或密码错误!");
throw new RuntimeException("用户名或密码错误!");
//return "login";
}
}
//异常处理
// @ExceptionHandler(value= {RuntimeException.class})
// public String handlerException(RuntimeException e,HttpServletRequest req) {
// req.setAttribute("e", e);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	    	return "redirect:getOrder";
else
return "redirect:orderAdd";
}
else
return "redirect:login";
}
//获取订单列表的处理方法
@RequestMapping("/getOrder")
public String getOrderList(String orderName,Model md,String pageIndex) {
String strName="";
if(!StringUtils.isEmpty(orderName)) {
strName=orderName;
}
Integer currentPageNo=1;
Integer pageSize=Constants.pageSize;
if(!StringUtils.isEmpty(pageIndex)) {
currentPageNo=Integer.parseInt(pageIndex);
}
//根据条件获取总记录数
Integer totalCount=orderService.getOrderCount(strName);
//计算可以分几页
PageHelper pages=new PageHelper();
pages.setCurrentPageNo(currentPageNo);
pages.setPageSize(pageSize);
pages.setTotalCount(totalCount);
int totalPageCount = pages.getTotalPageCount();
List<Order> order=orderService.getOrderList(strName,(currentPageNo-1)*pageSize,pageSize);
md.addAttribute("totalPageCount", totalPageCount);
md.addAttribute("totalCount", totalCount);
md.addAttribute("currentPageNo", currentPageNo);
md.addAttribute("order",order);
return "orderList";
}
//根据id删除订单信息
@RequestMapping("deleteOrderById")
public String deleteOrderById(String id,Model md) {
String msg="";
if(orderService.deleteOrderById(id)) {
msg="删除订单成功!";
}else
msg="删除订单失败!";
md.addAttribute("msg", msg);
return "redirect:getOrder";
}
//添加修改界面
@RequestMapping("/modifyOrder")
public String modifyOrder(String id,Model md) {
Order order=new Order();
order=orderService.getOrderById(id);
md.addAttribute("order", order);
return "modifyOrder";


项目链接:
https://javayms.github.io?id=501422322105200lb
https://javayms.pages.dev?id=501422322105200lb