医案推荐图书
This commit is contained in:
@@ -3,6 +3,7 @@ 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.common.utils.R;
|
||||
@@ -12,6 +13,7 @@ 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 com.peanut.modules.book.vo.UserOrderVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -56,11 +58,11 @@ public class BookMedicalRecordsController {
|
||||
*/
|
||||
@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);
|
||||
List<BookEntity> list = bookMedicalRecordsService.getBooks(params);
|
||||
Page<BookEntity> page = new Page<>();
|
||||
page.setRecords(list);
|
||||
page.setTotal(list.size());
|
||||
page.setPages(Math.round(list.size()/page.getSize()));
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,6 @@ public interface BookMedicalRecordsDao extends MPJBaseMapper<BookMedicalRecordsE
|
||||
|
||||
|
||||
|
||||
List<BookEntity> getBooks(Integer userId);
|
||||
List<BookEntity> getBooks(Integer page,Integer limit,Integer userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ import java.util.Map;
|
||||
public interface BookMedicalRecordsService extends IService<BookMedicalRecordsEntity> {
|
||||
|
||||
|
||||
List<BookEntity> getBooks(Integer userId);
|
||||
List<BookEntity> getBooks(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,10 @@ public class BookMedicalRecordsServiceImpl extends ServiceImpl<BookMedicalRecord
|
||||
private BookMedicalRecordsDao dao;
|
||||
|
||||
@Override
|
||||
public List<BookEntity> getBooks(Integer userId) {
|
||||
return dao.getBooks(userId);
|
||||
public List<BookEntity> getBooks(Map<String, Object> params) {
|
||||
int page = Integer.parseInt(params.get("page").toString());
|
||||
int limit = Integer.parseInt(params.get("limit").toString());
|
||||
return dao.getBooks((page-1)*limit,limit
|
||||
,(Integer)params.get("userId"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
where bmr.book_id not in (select book_id from user_ebook_buy where user_id = #{userId})
|
||||
and b.del_flag = 0 and b.state = 1
|
||||
GROUP BY bmr.book_id
|
||||
limit #{page},#{limit}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user