医案推荐图书
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.peanut.modules.book.entity.BookMedicalRecordsEntity;
|
||||
import com.peanut.modules.book.entity.UserEbookBuyEntity;
|
||||
import com.peanut.modules.book.service.BookMedicalRecordsService;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
import com.peanut.modules.book.service.UserEbookBuyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -22,12 +28,46 @@ public class BookMedicalRecordsController {
|
||||
|
||||
@Autowired
|
||||
private BookMedicalRecordsService bookMedicalRecordsService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
@Autowired
|
||||
private UserEbookBuyService userEbookBuyService;
|
||||
|
||||
/**
|
||||
* 已购图书列表
|
||||
*/
|
||||
@RequestMapping("/userEbookBuyList")
|
||||
public R userEbookBuyList(@RequestBody Map<String, Object> params){
|
||||
MPJLambdaWrapper<BookEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.selectAll(BookEntity.class);
|
||||
wrapper.leftJoin(UserEbookBuyEntity.class, UserEbookBuyEntity::getBookId,BookEntity::getId);
|
||||
wrapper.leftJoin(BookMedicalRecordsEntity.class,BookMedicalRecordsEntity::getBookId,BookEntity::getId);
|
||||
wrapper.eq(BookMedicalRecordsEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getState,1);
|
||||
wrapper.eq(UserEbookBuyEntity::getUserId,params.get("userId"));
|
||||
wrapper.groupBy(BookMedicalRecordsEntity::getBookId);
|
||||
IPage<BookEntity> page = bookService.page(
|
||||
new Query<BookEntity>().getPage(params),wrapper);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
/**
|
||||
* 推荐图书列表
|
||||
*/
|
||||
@RequestMapping("/recommendBookList")
|
||||
public R recommendBookList(@RequestBody Map<String, Object> params){
|
||||
List<BookEntity> list = bookMedicalRecordsService.getBooks((Integer) params.get("userId"));
|
||||
MPJLambdaWrapper<BookEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
IPage<BookEntity> page = bookService.page(
|
||||
new Query<BookEntity>().getPage(params),wrapper);
|
||||
page.setRecords(list);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
public R list(@RequestBody Map<String, Object> params){
|
||||
IPage<BookMedicalRecordsEntity> page = bookMedicalRecordsService.page(
|
||||
new Query<BookMedicalRecordsEntity>().getPage(params),
|
||||
new QueryWrapper<BookMedicalRecordsEntity>()
|
||||
|
||||
Reference in New Issue
Block a user