医案推荐图书
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.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.peanut.common.utils.Query;
|
import com.peanut.common.utils.Query;
|
||||||
import com.peanut.common.utils.R;
|
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.BookMedicalRecordsService;
|
||||||
import com.peanut.modules.book.service.BookService;
|
import com.peanut.modules.book.service.BookService;
|
||||||
import com.peanut.modules.book.service.UserEbookBuyService;
|
import com.peanut.modules.book.service.UserEbookBuyService;
|
||||||
|
import com.peanut.modules.book.vo.UserOrderVo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -56,11 +58,11 @@ public class BookMedicalRecordsController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping("/recommendBookList")
|
@RequestMapping("/recommendBookList")
|
||||||
public R recommendBookList(@RequestBody Map<String, Object> params){
|
public R recommendBookList(@RequestBody Map<String, Object> params){
|
||||||
List<BookEntity> list = bookMedicalRecordsService.getBooks((Integer) params.get("userId"));
|
List<BookEntity> list = bookMedicalRecordsService.getBooks(params);
|
||||||
MPJLambdaWrapper<BookEntity> wrapper = new MPJLambdaWrapper<>();
|
Page<BookEntity> page = new Page<>();
|
||||||
IPage<BookEntity> page = bookService.page(
|
|
||||||
new Query<BookEntity>().getPage(params),wrapper);
|
|
||||||
page.setRecords(list);
|
page.setRecords(list);
|
||||||
|
page.setTotal(list.size());
|
||||||
|
page.setPages(Math.round(list.size()/page.getSize()));
|
||||||
return R.ok().put("page", page);
|
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> {
|
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;
|
private BookMedicalRecordsDao dao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BookEntity> getBooks(Integer userId) {
|
public List<BookEntity> getBooks(Map<String, Object> params) {
|
||||||
return dao.getBooks(userId);
|
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})
|
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
|
and b.del_flag = 0 and b.state = 1
|
||||||
GROUP BY bmr.book_id
|
GROUP BY bmr.book_id
|
||||||
|
limit #{page},#{limit}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user