|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html id="htmlId">
|
|
<head>
|
|
<title>Coverage Report > BookController</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: BookController (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">BookController</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">
|
|
(9/9)
|
|
</span>
|
|
</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
68%
|
|
</span>
|
|
<span class="absValue">
|
|
(17/25)
|
|
</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.service.impl.BookService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@RestController
|
|
@RequestMapping("/book")
|
|
<b class="fc"> public class BookController {</b>
|
|
|
|
@Autowired
|
|
private BookService bookService;
|
|
|
|
@GetMapping("/title")
|
|
public Result getBookByTitle(@RequestParam("title") String title,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(title))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByTitle(title, null, pageNum, pageSize));</b>
|
|
}
|
|
|
|
@GetMapping("/title_in_store")
|
|
public Result getBookByTitleInStore(@RequestParam("title") String title,
|
|
@RequestParam("storeId") String storeId,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(title))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByTitle(title, storeId, pageNum, pageSize));</b>
|
|
}
|
|
|
|
@GetMapping("/author")
|
|
public Result getBookByAuthor(@RequestParam("author") String author,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(author))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByAuthor(author, null, pageNum, pageSize));</b>
|
|
}
|
|
|
|
@GetMapping("/author_in_store")
|
|
public Result getBookByAuthorInStore(@RequestParam("author") String author,
|
|
@RequestParam("storeId") String storeId,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(author))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByAuthor(author, storeId, pageNum, pageSize));</b>
|
|
}
|
|
|
|
@GetMapping("/tag")
|
|
public Result getBookByTag(@RequestParam("tag") String tag,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(tag))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByTag(tag, null, pageNum, pageSize));</b>
|
|
}
|
|
|
|
@GetMapping("/tag_in_store")
|
|
public Result getBookByTagInStore(@RequestParam("tag") String tag,
|
|
@RequestParam("storeId") String storeId,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(tag))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByTag(tag, storeId, pageNum, pageSize));</b>
|
|
}
|
|
|
|
@GetMapping("/content_in_store")
|
|
public Result getBookByContentInStore(@RequestParam("content") String content,
|
|
@RequestParam("storeId") String storeId,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(content))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByContent(content, storeId, pageNum, pageSize));</b>
|
|
}
|
|
|
|
@GetMapping("/content")
|
|
public Result getBookByContent(@RequestParam("content") String content,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize) {
|
|
<b class="fc"> if(!StringUtils.hasText(content))</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
|
|
<b class="fc"> return Result.success(bookService.getBookByContent(content, null, pageNum, pageSize));</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>
|