|
|
|
@ -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);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|