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 ddl, modify createTime when new order, show createdTime]
  • Loading branch information
yennanliu committed Oct 15, 2023
commit b4ea5e6a5e373aabd011b5b7268f3ef6dbdd98c0
8 changes: 4 additions & 4 deletions springWarehouse/sql/ddl/product.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ CREATE TABLE IF NOT EXISTS product(
);

-- DML
INSERT INTO product(name, type_id, price, merchant_id, product_status)
INSERT INTO product(name, type_id, price, merchant_id, amount, product_status)
VALUES
("i-phone", 2, 300, 1, "0"),
("cookie2", 4, 10, 2, "0"),
("soap", 1, 50, 1, "0");
("i-phone", 2, 300, 1, 3, "0"),
("cookie2", 4, 10, 2, 2, "0"),
("soap", 1, 50, 1, 1, "0");
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.Map;

@Slf4j
Expand Down Expand Up @@ -50,6 +51,7 @@ public String create(Order order) {
}

order.setStatus(OrderStatus.Pending.getMsg());
order.setCreateTime(LocalDateTime.now());
log.info("(OrderController.create) Create new order : " + order.toString());
orderService.save(order);
return "redirect:/order/list";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ <h3 class="title">Order Management</h3>
<th>Product Id</th>
<th>Amount</th>
<th>Status</th>
<th>Created time</th>
</tr>
<tr class="type" th:each="order : ${page.records}">
<td th:text="${order.id}" nowrap></td>
<td id="merchant" th:text="${order.merchantId}" nowrap></td>
<td id="product" th:text="${order.productId}" nowrap></td>
<td id="amount" th:text="${order.amount}" nowrap></td>
<td id="status" th:text="${order.status}" nowrap></td>
<td id="createTime" th:text="${order.createTime}" 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})}">Cancel Order</button>
Expand Down