课程资源查看删除

master
wenyu441069198 5 months ago
parent 12529131ce
commit a761a27e80
  1. 9
      src/main/java/com/teaching/backend/model/entity/CourseResources.java
  2. 4
      src/main/java/com/teaching/backend/service/CourseResourcesService.java
  3. 25
      src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java

@ -33,4 +33,13 @@ public class CourseResources {
private String tags;
private String path;
/**
* 简介
*/
private String description;
/**
* 封面
*/
private String img;
}

@ -24,4 +24,8 @@ public interface CourseResourcesService extends IService<CourseResources> {
Page<CourseResources> getresourceRecords(Integer type, List<Integer> resourceIdList, int page, int pageSize);
public List<CourseResources> getByType(String type);
public void removeCourseResources(List<Long> ids);
}

@ -13,6 +13,7 @@ import com.teaching.backend.model.entity.ResourceRelationship;
import com.teaching.backend.service.CourseResourcesService;
import com.teaching.backend.service.ResourcesRelationshipService;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -35,6 +36,9 @@ import java.util.List;
public class CourseResourcesServiceImpl extends ServiceImpl<CourseResourcesMapper, CourseResources> implements CourseResourcesService {
@Resource
ResourcesRelationshipService resourcesRelationshipService;
@Autowired
private CourseResourcesMapper courseResourcesMapper;
@Override
public void updateFile(Integer type, String fileName, String filePath) {
@ -115,6 +119,27 @@ public class CourseResourcesServiceImpl extends ServiceImpl<CourseResourcesMappe
return key;
}
@Override
public List<CourseResources> getByType(String type) {
LambdaQueryWrapper<CourseResources> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CourseResources::getType, type);
List<CourseResources> list = this.list(lambdaQueryWrapper);
return list;
}
@Override
public void removeCourseResources(List<Long> ids) {
LambdaQueryWrapper<CourseResources> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CourseResources::getId, ids);
List<CourseResources> list = this.list(lambdaQueryWrapper);
courseResourcesMapper.deleteBatchIds(list);
// System.out.println(this.updateBatchById(list));
// this.remove(lambdaQueryWrapper);
}
}

Loading…
Cancel
Save