Author Homepage: Programming Compass
About the author: High-quality creator in the Java field, CSDN blog expert, invited author of Nuggets, many years of architect design experience, resident lecturer in Tencent Classroom
Main content: Java project, graduation design, resume template, learning materials, interview question bank, technical mutual assistance
Favorites, likes, don't get lost, it's good to follow the author
Get the source code at the end of the article
Item number: BS-SC-054
1. Environmental introduction
Locale: Java: jdk1.8
Database: Mysql: mysql5.7
Application server: Tomcat: tomcat8.5.31
Development tools: IDEA or eclipse
Background development technology: springboot+mybatis+springmvc
Front-end development technology: HTML5+CSS+JQUERY+Bootstrap
2. Project introduction
This system is mainly developed and implemented based on the Springboot framework, and realizes a mall system with the theme of agricultural products. In this shopping mall system, functions such as online purchase of agricultural products, online payment, management of personal orders, management of personal delivery addresses, and confirmation of delivery can be realized. After browsing the agricultural products in the mall, the user can add the agricultural products to the shopping cart, and then place an order to pay for the purchase. After logging in, users can manage their shopping cart information, order information, delivery address information, etc. in the personal center. The full-text search function is also provided on the front-end page of the mall, and users can search for agricultural products that meet their needs according to the keywords of agricultural products.
The system also provides a powerful background management system. In the background management module, the management operations of registered users in the front desk can be realized, the order information of all users can be managed, and operations such as delivery can be performed according to the order payment status. It can also manage product classification, manage product information, and add product information in the form of graphics and text. In order to better understand the sales situation of commodities, echart is used in the background to realize the graphic report of commodity sales and the statistical report function of orders.
The system uses the Spring Security framework to manage the user login and authority authentication operations of the system to ensure the security of the system. This system has complete functions, simple and elegant pages, and correct operation, which is suitable for graduation design.
The front-end page is an important display window of the product, and it is also the main position for entering and interacting with users. The front-end page design should be beautiful and elegant, and the second should be fully functional. Now the entire business form is centered on user experience, and various businesses spend a lot of effort to give users a better experience. The front-end user interaction design of this project is based on asynchronous requests to improve system response time and user experience. In terms of functional design, it mainly satisfies functions such as browsing electronic products by category, adding shopping carts, placing orders for products, and managing personal orders. The details are shown in Figure 1 below:
picture
Figure 1 Front-end user use case diagram
The background data management function of the tea mall website based on Springboot mainly completes the management of relevant business data generated by the front-end page. For example, the management of registered users, the management of tea, the management of user orders, the management of product categories, etc. Background management can effectively help website operators view relevant information, etc., which is a crucial part. The use case diagram of the background management of the tea mall website based on Springboot is shown in Figure 2 below:
The agricultural product sales management system based on Springboot chooses a relational database to manage data. The system uses the methods and technologies provided by MySQL to design the determined logical structure of the database, with a better storage structure, etc., and design the corresponding database table.
(1) The content of the user information table (s_user) is information about users, including front-end user information and background management user information, which are distinguished by the field type, 0 means management, and 1 means ordinary users. The details are shown in Table 4.1 .
Table 4-1 s_user (user account table)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
user ID |
username |
varchar |
20 |
yes |
login name |
Password |
varchar |
20 |
yes |
login password |
Type |
Int |
1 |
No |
user type |
(2) The product type table (s_product_type) stores the type information of the product, mainly including the name, serial number and description information of the product category. The specific content is shown in Table 4.2.
Table 4-2 s_product_type (commodity classification table)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
classification number |
product_type_name |
varchar |
20 |
yes |
Category Name |
product_type_desc |
varchar |
50 |
yes |
Category description |
product_type_icon |
varchar |
100 |
No |
Category icons |
(3) The product information table (s_product) stores detailed information on tea, mainly including product name, display picture, sales price, product category, product detail picture, brand and specific function description information, etc. The specific content is shown in the table 4.3 shown.
Table 4-3 s_product (commodity information table)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
tea number |
product _name |
varchar |
20 |
yes |
tea name |
product_image |
varchar |
200 |
yes |
tea picture |
price |
double |
100 |
No |
tea price |
product_type |
varchar |
100 |
No |
tea type |
product_desc |
varchar |
100 |
No |
tea detail map |
create_time |
datetime |
0 |
No |
add time |
product_brand |
varchar |
100 |
No |
tea brand |
product_miaoshu |
varchar |
200 |
NO |
tea description |
(4) The product order table (s_order) stores the order information of the user to purchase the product, mainly including the order number, creation time, delivery address number, user number and status, etc. The specific content is shown in Table 4.4.
Table 4-4 s_order (commodity order table)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
order number |
create_time |
datetime |
0 |
yes |
order time |
receiving_address |
varchar |
50 |
yes |
Shipping address |
user_id |
varchar |
100 |
No |
Order user |
status |
Int |
11 |
NO |
Order Status |
(5) The product order details table (s_order_product) stores the order details of the products purchased by the user. It is associated with the order basic information table and includes the number and quantity of the purchased products. The specific content is shown in Table 4.5.
Table 4-5 s_order_product (commodity order details)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
Detail number |
order_id |
varchar |
32 |
yes |
order number |
product_id |
varchar |
32 |
yes |
product number |
product_num |
Int |
11 |
NO |
Quantity |
(6) The product brand table (s_brand) stores the brand information of the product purchased by the user. When releasing the product, it is necessary to specify its brand so that consumers can choose, mainly including the brand name, brand type, brand picture, etc. The specific content is shown in Table 4.6.
Table 4-6 s_brand (commodity brand table)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
brand number |
brand_name |
varchar |
32 |
yes |
brand name |
brand_type |
varchar |
32 |
yes |
brand type |
brand_img |
varchar |
200 |
NO |
brand image |
(7) The carousel image information table (s_carousel) stores the carousel image information displayed on the front end, etc. The specific content is shown in Table 4.7.
表4-6 s_carousel(轮播图信息表)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
主键编号 |
url |
varchar |
100 |
yes |
图片地址 |
sequence_num |
int |
2 |
NO |
序号 |
(8)收货地址信息表(s_receiving_address)的存储的是用户在线下单购买茶叶时指定收货地址信息,每个用户可以指定多个收货信息,也可以设置默认的收货地址等,具体内容包含收货地址、收件人名称,联系人电话,用户编号以及是否为默认地址等,如表4.8所示。
表4-8 s_receiving_address (收货信息表)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
地址编号 |
receiving_address |
varchar |
100 |
yes |
地址信息 |
receiving_person |
varchar |
100 |
yes |
收货人 |
mobile_phone |
bigint |
20 |
NO |
联系电话 |
user_id |
varchar |
32 |
NO |
用户编号 |
is_default |
int |
1 |
NO |
是否默认 |
(9)搜索历史信息表(s_search_history)的存储的是前端用户搜索的历史信息,根据用户关键词的信息给用户进行相应的进示,主要包含搜索关键词、搜索次数、搜索时间,如表4.9所示。
表4-9 s_search_history(搜索信息表)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
主键编号 |
search_words |
varchar |
100 |
yes |
搜索词 |
num |
int |
2 |
NO |
次数 |
search_time |
datetime |
0 |
NO |
搜索时间 |
(10)购物车信息表(s_shop_cart)的存储的是前端用户使用的购物车基本信息,如表4.10所示。
表4-10 s_shop_cart(购物车信息表)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
主键编号 |
Cart_id |
varchar |
64 |
yes |
购物车编号 |
User_id |
varchar |
64 |
NO |
用户编号 |
(11)购物车明细表(s_shop_cart_product)的存储的是前端用户使用的购物车中的详细信息,如表4.11所示。
表4-11 s_shop_cart_product(购物车详细信息表)
ColumnName |
Type |
Length |
IsNull |
Comment |
Id |
int |
11 |
no |
主键编号 |
shop_cart_id |
varchar |
64 |
yes |
购物车编号 |
product_id |
varchar |
64 |
NO |
茶叶编号 |
product_num |
int |
6 |
NO |
数量 |
三,系统展示
系统前端功能首页
注册
登录
分类查看
商品详情
购物车
收货地址管理
我的订单
全文检索
后台管理功能展示
轮播图管理
分类管理
品牌管理
商品管理
订单管理
图形报表统计
Fourth, the core code display
package com.yw.eshop.controller.admin;
import com.yw.eshop.domain.Brand;
import com.yw.eshop.domain.ProductType;
import com.yw.eshop.service.BrandService;
import com.yw.eshop.service.ProductTypeService;
import com.yw.eshop.utils.PageModel;
import com.yw.eshop.service.BrandService;
import com.yw.eshop.service.ProductTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* 品牌管理
*/
@Controller
@RequestMapping("/admin/brand")
public class BrandController {
@Autowired
private BrandService brandService;
@Autowired
private ProductTypeService productTypeService;
@RequestMapping("/list")
public String list( @RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "5")Integer pageSize,
Model model){
try {
PageModel<Brand> brandPages = brandService.queryBrandPages(pageNo, pageSize);
model.addAttribute("brandPages", brandPages);
} catch (Exception e) {
e.printStackTrace();
model.addAttribute("errMessage", "查询失败:"+e.getMessage());
return "500";
}
return "admin/brand/list";
}
@RequestMapping("addPage")
public String addPage(Model model){
List<ProductType> productTypes= productTypeService.queryProductTypeAll();
model.addAttribute("productTypes",productTypes);
return "admin/brand/add";
}
@RequestMapping("/add")
private String addBrand(Brand brand,Model model){
try {
int i = brandService.addBrand(brand);
if (i==0){
model.addAttribute("errMessage","服务器繁忙操作失败");
return "500";
}
}catch (Exception e){
model.addAttribute("errMessage",e.getMessage());
return "500";
}
model.addAttribute("url", "admin/brand/list");
return "success";
}
@RequestMapping("updatePage")
public String updatePage(String id,Model model){
Brand brand= brandService.queryBrandById(id);
List<ProductType> productTypes= productTypeService.queryProductTypeAll();
model.addAttribute("productTypes",productTypes);
model.addAttribute("brand",brand);
return "admin/brand/update";
}
@RequestMapping("/update")
private String update(Brand brand,Model model){
try {
int i = brandService.updateBrand(brand);
if (i==0){
model.addAttribute("errMessage","服务器繁忙操作失败");
return "500";
}
}catch (Exception e){
model.addAttribute("errMessage",e.getMessage());
return "500";
}
model.addAttribute("url", "admin/brand/list");
return "success";
}
@RequestMapping("deletePage")
public String deletePage(String id,Model model){
model.addAttribute("id",id);
return "admin/carousel/delete";
}
@RequestMapping("/delete")
public String delete(String id, Model model){
try {
int i = brandService.delete(id);
if (i==0){
model.addAttribute("errMessage","服务器繁忙操作失败");
return "500";
}
}catch (Exception e){
model.addAttribute("errMessage",e.getMessage());
return "500";
}
model.addAttribute("url", "admin/brand/list");
return "success";
}
@RequestMapping("batchDel")
@ResponseBody
public String batchDel(String[] ids) {
System.out.println("进来了");
brandService.batchProductTypeDel(ids);
return "/admin/brand/list";
}
}
package com.yw.eshop.controller.front;
import com.yw.eshop.domain.Order;
import com.yw.eshop.domain.OrderProduct;
import com.yw.eshop.domain.User;
import com.yw.eshop.service.OrderProductService;
import com.yw.eshop.service.OrderService;
import com.yw.eshop.service.OrderProductService;
import com.yw.eshop.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.List;
/**
* 前台订单控制器
*/
@Controller
@RequestMapping("front/order")
public class FrontOrderController {
@Autowired
private OrderService orderService;
@Autowired
private OrderProductService orderProductService;
/**
* 前台个人中心订单查询
* @param session
* @param model
* @return
*/
@RequestMapping("index")
private String index(HttpSession session, Model model){
try {
User user = (User) session.getAttribute("user");
if (user == null) {
return "redirect:/front/login/loginPage";
} else {
List<Order> list = orderService.queryAllOrder(user.getId());
for (Order order : list) {
List<OrderProduct> orderProducts = orderProductService.queryOrderProByOrderId(order.getId());
order.setList(orderProducts);
}
model.addAttribute("list", list);
return "front/order/order";
}
}catch (Exception e){
e.printStackTrace();
model.addAttribute("errMessage","服务器繁忙"+e.getMessage());
return "500";
}
}
/**
* 前台用户取消订单:条件是未发货状态
* @param id
* @param model
* @return
*/
@RequestMapping("/delete")
@ResponseBody
public String delete(String id, Model model){
model.addAttribute("id", id);
try {
int i = orderService.delete(id);
if (i==0){
model.addAttribute("errMessage","服务器繁忙操作失败");
return "500";
}
}catch (Exception e){
model.addAttribute("errMessage",e.getMessage());
return "500";
}
//return "forward:/front/order/index";
model.addAttribute("url", "/front/order/index");
return "success";
}
/**
* 前台用户确认收货:条件是己发货状态
* @param id
* @param model
* @return
*/
@RequestMapping("/update")
@ResponseBody
public String update(String id,Integer status, Model model){
model.addAttribute("id", id);
try {
int i = orderService.updateStatus(id,status);
if (i==0){
model.addAttribute("errMessage","服务器繁忙操作失败");
return "500";
}
}catch (Exception e){
model.addAttribute("errMessage",e.getMessage());
return "500";
}
//return "forward:/front/order/index";
model.addAttribute("url", "/front/order/index");
return "success";
}
}
V. Project Summary
This system is based on the Springboot development framework and integrates the Mybatis framework to implement an agricultural commodity sales management system. The front-end design is beautiful and generous, and the functions are complete. It is suitable for graduation design.