基于javaweb的SSM宠物商城系统(java+ssm+jsp+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

092323431807

112323431807

122323431807

132323431807

142323431807

152323431807

基于javaweb的SSM宠物商城系统(java+ssm+jsp+jquery+mysql)

项目介绍

该系统主要分为前台和后台两大功能模块,共包含两个角色:用户、管理员。

具体的系统功能如下: 1.前台功能 前台首页、宠物商品展示、宠物搜索、宠物分类查找、宠物详情、网站公告、特价商品、推荐商品、全部商品、查看更多商品、加入购物车、确认订购信息、修改购物车、 支付结算、清空购物车、提交订单、用户注册、用户登陆、用户中心、修改个人信息、修改密码、我的订单、订单详情、用户留言、我的留言等功能。 2.后台功能 后台系统登陆、用户信息管理、管理员管理、宠物分类管理、宠物信息管理、订单信息管理、订单明细管理、用户留言管理、新闻公告管理等功能。

环境需要

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/8.0等版本均可;

技术栈

后台框架:Spring、SpringMVC、MyBatis UI界面:JSP、jQuery 数据库:MySQL

使用说明

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

  2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;

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
		valueList.add(name);
PageHelper.getPage(this.ordersService.getOrdersByLike(orders), "orders", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryorders";
}

// 按主键查询数据
@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 = "/goods", produces = "text/plain;charset=utf-8")
public class GoodsAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private GoodsService goodsService;
@Autowired
@Resource
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
		this.articleService.deleteArticle(articleid);
}
return "redirect:/article/getAllArticle.action";
}

// 更新数据
@RequestMapping("updateArticle.action")
public String updateArticle(Article article) {
this.articleService.updateArticle(article);
return "redirect:/article/getAllArticle.action";
}

// 显示全部数据
@RequestMapping("getAllArticle.action")
public String getAllArticle(String number) {
List<Article> articleList = this.articleService.getAllArticle();
PageHelper.getPage(articleList, "article", null, null, 10, number, this.getRequest(), null);
return "admin/listarticle";
}

