数据库第二次大作业boostore
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 regels
3.8 KiB

11 maanden geleden
  1. <!DOCTYPE html>
  2. <html id="htmlId">
  3. <head>
  4. <title>Coverage Report > OrderController</title>
  5. <style type="text/css">
  6. @import "../../css/coverage.css";
  7. @import "../../css/idea.min.css";
  8. </style>
  9. <script type="text/javascript" src="../../js/highlight.min.js"></script>
  10. <script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
  11. </head>
  12. <body>
  13. <div class="content">
  14. <div class="breadCrumbs">
  15. Current scope: <a href="../../index.html">all classes</a>
  16. <span class="separator">|</span>
  17. <a href="../index.html">cn.edu.ecnu.stu.bookstore.controller</a>
  18. </div>
  19. <h1>Coverage Summary for Class: OrderController (cn.edu.ecnu.stu.bookstore.controller)</h1>
  20. <table class="coverageStats">
  21. <tr>
  22. <th class="name">Class</th>
  23. <th class="coverageStat
  24. ">
  25. Class, %
  26. </th>
  27. <th class="coverageStat
  28. ">
  29. Method, %
  30. </th>
  31. <th class="coverageStat
  32. ">
  33. Line, %
  34. </th>
  35. </tr>
  36. <tr>
  37. <td class="name">OrderController</td>
  38. <td class="coverageStat">
  39. <span class="percent">
  40. 100%
  41. </span>
  42. <span class="absValue">
  43. (1/1)
  44. </span>
  45. </td>
  46. <td class="coverageStat">
  47. <span class="percent">
  48. 100%
  49. </span>
  50. <span class="absValue">
  51. (4/4)
  52. </span>
  53. </td>
  54. <td class="coverageStat">
  55. <span class="percent">
  56. 83.3%
  57. </span>
  58. <span class="absValue">
  59. (10/12)
  60. </span>
  61. </td>
  62. </tr>
  63. </table>
  64. <br/>
  65. <br/>
  66. <pre>
  67. <code class="sourceCode" id="sourceCode">&nbsp;package cn.edu.ecnu.stu.bookstore.controller;
  68. &nbsp;
  69. &nbsp;import cn.edu.ecnu.stu.bookstore.component.AppException;
  70. &nbsp;import cn.edu.ecnu.stu.bookstore.component.Constants;
  71. &nbsp;import cn.edu.ecnu.stu.bookstore.component.Result;
  72. &nbsp;import cn.edu.ecnu.stu.bookstore.pojo.Order;
  73. &nbsp;import cn.edu.ecnu.stu.bookstore.service.impl.OrderService;
  74. &nbsp;import org.springframework.beans.factory.annotation.Autowired;
  75. &nbsp;import org.springframework.util.StringUtils;
  76. &nbsp;import org.springframework.web.bind.annotation.*;
  77. &nbsp;
  78. &nbsp;import java.util.Map;
  79. &nbsp;
  80. &nbsp;@RestController
  81. &nbsp;@RequestMapping(&quot;/order&quot;)
  82. <b class="fc">&nbsp;public class OrderController {</b>
  83. &nbsp;
  84. &nbsp; @Autowired
  85. &nbsp; private OrderService orderService;
  86. &nbsp;
  87. &nbsp; @GetMapping(&quot;/&quot;)
  88. &nbsp; public Result getOrderList(@RequestParam(value = &quot;status&quot;, required = false) Integer status) {
  89. <b class="fc">&nbsp; return Result.success(orderService.getOrderList(status));</b>
  90. &nbsp; }
  91. &nbsp;
  92. &nbsp; @PostMapping(&quot;/cancel_order&quot;)
  93. &nbsp; public Result cancelOrder(@RequestBody Map&lt;String, Object&gt; map) {
  94. <b class="fc">&nbsp; Object orderIdObj = map.get(&quot;orderId&quot;);</b>
  95. <b class="fc">&nbsp; if(orderIdObj == null)</b>
  96. <b class="nc">&nbsp; throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
  97. <b class="fc">&nbsp; String orderId = (String) orderIdObj;</b>
  98. <b class="fc">&nbsp; if(!StringUtils.hasText(orderId))</b>
  99. <b class="nc">&nbsp; throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
  100. <b class="fc">&nbsp; orderService.cancelOrder(orderId);</b>
  101. <b class="fc">&nbsp; return Result.success();</b>
  102. &nbsp; }
  103. &nbsp;
  104. &nbsp; @PostMapping(&quot;/add&quot;)
  105. &nbsp; public Result add(@RequestBody Order order) {
  106. <b class="fc">&nbsp; orderService.add(order);</b>
  107. <b class="fc">&nbsp; return Result.success();</b>
  108. &nbsp; }
  109. &nbsp;}
  110. </code>
  111. </pre>
  112. </div>
  113. <script type="text/javascript">
  114. (function() {
  115. var msie = false, msie9 = false;
  116. /*@cc_on
  117. msie = true;
  118. @if (@_jscript_version >= 9)
  119. msie9 = true;
  120. @end
  121. @*/
  122. if (!msie || msie && msie9) {
  123. hljs.highlightAll()
  124. hljs.initLineNumbersOnLoad();
  125. }
  126. })();
  127. </script>
  128. <div class="footer">
  129. <div style="float:right;">generated on 2023-12-12 18:32</div>
  130. </div>
  131. </body>
  132. </html>