Bobi 1 month ago
parent
commit
9129834e1d
4 changed files with 25 additions and 19 deletions
  1. +4
    -3
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiBooksController.java
  2. +2
    -1
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiBooksService.java
  3. +13
    -11
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiBooksServiceImpl.java
  4. +6
    -4
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletBookStand/entity/AppletBookStand.java

+ 4
- 3
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiBooksController.java View File

@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.config.shiro.IgnoreAuth; import org.jeecg.config.shiro.IgnoreAuth;
import org.jeecg.modules.applet.service.AppletApiBooksService; import org.jeecg.modules.applet.service.AppletApiBooksService;
import org.jeecg.modules.demo.appletBookStand.entity.AppletBookStand;
import org.jeecg.modules.demo.appletBooks.entity.AppletBooks; import org.jeecg.modules.demo.appletBooks.entity.AppletBooks;
import org.jeecg.modules.demo.appletCategorize.entity.AppletCategorize; import org.jeecg.modules.demo.appletCategorize.entity.AppletCategorize;
import org.jeecg.modules.demo.appletCourse.entity.AppletCourse; import org.jeecg.modules.demo.appletCourse.entity.AppletCourse;
@ -62,12 +63,12 @@ public class AppletApiBooksController {
@Operation(summary = "查询书桌列表", description = "查询书桌列表") @Operation(summary = "查询书桌列表", description = "查询书桌列表")
@GetMapping(value = "/stand") @GetMapping(value = "/stand")
public Result<IPage<AppletBooks>> stand(@Parameter(description = "搜素关键字") String title,
public Result<IPage<AppletBookStand>> stand(@Parameter(description = "搜素关键字") String title,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
log.info("查询书桌列表"); log.info("查询书桌列表");
Page<AppletBooks> booksPage = new Page<>(pageNo, pageSize);
IPage<AppletBooks> list = appletApiBooksService
Page<AppletBookStand> booksPage = new Page<>(pageNo, pageSize);
IPage<AppletBookStand> list = appletApiBooksService
.getBooksStand(booksPage, title); .getBooksStand(booksPage, title);
return Result.OK(list); return Result.OK(list);
} }


+ 2
- 1
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiBooksService.java View File

@ -2,6 +2,7 @@ package org.jeecg.modules.applet.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.demo.appletBookStand.entity.AppletBookStand;
import org.jeecg.modules.demo.appletBooks.entity.AppletBooks; import org.jeecg.modules.demo.appletBooks.entity.AppletBooks;
import org.jeecg.modules.demo.appletCourse.entity.AppletCourse; import org.jeecg.modules.demo.appletCourse.entity.AppletCourse;
@ -18,7 +19,7 @@ public interface AppletApiBooksService {
* *
* @return 查询书桌列表 * @return 查询书桌列表
*/ */
IPage<AppletBooks> getBooksStand(Page<AppletBooks> booksPage, String title);
IPage<AppletBookStand> getBooksStand(Page<AppletBookStand> booksPage, String title);
/** /**
* 加入书桌 * 加入书桌


+ 13
- 11
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiBooksServiceImpl.java View File

@ -60,21 +60,23 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService {
* @return * @return
*/ */
@Override @Override
public IPage<AppletBooks> getBooksStand(Page<AppletBooks> booksPage, String title) {
public IPage<AppletBookStand> getBooksStand(Page<AppletBookStand> booksPage, String title) {
String userId = AppletUserUtil.getCurrentAppletUserId(); String userId = AppletUserUtil.getCurrentAppletUserId();
List<String> bookIds = appletBookStandService
Page<AppletBookStand> page = appletBookStandService
.lambdaQuery() .lambdaQuery()
.eq(AppletBookStand::getUserId, userId) .eq(AppletBookStand::getUserId, userId)
.list().stream()
.map(AppletBookStand::getBookId)
.collect(Collectors.toList());
return appletBooksService
.lambdaQuery()
.in(AppletBooks::getId)
.eq(AppletBooks::getStatus, "Y")
.like(StringUtil.isNotEmpty(title), AppletBooks::getBooksName, title)
.orderByDesc(AppletBookStand::getUpdateTime,
AppletBookStand::getCreateTime)
.page(booksPage); .page(booksPage);
for (AppletBookStand stand : page.getRecords()) {
AppletBooks book = appletBooksService.getById(stand.getBookId());
if ("Y".equals(book.getStatus())){
stand.setBook(book);
}
}
return page;
} }
/** /**


+ 6
- 4
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletBookStand/entity/AppletBookStand.java View File

@ -4,14 +4,13 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.*;
import org.jeecg.common.constant.ProvinceCityArea; import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils; import org.jeecg.common.util.SpringContextUtils;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.modules.demo.appletBooks.entity.AppletBooks;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.common.aspect.annotation.Dict;
@ -64,4 +63,7 @@ public class AppletBookStand implements Serializable {
@Excel(name = "书籍", width = 15) @Excel(name = "书籍", width = 15)
@Schema(description = "书籍") @Schema(description = "书籍")
private java.lang.String bookId; private java.lang.String bookId;
@TableField(exist = false)
private AppletBooks book;
} }

Loading…
Cancel
Save