From a761a27e8055b165666aa560a3f205fb505f32b0 Mon Sep 17 00:00:00 2001 From: wenyu441069198 <14186472+wenyu441069198@user.noreply.gitee.com> Date: Tue, 18 Jun 2024 21:46:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/model/entity/CourseResources.java | 9 +++++++ .../service/CourseResourcesService.java | 4 +++ .../impl/CourseResourcesServiceImpl.java | 25 +++++++++++++++++++ 3 files changed, 38 insertions(+) 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); + } + }