|
|
|
|
@@ -1,11 +1,13 @@
|
|
|
|
|
package com.peanut.modules.master.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.PageUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.peanut.common.utils.PageUtils;
|
|
|
|
|
import com.peanut.common.utils.R;
|
|
|
|
|
import com.peanut.modules.common.dao.*;
|
|
|
|
|
import com.peanut.modules.common.entity.*;
|
|
|
|
|
@@ -16,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -238,19 +241,18 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page<CourseCatalogueVo> getCanBindProductAndCourse(ParamTo param) {
|
|
|
|
|
public Map<String, Object> getCanBindProductAndCourse(ParamTo param) {
|
|
|
|
|
List<Integer> catalogueIds = shopProductCourseDao.selectList(new LambdaQueryWrapper<ShopProductCourseEntity>().eq(ShopProductCourseEntity::getProductId, param.getId())).stream().map(ShopProductCourseEntity::getCatalogueId).collect(Collectors.toList());
|
|
|
|
|
MPJLambdaWrapper<CourseCatalogueEntity> wrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseCatalogueEntity::getCourseId);
|
|
|
|
|
wrapper.notIn(catalogueIds.size()>0,CourseCatalogueEntity::getId,catalogueIds);
|
|
|
|
|
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
|
|
|
|
wrapper.selectAs(CourseEntity::getTitle,"courseTitle");
|
|
|
|
|
wrapper.selectAs(CourseCatalogueEntity::getTitle,"CourseCatalogueTitle");
|
|
|
|
|
wrapper.select(CourseEntity::getImage);
|
|
|
|
|
wrapper.selectAs(CourseEntity::getId,"courseId");
|
|
|
|
|
wrapper.selectAs(CourseCatalogueEntity::getId,"catalogueId");
|
|
|
|
|
Page<CourseCatalogueVo> courseCatalogueVoPage = courseCatalogueDao.selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseCatalogueVo.class, wrapper);
|
|
|
|
|
return courseCatalogueVoPage;
|
|
|
|
|
int page = param.getPage();
|
|
|
|
|
int limit = param.getLimit();
|
|
|
|
|
Integer canBindProductAndCourseCount = courseCatalogueDao.getCanBindProductAndCourseCount(catalogueIds, param.getKeywords());
|
|
|
|
|
List<CourseCatalogueVo> canBindProductAndCourse = courseCatalogueDao.getCanBindProductAndCourse(catalogueIds, param.getKeywords(), (page-1)*limit, param.getLimit());
|
|
|
|
|
Map<String, Object> flag = new HashMap<>();
|
|
|
|
|
flag.put("count",canBindProductAndCourseCount);
|
|
|
|
|
flag.put("data",canBindProductAndCourse);
|
|
|
|
|
flag.put("page",page);
|
|
|
|
|
flag.put("limit",limit);
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|