数据库第二次大作业boostore
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

158 Zeilen
4.4 KiB

<!DOCTYPE html>
<html id="htmlId">
<head>
<title>Coverage Report > SellerController</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: SellerController (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">SellerController</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">
(5/5)
</span>
</td>
<td class="coverageStat">
<span class="percent">
93.3%
</span>
<span class="absValue">
(14/15)
</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.Book;
&nbsp;import cn.edu.ecnu.stu.bookstore.pojo.Store;
&nbsp;import cn.edu.ecnu.stu.bookstore.service.SellerService;
&nbsp;import com.alibaba.fastjson.JSONObject;
&nbsp;import org.springframework.beans.factory.annotation.Autowired;
&nbsp;import org.springframework.util.StringUtils;
&nbsp;import org.springframework.web.bind.annotation.PostMapping;
&nbsp;import org.springframework.web.bind.annotation.RequestBody;
&nbsp;import org.springframework.web.bind.annotation.RequestMapping;
&nbsp;import org.springframework.web.bind.annotation.RestController;
&nbsp;
&nbsp;import java.util.Map;
&nbsp;
&nbsp;@RestController
&nbsp;@RequestMapping(&quot;/seller&quot;)
<b class="fc">&nbsp;public class SellerController {</b>
&nbsp;
&nbsp; @Autowired
&nbsp; public SellerService sellerService;
&nbsp;
&nbsp; @PostMapping(&quot;/create_store&quot;)
&nbsp; public Result createStore(@RequestBody Store store) {
<b class="fc">&nbsp; sellerService.createStore(store);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;add_book&quot;)
&nbsp; public Result addBook(@RequestBody Book book) {
<b class="fc">&nbsp; sellerService.addBook(book);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;add_stock_level&quot;)
&nbsp; public Result addStockLevel(@RequestBody JSONObject body) {
<b class="fc">&nbsp; String storeId = body.getString(&quot;storeId&quot;);</b>
<b class="fc">&nbsp; String bookId = body.getString(&quot;bookId&quot;);</b>
<b class="fc">&nbsp; int addStockLevel = body.getIntValue(&quot;addStockLevel&quot;);</b>
<b class="fc">&nbsp; sellerService.addStockLevel(storeId, bookId, addStockLevel);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;send_goods&quot;)
&nbsp; public Result sendGoods(@RequestBody Map&lt;String, String&gt; body) {
<b class="fc">&nbsp; String orderId = body.get(&quot;orderId&quot;);</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; sellerService.sendGoods(orderId);</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>