// 按条件查询数据 (模糊查询)
@RequestMapping("queryArticleByCond.action")
public String queryArticleByCond(String cond, String name, String number) {
Article article = new Article();
if (cond != null) {
if ("title".equals(cond)) {
article.setTitle(name);
}
if ("image".equals(cond)) {
article.setImage(name);
}
if ("contents".equals(cond)) {
article.setContents(name);
}
if ("addtime".equals(cond)) {
article.setAddtime(name);
}
if ("hits".equals(cond)) {
article.setHits(name);
}
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
}

// 更新数据
@RequestMapping("updateGoods.action")
public String updateGoods(Goods goods) {
this.goodsService.updateGoods(goods);
return "redirect:/goods/getAllGoods.action";
}

// 显示全部数据
@RequestMapping("getAllGoods.action")
public String getAllGoods(String number) {
List<Goods> goodsList = this.goodsService.getAllGoods();
PageHelper.getPage(goodsList, "goods", null, null, 10, number, this.getRequest(), null);
return "admin/listgoods";
}

// 按条件查询数据 (模糊查询)
@RequestMapping("queryGoodsByCond.action")
public String queryGoodsByCond(String cond, String name, String number) {
Goods goods = new Goods();
if (cond != null) {
if ("goodsname".equals(cond)) {
goods.setGoodsname(name);
}
if ("image".equals(cond)) {
goods.setImage(name);
}
if ("cateid".equals(cond)) {
goods.setCateid(name);
}
if ("price".equals(cond)) {
goods.setPrice(name);
}
if ("special".equals(cond)) {
goods.setSpecial(name);
}
if ("recommend".equals(cond)) {
goods.setRecommend(name);
}
if ("storage".equals(cond)) {
goods.setStorage(name);
}
if ("addtime".equals(cond)) {
goods.setAddtime(name);
}
if ("sellnum".equals(cond)) {
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
	complains.setStatus("");
this.complainsService.insertComplains(complains);
return "redirect:/complains/createComplains.action";
}

// 通过主键删除数据
@RequestMapping("deleteComplains.action")
public String deleteComplains(String id) {
this.complainsService.deleteComplains(id);
return "redirect:/complains/getAllComplains.action";
}

// 批量删除数据
@RequestMapping("deleteComplainsByIds.action")
public String deleteComplainsByIds() {
String[] ids = this.getRequest().getParameterValues("complainsid");
for (String complainsid : ids) {
this.complainsService.deleteComplains(complainsid);
}
return "redirect:/complains/getAllComplains.action";
}

// 更新数据
@RequestMapping("updateComplains.action")
public String updateComplains(Complains complains) {
this.complainsService.updateComplains(complains);
return "redirect:/complains/getAllComplains.action";
}

// 显示全部数据
@RequestMapping("getAllComplains.action")
public String getAllComplains(String number) {
List<Complains> complainsList = this.complainsService.getAllComplains();
PageHelper.getPage(complainsList, "complains", null, null, 10, number, this.getRequest(), null);
return "admin/listcomplains";
}

// 按条件查询数据 (模糊查询)
@RequestMapping("queryComplainsByCond.action")
public String queryComplainsByCond(String cond, String name, String number) {
Complains complains = new Complains();
if (cond != null) {
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
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/items", produces = "text/plain;charset=utf-8")
public class ItemsAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private ItemsService itemsService;

// 准备添加数据
@RequestMapping("createItems.action")
public String createItems() {
return "admin/additems";
}

// 添加数据
@RequestMapping("addItems.action")
public String addItems(Items items) {
this.itemsService.insertItems(items);
return "redirect:/items/createItems.action";
}

// 通过主键删除数据
@RequestMapping("deleteItems.action")
public String deleteItems(String id) {
this.itemsService.deleteItems(id);
return "redirect:/items/getAllItems.action";
}

// 批量删除数据
@RequestMapping("deleteItemsByIds.action")
public String deleteItemsByIds() {
String[] ids = this.getRequest().getParameterValues("itemsid");
for (String itemsid : ids) {
this.itemsService.deleteItems(itemsid);
}
return "redirect:/items/getAllItems.action";
}

// 更新数据
@RequestMapping("updateItems.action")
public String updateItems(Items items) {
this.itemsService.updateItems(items);
return "redirect:/items/getAllItems.action";
}

// 显示全部数据
@RequestMapping("getAllItems.action")
public String getAllItems(String number) {
List<Items> itemsList = this.itemsService.getAllItems();
PageHelper.getPage(itemsList, "items", null, null, 10, number, this.getRequest(), null);
return "admin/listitems";
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
		buffer.append("下一页");
} else {
buffer.append("<a href=\"" + name + "/" + action + "?number=" + (Integer.parseInt(number) + 1) + "" + path + "\" style=\"color: #c5d52b;\">下一页</a>");
}
buffer.append("&nbsp;&nbsp;");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("尾页");
} else {
buffer.append("<a href=\"" + name + "/" + action + "?number=" + (maxPage - 1) + "" + path + "\" style=\"color: #c5d52b;\">尾页</a>");
}
String html = buffer.toString();
request.setAttribute("html", html);
request.setAttribute(name + "List", objList);
}

public static void getUserPage(List<?> list, String name, String actionName, int pageSize, String number, HttpServletRequest request) {
StringBuffer buffer = new StringBuffer();
String path = "";
String action = actionName + ".action";
List<Object> objList = new ArrayList<Object>();
int pageNumber = list.size();
int maxPage = pageNumber;
if (maxPage % pageSize == 0) {
maxPage = maxPage / pageSize;
} else {
maxPage = maxPage / pageSize + 1;
}
if (number == null) {
number = "0";
}
int start = Integer.parseInt(number) * pageSize;
int over = (Integer.parseInt(number) + 1) * pageSize;
int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; i++) {
Object obj = list.get(i);
objList.add(obj);
}
buffer.append("&nbsp;&nbsp;共为");
buffer.append(maxPage);
buffer.append("页&nbsp; 共有");
buffer.append(pageNumber);


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