Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix order update html, update orderController, update list order html
  • Loading branch information
yennanliu committed Oct 15, 2023
commit 1337dd8f1385f517211743369129836ee40bb66b
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yen.springWarehouse.bean.Order;
import com.yen.springWarehouse.bean.Product;
import com.yen.springWarehouse.bean.ProductType;
import com.yen.springWarehouse.service.MerchantService;
import com.yen.springWarehouse.service.OrderService;
import com.yen.springWarehouse.service.ProductService;
Expand Down Expand Up @@ -77,13 +75,22 @@ public String list(Map<String, Object> map, @RequestParam(value="pageNo", requir
return "order/list_order";
}

// TODO : only allow cancel if order status is "uncompleted"
@PostMapping(value="/remove/{orderNo}")
public String remove(@PathVariable("orderNo") String orderNo) {

orderService.removeById(orderNo);
return "redirect:/order/list";
}

// TODO : only allow update if order status is "uncompleted"
@GetMapping(value="/preUpdate/{orderNo}")
public String preUpdate(@PathVariable("orderNo") String orderNo, Map<String, Object> map) {

Order order = orderService.getById(orderNo);
map.put("order" , order);
map.put("orderList", orderService.list());
return "product/update_order";
return "order/update_order";
}

@PostMapping(value="/update")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h3 class="title">Order Management</h3>
<td id="amount" th:text="${order.amount}" nowrap></td>
<td nowrap>
<button class="update" th:href="@{/order/preUpdate/{id}(id=${order.id})}" >修改</button>
<button class="delete" th:href="@{/order/remove/{id}(id=${order.id})}">删除</button>
<button class="delete" th:href="@{/order/remove/{id}(id=${order.id})}">Cancel Order</button>
</td>
</tr>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>modify merchant</title>
<title>modify order</title>
<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}" />
<script type="text/javascript" th:src="@{/js/jquery-3.1.1.min.js}"></script>
</head>
<body style="padding:8px;">
<h3 class="title">modify merchant</h3>
<form th:action="@{/merchant/update}" method="post" th:object="${merchant}">
<h3 class="title">modify order</h3>
<form th:action="@{/order/update}" method="post" th:object="${order}">
<input type="hidden" name="_method" value="PUT"/>
<input type="hidden" name="id" th:value="*{id}">
<div>
<span>Merchant name:</span>
<input type="text" name="name" th:value="*{name}" placeholder="Merchant name">
</div>
<div>
<span>Merchant city:</span>
<input type="text" name="city" th:value="*{city}" placeholder="Merchant city">
<span>Order merchantId:</span>
<input type="text" name="merchantId" th:value="*{merchantId}" placeholder="merchantId">
</div>
<!-- <div>
<span>Order city:</span>
<input type="text" name="city" th:value="*{city}" placeholder="Order city">
</div> -->
<div>
<input type="submit" value=" 确定 "/>
</div>
Expand Down