diff --git a/src/main/java/com/teaching/backend/model/entity/CourseResources.java b/src/main/java/com/teaching/backend/model/entity/CourseResources.java index 40809da..e1819c4 100644 --- a/src/main/java/com/teaching/backend/model/entity/CourseResources.java +++ b/src/main/java/com/teaching/backend/model/entity/CourseResources.java @@ -33,4 +33,13 @@ public class CourseResources { private String tags; private String path; + /** + * 简介 + */ + private String description; + + /** + * 封面 + */ + private String img; } diff --git a/src/main/java/com/teaching/backend/service/CourseResourcesService.java b/src/main/java/com/teaching/backend/service/CourseResourcesService.java index 72a5082..63c922f 100644 --- a/src/main/java/com/teaching/backend/service/CourseResourcesService.java +++ b/src/main/java/com/teaching/backend/service/CourseResourcesService.java @@ -24,4 +24,8 @@ public interface CourseResourcesService extends IService { Page getresourceRecords(Integer type, List resourceIdList, int page, int pageSize); + + + public List getByType(String type); + public void removeCourseResources(List ids); } diff --git a/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java index 50479c6..c055e6e 100644 --- a/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java @@ -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 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 getByType(String type) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(CourseResources::getType, type); + + List list = this.list(lambdaQueryWrapper); + + return list; + } + + + @Override + public void removeCourseResources(List ids) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(CourseResources::getId, ids); + List list = this.list(lambdaQueryWrapper); + courseResourcesMapper.deleteBatchIds(list); +// System.out.println(this.updateBatchById(list)); +// this.remove(lambdaQueryWrapper); + } + }