|
|
@ -13,6 +13,8 @@ import org.jeecg.modules.demo.appletBookStand.entity.AppletBookStand; |
|
|
import org.jeecg.modules.demo.appletBookStand.service.IAppletBookStandService; |
|
|
import org.jeecg.modules.demo.appletBookStand.service.IAppletBookStandService; |
|
|
import org.jeecg.modules.demo.appletBooks.entity.AppletBooks; |
|
|
import org.jeecg.modules.demo.appletBooks.entity.AppletBooks; |
|
|
import org.jeecg.modules.demo.appletBooks.service.IAppletBooksService; |
|
|
import org.jeecg.modules.demo.appletBooks.service.IAppletBooksService; |
|
|
|
|
|
import org.jeecg.modules.demo.appletCourse.entity.AppletCourse; |
|
|
|
|
|
import org.jeecg.modules.demo.appletCourse.service.IAppletCourseService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@ -27,7 +29,18 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService { |
|
|
private IAppletBooksService appletBooksService; |
|
|
private IAppletBooksService appletBooksService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IAppletBookStandService appletBookStandService; |
|
|
private IAppletBookStandService appletBookStandService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IAppletCourseService appletCourseService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查询书籍列表 |
|
|
|
|
|
* |
|
|
|
|
|
* @param page |
|
|
|
|
|
* @param title |
|
|
|
|
|
* @param category |
|
|
|
|
|
* @param label |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public IPage<AppletBooks> getBooks(Page<AppletBooks> page, String title, String category, String label) { |
|
|
public IPage<AppletBooks> getBooks(Page<AppletBooks> page, String title, String category, String label) { |
|
|
return appletBooksService |
|
|
return appletBooksService |
|
|
@ -35,9 +48,17 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService { |
|
|
.like(StringUtil.isNotEmpty(title), AppletBooks::getBooksName, title) |
|
|
.like(StringUtil.isNotEmpty(title), AppletBooks::getBooksName, title) |
|
|
.eq(StringUtil.isNotEmpty(category), AppletBooks::getBooksClassification, category) |
|
|
.eq(StringUtil.isNotEmpty(category), AppletBooks::getBooksClassification, category) |
|
|
.like(StringUtil.isNotEmpty(label), AppletBooks::getBooksLabel, label) |
|
|
.like(StringUtil.isNotEmpty(label), AppletBooks::getBooksLabel, label) |
|
|
|
|
|
.eq(AppletBooks::getStatus, "Y") |
|
|
.page(page); |
|
|
.page(page); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查询书桌列表 |
|
|
|
|
|
* |
|
|
|
|
|
* @param booksPage |
|
|
|
|
|
* @param title |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public IPage<AppletBooks> getBooksStand(Page<AppletBooks> booksPage, String title) { |
|
|
public IPage<AppletBooks> getBooksStand(Page<AppletBooks> booksPage, String title) { |
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
@ -51,10 +72,16 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService { |
|
|
return appletBooksService |
|
|
return appletBooksService |
|
|
.lambdaQuery() |
|
|
.lambdaQuery() |
|
|
.in(AppletBooks::getId) |
|
|
.in(AppletBooks::getId) |
|
|
|
|
|
.eq(AppletBooks::getStatus, "Y") |
|
|
.like(StringUtil.isNotEmpty(title), AppletBooks::getBooksName, title) |
|
|
.like(StringUtil.isNotEmpty(title), AppletBooks::getBooksName, title) |
|
|
.page(booksPage); |
|
|
.page(booksPage); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 添加入书桌 |
|
|
|
|
|
* |
|
|
|
|
|
* @param id |
|
|
|
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public void addStand(String id) { |
|
|
public void addStand(String id) { |
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
@ -62,7 +89,7 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService { |
|
|
.eq(AppletBookStand::getUserId, userId) |
|
|
.eq(AppletBookStand::getUserId, userId) |
|
|
.eq(AppletBookStand::getBookId, id).one(); |
|
|
.eq(AppletBookStand::getBookId, id).one(); |
|
|
|
|
|
|
|
|
if (one == null){ |
|
|
|
|
|
|
|
|
if (one == null) { |
|
|
AppletBookStand appletBookStand = new AppletBookStand(); |
|
|
AppletBookStand appletBookStand = new AppletBookStand(); |
|
|
appletBookStand.setUserId(userId); |
|
|
appletBookStand.setUserId(userId); |
|
|
appletBookStand.setBookId(id); |
|
|
appletBookStand.setBookId(id); |
|
|
@ -70,9 +97,15 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 删除书桌 |
|
|
|
|
|
* |
|
|
|
|
|
* @param id |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void delStand(String id) { |
|
|
public void delStand(String id) { |
|
|
if (StringUtil.isBlank(id)){ |
|
|
|
|
|
|
|
|
if (StringUtil.isBlank(id)) { |
|
|
throw new JeecgBootException("id不能为空"); |
|
|
throw new JeecgBootException("id不能为空"); |
|
|
} |
|
|
} |
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
@ -80,4 +113,28 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService { |
|
|
.eq(AppletBookStand::getUserId, userId) |
|
|
.eq(AppletBookStand::getUserId, userId) |
|
|
.in(AppletBookStand::getBookId, Arrays.asList(id.split(",")))); |
|
|
.in(AppletBookStand::getBookId, Arrays.asList(id.split(",")))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取课程列表 |
|
|
|
|
|
* |
|
|
|
|
|
* @param id |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public IPage<AppletCourse> getCourses(Page<AppletCourse> coursePage, String id) { |
|
|
|
|
|
// 先验证书籍是否存在 |
|
|
|
|
|
AppletBooks book = appletBooksService.getById(id); |
|
|
|
|
|
if (book == null) { |
|
|
|
|
|
throw new JeecgBootException("书籍不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
// 根据书籍ID查询关联的课程列表 |
|
|
|
|
|
IPage<AppletCourse> pageResult = appletCourseService |
|
|
|
|
|
.lambdaQuery() |
|
|
|
|
|
.eq(AppletCourse::getBookId, id) |
|
|
|
|
|
.page(coursePage); |
|
|
|
|
|
|
|
|
|
|
|
return pageResult; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |