1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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;
|
||||
@@ -8,6 +9,7 @@ import com.peanut.common.utils.ObjectUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -102,6 +104,16 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
return courseEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page getCourseListCanSociology(ParamTo param) {
|
||||
List<Integer> collect = courseToSociologyDao.selectList(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getSociologyId, param.getId())).stream().map(CourseToSociologyEntity::getCourseId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.notIn(CourseEntity::getId,collect);
|
||||
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
||||
Page<CourseEntity> page = this.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
||||
return page;
|
||||
}
|
||||
|
||||
private List<Integer> categoryIds(Integer id){
|
||||
ArrayList<Integer> integers = new ArrayList<>();
|
||||
CourseCategoryEntity courseCategoryEntity = courseCategoryDao.selectById(id);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.dao.CourseToSociologyDao;
|
||||
import com.peanut.modules.common.entity.CourseToSociologyEntity;
|
||||
import com.peanut.modules.master.service.CourseToSociologyService;
|
||||
@@ -12,5 +14,14 @@ import org.springframework.stereotype.Service;
|
||||
public class CourseToSociologyServiceImpl extends ServiceImpl<CourseToSociologyDao, CourseToSociologyEntity> implements CourseToSociologyService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public R bindCourseAndSociology(CourseToSociologyEntity courseToSociologyEntity) {
|
||||
//去重
|
||||
CourseToSociologyEntity one = this.getOne(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getCourseId, courseToSociologyEntity.getCourseId()).eq(CourseToSociologyEntity::getSociologyId, courseToSociologyEntity.getSociologyId()));
|
||||
if(one != null){
|
||||
return R.error(501,"绑定失败,绑定关系已将存在");
|
||||
}
|
||||
this.save(courseToSociologyEntity);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user