|
|
-
-
-
- <!DOCTYPE html>
- <html id="htmlId">
- <head>
- <title>Coverage Report > OrderController</title>
- <style type="text/css">
- @import "../../css/coverage.css";
- @import "../../css/idea.min.css";
- </style>
- <script type="text/javascript" src="../../js/highlight.min.js"></script>
- <script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
- </head>
-
- <body>
- <div class="content">
- <div class="breadCrumbs">
- Current scope: <a href="../../index.html">all classes</a>
- <span class="separator">|</span>
- <a href="../index.html">cn.edu.ecnu.stu.bookstore.controller</a>
- </div>
-
- <h1>Coverage Summary for Class: OrderController (cn.edu.ecnu.stu.bookstore.controller)</h1>
-
- <table class="coverageStats">
- <tr>
- <th class="name">Class</th>
- <th class="coverageStat
- ">
- Class, %
- </th>
- <th class="coverageStat
- ">
- Method, %
- </th>
- <th class="coverageStat
- ">
- Line, %
- </th>
- </tr>
- <tr>
- <td class="name">OrderController</td>
- <td class="coverageStat">
- <span class="percent">
- 100%
- </span>
- <span class="absValue">
- (1/1)
- </span>
- </td>
- <td class="coverageStat">
- <span class="percent">
- 100%
- </span>
- <span class="absValue">
- (4/4)
- </span>
- </td>
- <td class="coverageStat">
- <span class="percent">
- 83.3%
- </span>
- <span class="absValue">
- (10/12)
- </span>
- </td>
- </tr>
-
- </table>
-
- <br/>
- <br/>
-
-
- <pre>
- <code class="sourceCode" id="sourceCode"> package cn.edu.ecnu.stu.bookstore.controller;
-
- import cn.edu.ecnu.stu.bookstore.component.AppException;
- import cn.edu.ecnu.stu.bookstore.component.Constants;
- import cn.edu.ecnu.stu.bookstore.component.Result;
- import cn.edu.ecnu.stu.bookstore.pojo.Order;
- import cn.edu.ecnu.stu.bookstore.service.impl.OrderService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.util.StringUtils;
- import org.springframework.web.bind.annotation.*;
-
- import java.util.Map;
-
- @RestController
- @RequestMapping("/order")
- <b class="fc"> public class OrderController {</b>
-
- @Autowired
- private OrderService orderService;
-
- @GetMapping("/")
- public Result getOrderList(@RequestParam(value = "status", required = false) Integer status) {
- <b class="fc"> return Result.success(orderService.getOrderList(status));</b>
- }
-
- @PostMapping("/cancel_order")
- public Result cancelOrder(@RequestBody Map<String, Object> map) {
- <b class="fc"> Object orderIdObj = map.get("orderId");</b>
- <b class="fc"> if(orderIdObj == null)</b>
- <b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
- <b class="fc"> String orderId = (String) orderIdObj;</b>
- <b class="fc"> if(!StringUtils.hasText(orderId))</b>
- <b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
- <b class="fc"> orderService.cancelOrder(orderId);</b>
- <b class="fc"> return Result.success();</b>
- }
-
- @PostMapping("/add")
- public Result add(@RequestBody Order order) {
- <b class="fc"> orderService.add(order);</b>
- <b class="fc"> return Result.success();</b>
- }
- }
- </code>
- </pre>
- </div>
-
- <script type="text/javascript">
- (function() {
- var msie = false, msie9 = false;
- /*@cc_on
- msie = true;
- @if (@_jscript_version >= 9)
- msie9 = true;
- @end
- @*/
-
- if (!msie || msie && msie9) {
- hljs.highlightAll()
- hljs.initLineNumbersOnLoad();
- }
- })();
- </script>
-
- <div class="footer">
-
- <div style="float:right;">generated on 2023-12-12 18:32</div>
- </div>
- </body>
- </html>
|