基于javaweb的SpringBoot+MyBatis网上订餐在线点餐管理系统(前台、后台)(java+springboot+ssm+jsp+mysql+maven)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

前台用户:查看菜品、点餐下单、确认收货、评论等……

后台管理员:管理用户、订单、分类、交易、公告等……

020123242502

前台

430123232502

440123232502

450123232502

470123232502

480123232502

490123232502

500123232502

510123232502

520123232502

后台

530123232502

540123232502

550123232502

560123232502

580123232502

590123232502

000123242502

010123242502

技术框架

SpringBoot SpringMVC MyBatis JSP JavaScript jQuery……

基于javaweb的SpringBoot+MyBatis网上订餐在线点餐管理系统(前台、后台)(java+springboot+ssm+jsp+mysql+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
 * 商品的最低价格(minprice)及最高价格(maxprice)
*/
@PostMapping("/findProductByCondition2")
public String findProductByCondition2(@RequestParam(required = true, defaultValue = "1") Integer page, String kindId, String product_name, String name, Double minprice, Double maxprice, Model model) {
PageHelper.startPage(page, 4);
List<Product> productConditionList = productService.findProductByCondition(product_name, name, minprice, maxprice);
List<Product> HotProductList = productService.findHotProductList();
PageInfo<Product> p = new PageInfo<Product>(productConditionList);
model.addAttribute("productList", productConditionList);
model.addAttribute("kindId", kindId);
model.addAttribute("HotProductList", HotProductList);
model.addAttribute("pages", p);
return "/pages/list/list2";
}
@GetMapping("/findProductByCategory")
public String findProductByCategory(@RequestParam(required = true, defaultValue = "1") Integer page,Integer kindId,Model model){
PageHelper.startPage(page, 4);
List<Product> productList = productService.findProductByCategory(kindId);
List<Product> HotProductList = productService.findHotProductList();
PageInfo<Product> p = new PageInfo<Product>(productList);
model.addAttribute("productList", productList);
model.addAttribute("kindId", kindId);
model.addAttribute("HotProductList", HotProductList);
model.addAttribute("pages", p);
return "/pages/list/list2";
}

/**
* 跳转到商品详情页面
* @return
*/
@GetMapping("/toDetail")
public String toDetail(Integer id, Model model){
//1-根据商品id查询商品信息
Product product = productService.findProductById(id);
//2-查询热门商品信息列表
List<Product> hotProductList = new ArrayList<>();
//2-1-从热门商品表中取出两个
productService.findProductBannerByCount(2).forEach(productBanner -> {
Product dbProduct = productService.findProductById(productBanner.getProductId());
if(dbProduct != null){
hotProductList.add(dbProduct);
}
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
      }

try {
FileItemIterator iterator = upload.getItemIterator(request);

while (iterator.hasNext()) {
fileStream = iterator.next();

if (!fileStream.isFormField())
break;
fileStream = null;
}

if (fileStream == null) {
return new BaseState(false, AppInfo.NOTFOUND_UPLOAD_DATA);
}

String savePath = (String) conf.get("savePath");
String originFileName = fileStream.getName();
String suffix = FileType.getSuffixByFilename(originFileName);

originFileName = originFileName.substring(0,
originFileName.length() - suffix.length());
savePath = savePath + suffix;

long maxSize = ((Long) conf.get("maxSize")).longValue();

if (!validType(suffix, (String[]) conf.get("allowFiles"))) {
return new BaseState(false, AppInfo.NOT_ALLOW_FILE_TYPE);
}

savePath = PathFormat.parse(savePath, originFileName);

String physicalPath = (String) conf.get("rootPath") + savePath;

InputStream is = fileStream.openStream();
State storageState = StorageManager.saveFileByInputStream(is,
physicalPath, maxSize);
is.close();

if (storageState.isSuccess()) {
storageState.putInfo("url", PathFormat.format(savePath));
storageState.putInfo("type", suffix);
storageState.putInfo("original", originFileName + suffix);
}

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
        List productKindList = productService.findAllProductKindNameList();
//6-用户留言表
List<Leave> leaveList = leaveService.findAllLeaveList();


model.addAttribute("productList",productList);
model.addAttribute("noticeList",validNoticeList);
model.addAttribute("hotProductList",hotProductList.stream().limit(3).collect(Collectors.toList()));
model.addAttribute("evaluateList",evaluateList);
model.addAttribute("productKindList",productKindList);
model.addAttribute("leaveList",leaveList);
return "/pages/index";
}
}
package com.demo.controller.web;



/**
公告相关controller
*/
@Controller
public class Back_NoticeController {
@Autowired
private NoticeService noticeService;

/**
* 展示公告列表
* @return
*/
@RequestMapping("/admin/toNoticeList")
public String sortAds(@RequestParam(required = true, defaultValue = "1") Integer page,Model model) {
PageHelper.startPage(page, 10);
List<Notice> noticeList = noticeService.findAll();
model.addAttribute("noticeList",noticeList);
PageInfo<Notice> p = new PageInfo<>(noticeList);
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
		return this.invoke();
}

}

public String invoke() {

if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString();
}

if ( this.configManager == null || !this.configManager.valid() ) {
return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString();
}

State state = null;

int actionCode = ActionMap.getType( this.actionType );

Map<String, Object> conf = null;

switch ( actionCode ) {

case ActionMap.CONFIG:
return this.configManager.getAllConfig().toString();

case ActionMap.UPLOAD_IMAGE:
case ActionMap.UPLOAD_SCRAWL:
case ActionMap.UPLOAD_VIDEO:
case ActionMap.UPLOAD_FILE:
conf = this.configManager.getConfig( actionCode );
state = new Uploader( request, conf ).doExec();
break;

case ActionMap.CATCH_IMAGE:
conf = configManager.getConfig( actionCode );
String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );
state = new ImageHunter( conf ).capture( list );
break;

case ActionMap.LIST_IMAGE:
case ActionMap.LIST_FILE:
conf = configManager.getConfig( actionCode );
int start = this.getStartIndex();
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
        int varCount = varList.size();
int rowIndex = 2;//第三行
for(int i=0; i<varCount; i++){
//初始参数
OrderExcelExportVO data = (OrderExcelExportVO)varList.get(i);
int colIndex = 0;//第一列
//1-订单序号
colIndex = ObjectExcelUtil.setSingleCellText(sheet,cell,rowIndex,colIndex,ObjectExcelUtil.showNullData(data.getId()),contentStyle);
//2-订单编号
colIndex = ObjectExcelUtil.setSingleCellText(sheet,cell,rowIndex,colIndex,ObjectExcelUtil.showNullData(data.getOrderId()),contentStyle);
//3-订单金额
colIndex = ObjectExcelUtil.setSingleCellText(sheet,cell,rowIndex,colIndex,ObjectExcelUtil.showNullData(data.getMoney()),contentStyle);
//4-收货人
colIndex = ObjectExcelUtil.setSingleCellText(sheet,cell,rowIndex,colIndex,ObjectExcelUtil.showNullData(data.getUserId()),contentStyle);
//5-收获地址
colIndex = ObjectExcelUtil.setSingleCellText(sheet,cell,rowIndex,colIndex,ObjectExcelUtil.showNullData(data.getAddressInfo()),contentStyle);
//6-下单时间
colIndex = ObjectExcelUtil.setSingleCellText(sheet,cell,rowIndex,colIndex,ObjectExcelUtil.showNullData(data.getOrderDate()),contentStyle);
//7-订单状态
colIndex = ObjectExcelUtil.setSingleCellText(sheet,cell,rowIndex,colIndex,ObjectExcelUtil.showNullData(data.getStatus()),contentStyle);
rowIndex ++;
}
}
}
package com.demo.controller.api;


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

/**

*/

@Controller
public class Back_LeaveController {

//留言信息处理
@Autowired
private LeaveService leaveService;
@Autowired
private UserService userService;


@RequestMapping("/admin/toLeaveList")
public String guestBook(Model model) {
List<Leave> list=leaveService.findAllLeaveList();
model.addAttribute("list",list);
return "/admin/leave/leave_list";
}
@RequestMapping("/admin/delete")
public String deleteById(String leaveId){
leaveService.deleteById(leaveId);
return "redirect:/admin/toLeaveList";
}

@RequestMapping("/admin/deleteAll")
public String deleteAll(@RequestParam("id") Integer[] leaveIds){
System.out.println(Arrays.toString(leaveIds));
leaveService.deleteAll(leaveIds);
return "redirect:/admin/toLeaveList";
}

@RequestMapping("/admin/openAll")
public String updateState(@RequestParam("id")Integer[] leaveIds){
System.out.print(leaveIds);
int status = 1;


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