Bläddra i källkod

修改bookID为Long

tianyun 3 år sedan
förälder
incheckning
edbac96e77

+ 1 - 1
book-server/src/main/java/com/book/server/service/BookService.java

@@ -15,7 +15,7 @@ public interface BookService {
 
     void insertBooks();
 
-    List<Chapter> getChaptersByBookId(String bookId);
+    List<Chapter> getChaptersByBookId(Long bookId);
 
     List<SearchKeyword> getSearchKeywordBySex(String sex);
 

+ 3 - 3
book-server/src/main/java/com/book/server/service/impl/BookServiceImpl.java

@@ -213,10 +213,10 @@ public class BookServiceImpl implements BookService {
     }
 
     @Override
-    public List<Chapter> getChaptersByBookId(String bookId) {
+    public List<Chapter> getChaptersByBookId(Long bookId) {
         List<Chapter> list = new ArrayList<>();
 
-        if (StringUtils.isEmpty(bookId)) {
+        if (bookId == null) {
             throw new IllegalArgumentException("bookId cannot be null or empty");
         }
         final String chaptersUrl = "http://new.emeixs.com/index.php/Home/Interface/chapters/bid/" + bookId;
@@ -226,7 +226,7 @@ public class BookServiceImpl implements BookService {
         }
         JsonParser parser = new JsonParser();
         JsonArray jsonArray = parser.parse(result).getAsJsonArray();
-        Book book = bookMapper.selectByPrimaryKey(Long.parseLong(bookId));
+        Book book = bookMapper.selectByPrimaryKey(bookId);
         if (book == null) {
             return list;
         }