关联书

This commit is contained in:
wangjinlei
2024-01-04 10:32:34 +08:00
parent 62bc356219
commit 812ee419ba
4 changed files with 23 additions and 3 deletions

View File

@@ -274,18 +274,25 @@ public class BookController {
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody BookEntity book) {
bookService.updateById(book);
return R.ok();
}
/**
* 获取全部古籍书
* @return
*/
public R getAncientBooks(){
List<BookEntity> ancientBooks = bookService.getAncientBooks();
return R.ok().put("books",ancientBooks);
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) {
bookService.removeByIds(Arrays.asList(ids));

View File

@@ -104,6 +104,9 @@ public class BookEntity implements Serializable {
* 父id
*/
private Integer pid;
private Integer relationId;
/**
* 层级
*/

View File

@@ -5,6 +5,7 @@ import com.peanut.common.utils.PageUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.modules.book.entity.BookEntity;
import java.awt.print.Book;
import java.util.List;
import java.util.Map;
@@ -43,7 +44,7 @@ public interface BookService extends IService<BookEntity> {
Page<BookEntity> getUserClockBooks(Integer userId, Integer limit, Integer page);
List<BookEntity> getAncientBooks();
Page<BookEntity> getUserClockBestBooks(Integer userId, Integer limit, Integer page);
}

View File

@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.awt.print.Book;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -597,6 +598,14 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
}
@Override
public List<BookEntity> getAncientBooks() {
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getBookType,1);
List<BookEntity> list = list(wrapper);
return list;
}
@Override
public Page<BookEntity> getUserClockBestBooks(Integer userId, Integer limit, Integer page) {
String exist_sql = "select 1 from user_ebook_buy where book_id = book.id and user_id = " + userId;