基于javaweb的SSM网上果蔬商城水果蔬菜商城系统(java+ssm+mysql+tomcat+jsp)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

250023052402

260023052402

基于javaweb的SSM网上果蔬商城水果蔬菜商城系统(java+ssm+mysql+tomcat+jsp)

一、项目简述

功能: 功能:系统分管理员界面与用户界面 管理员:用户管理,商品类别管理,商品管理,订单管理,公 告管理留言里筲等 向户:房总主册功能,用户登录功能,商品浏览,商品留言评 论,商品购买,商品支付,订单查询等等

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + Fileupload + maven等等。

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
	
/**
* 添加修改
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Comment comment, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
commentService.updateById(comment);
//2.通过主键id修改
//commentService.updateById(comment);
return "redirect:/comment/findBySql.action";
}

/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
commentService.deleteById(id);
/*以下是多种删除方式*/
// //2.通过实体条件删除
// commentService.deleteByEntity(comment);
// //3.通过参数删除
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(comment.getUserId())){
// params.put("userId", comment.getUserId());
// }
//
// if(!isEmpty(comment.getItemId())){
// params.put("itemId", comment.getItemId());
// }
//
// if(!isEmpty(comment.getContent())){
// params.put("content", comment.getContent());
// }
//
// if(!isEmpty(comment.getAddTime())){
// params.put("addTime", comment.getAddTime());
// }
//
// commentService.deleteByMap(params);
// //4.状态删除
// Comment load = commentService.getById(comment.getId())
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
	 * @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Manage obj = manageService.load(id);
model.addAttribute("obj",obj);
return "manage/update";
}

/**
* 添加修改
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
manageService.updateById(manage);
//2.通过主键id修改
//manageService.updateById(manage);
return "redirect:/manage/findBySql.action";
}

/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
manageService.deleteById(id);
/*以下是多种删除方式*/
// //2.通过实体条件删除
// manageService.deleteByEntity(manage);
// //3.通过参数删除
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(manage.getUserName())){
// params.put("userName", manage.getUserName());
// }
//
// if(!isEmpty(manage.getPassWord())){
// params.put("passWord", manage.getPassWord());
// }
//
// if(!isEmpty(manage.getRealName())){
// params.put("realName", manage.getRealName());
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
      JSONObject j = new  JSONObject();
if (attribute == null){
j.put("res", 0);
return j.toString();
}
Integer userId = Integer.valueOf(attribute.toString());
User load = userService.load(userId);
load.setPassWord(password);
userService.updateById(load);
j.put("res", 1);
return j.toString();

}

// @RequestMapping("/toLogin2")
// public String toLogin(Student student, HttpServletRequest request, HttpServletResponse response){
// student.setIsdel(0);
// Student byEntity = studentService.getByEntity(student);
// if(byEntity == null){
// return "redirect:/login/login.action";
// }else{
// request.getSession().setAttribute("role",2);
// request.getSession().setAttribute("type",3);
// request.getSession().setAttribute("username", byEntity.getXh());
// request.getSession().setAttribute("userId", byEntity.getId());
// }
// return "login/index";
// }

/**
* 退出
* @param request
* @param response
* @return
*/
@RequestMapping("/tuichu")
public String tuichu( HttpServletRequest request, HttpServletResponse response){
HttpSession session = request.getSession();
session.invalidate();
return "login/login";
}

@RequestMapping("/uTui")
public String uTui( HttpServletRequest request, HttpServletResponse response){
HttpSession session = request.getSession();
session.invalidate();
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
53
54
 * 
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(Car car, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<Car> pagers = carService.findByEntity(car);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", car);
return "car/car";
}

/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Car car, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
JSONObject js = new JSONObject();
Integer userId = Integer.valueOf(attribute.toString());
//分页查询
String sql = "SELECT * FROM car WHERE 1=1 and user_id = "+userId;
if(!isEmpty(car.getItemId())){
sql += " and itemId like '%"+car.getItemId()+"%'";
}
if(!isEmpty(car.getUserId())){
sql += " and userId like '%"+car.getUserId()+"%'";
}
if(!isEmpty(car.getNum())){
sql += " and num like '%"+car.getNum()+"%'";
}
if(!isEmpty(car.getTotal())){
sql += " and total like '%"+car.getTotal()+"%'";
}
sql += " ORDER BY ID DESC ";
List<Car> listBySqlReturnEntity = carService.listBySqlReturnEntity(sql);
model.addAttribute("list", listBySqlReturnEntity);
//存储查询条件
model.addAttribute("obj", car);
return "car/car";
}


/**
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





@Controller
@RequestMapping("/message")
public class MessageController extends BaseController {


/**
* 依赖注入 start dao/service/===
*/
@Autowired
private MessageService messageService;

// --------------------------------------- 华丽分割线 ------------------------------

/*********************************查询列表【不分页】***********************************************/

/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(Message message, Model model, HttpServletRequest request, HttpServletResponse response){
List<Message> listAll = messageService.listAll();
model.addAttribute("list", listAll);
return "message/message";
}

/**
* 【不分页=》查询列表=>有条件】


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