数据库第二次大作业boostore
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

140 行
3.6 KiB

<!DOCTYPE html>
<html id="htmlId">
<head>
<title>Coverage Report > OrderService</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.service.impl</a>
</div>
<h1>Coverage Summary for Class: OrderService (cn.edu.ecnu.stu.bookstore.service.impl)</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">OrderService</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">
87.5%
</span>
<span class="absValue">
(7/8)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package cn.edu.ecnu.stu.bookstore.service.impl;
&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.mapper.OrderMapper;
&nbsp;import cn.edu.ecnu.stu.bookstore.pojo.Order;
&nbsp;import cn.edu.ecnu.stu.bookstore.pojo.OrderStatus;
&nbsp;import cn.edu.ecnu.stu.bookstore.pojo.User;
&nbsp;import org.springframework.beans.factory.annotation.Autowired;
&nbsp;import org.springframework.security.core.context.SecurityContextHolder;
&nbsp;import org.springframework.stereotype.Service;
&nbsp;import org.springframework.web.bind.annotation.RequestParam;
&nbsp;
&nbsp;import java.util.List;
&nbsp;
&nbsp;@Service
<b class="fc">&nbsp;public class OrderService {</b>
&nbsp;
&nbsp; @Autowired
&nbsp; private OrderMapper orderMapper;
&nbsp;
&nbsp; public List&lt;Order&gt; getOrderList(Integer status) {
<b class="fc">&nbsp; User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();</b>
<b class="fc">&nbsp; return orderMapper.select(user.getId(), status == null ? null : OrderStatus.getByValue(status));</b>
&nbsp; }
&nbsp;
&nbsp; public void cancelOrder(String orderId) {
<b class="fc">&nbsp; User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();</b>
<b class="fc">&nbsp; if(orderMapper.checkOrder(orderId, user.getId()) != 1)</b>
<b class="nc">&nbsp; throw new AppException(Constants.CLIENT_ERROR, Constants.AUTHORITY_ERROR);</b>
<b class="fc">&nbsp; orderMapper.updateOrderStatus(orderId, OrderStatus.CANCEL);</b>
&nbsp; }
&nbsp;
&nbsp; public void add(Order order) {
<b class="fc">&nbsp; orderMapper.insert(order);</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 12:29</div>
</div>
</body>
</html>