数据库第二次大作业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 lines
3.8 KiB

<!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">&nbsp;package cn.edu.ecnu.stu.bookstore.controller;
&nbsp;
&nbsp;import cn.edu.ecnu.stu.bookstore.component.AppException;
&nbsp;import cn.edu.ecnu.stu.bookstore.component.Constants;
&nbsp;import cn.edu.ecnu.stu.bookstore.component.Result;
&nbsp;import cn.edu.ecnu.stu.bookstore.pojo.Order;
&nbsp;import cn.edu.ecnu.stu.bookstore.service.impl.OrderService;
&nbsp;import org.springframework.beans.factory.annotation.Autowired;
&nbsp;import org.springframework.util.StringUtils;
&nbsp;import org.springframework.web.bind.annotation.*;
&nbsp;
&nbsp;import java.util.Map;
&nbsp;
&nbsp;@RestController
&nbsp;@RequestMapping(&quot;/order&quot;)
<b class="fc">&nbsp;public class OrderController {</b>
&nbsp;
&nbsp; @Autowired
&nbsp; private OrderService orderService;
&nbsp;
&nbsp; @GetMapping(&quot;/&quot;)
&nbsp; public Result getOrderList(@RequestParam(value = &quot;status&quot;, required = false) Integer status) {
<b class="fc">&nbsp; return Result.success(orderService.getOrderList(status));</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;/cancel_order&quot;)
&nbsp; public Result cancelOrder(@RequestBody Map&lt;String, Object&gt; map) {
<b class="fc">&nbsp; Object orderIdObj = map.get(&quot;orderId&quot;);</b>
<b class="fc">&nbsp; if(orderIdObj == null)</b>
<b class="nc">&nbsp; throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
<b class="fc">&nbsp; String orderId = (String) orderIdObj;</b>
<b class="fc">&nbsp; if(!StringUtils.hasText(orderId))</b>
<b class="nc">&nbsp; throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
<b class="fc">&nbsp; orderService.cancelOrder(orderId);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;/add&quot;)
&nbsp; public Result add(@RequestBody Order order) {
<b class="fc">&nbsp; orderService.add(order);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;}
</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>