master
youhang20021127 3 months ago
parent 0633328c8c
commit c352cc236a
  1. 8
      .idea/.gitignore
  2. 9
      .idea/knowledge.iml
  3. 6
      .idea/misc.xml
  4. 8
      .idea/modules.xml
  5. 6
      .idea/vcs.xml
  6. 33
      backend/.gitignore
  7. 18
      backend/.mvn/wrapper/maven-wrapper.properties
  8. 1029
      backend/sql/teaching_db6.0.sql
  9. 8
      backend/sql/teaching_db6.1.sql
  10. 4
      backend/src/main/java/com/teaching/backend/controller/FavourInformation/FavourInformationController.java
  11. 4
      backend/src/main/java/com/teaching/backend/controller/Know/KnowController.java
  12. 14
      backend/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java
  13. 4
      backend/src/main/java/com/teaching/backend/controller/favour/SeKnowFavourController.java
  14. 4
      backend/src/main/java/com/teaching/backend/controller/favour/SeResourceFavourController.java
  15. 2
      backend/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java
  16. 7
      backend/src/main/java/com/teaching/backend/controller/resource/ResourceController.java
  17. 43
      backend/src/main/java/com/teaching/backend/controller/resource/ResourceMysqlController.java
  18. 4
      backend/src/main/java/com/teaching/backend/controller/thumb/SeKnowThumbController.java
  19. 4
      backend/src/main/java/com/teaching/backend/controller/thumb/SeResourceThumbController.java
  20. 17
      backend/src/main/java/com/teaching/backend/mapper/resource/ResourceMysqlMapper.java
  21. 2
      backend/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java
  22. 2
      backend/src/main/java/com/teaching/backend/model/entity/know/Edge.java
  23. 2
      backend/src/main/java/com/teaching/backend/model/entity/know/KnowJson.java
  24. 65
      backend/src/main/java/com/teaching/backend/model/entity/resource/ResourceMysql.java
  25. 2
      backend/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowChapterVO.java
  26. 2
      backend/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowCourseVO.java
  27. 6
      backend/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowJsonListVO.java
  28. 2
      backend/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowPathVO.java
  29. 25
      backend/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowVO1.java
  30. 2
      backend/src/main/java/com/teaching/backend/model/vo/knowGraph/RelsNodesVO.java
  31. 7
      backend/src/main/java/com/teaching/backend/service/Know/KnowService.java
  32. 2
      backend/src/main/java/com/teaching/backend/service/cms/ICmsEssayService.java
  33. 26
      backend/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java
  34. 2
      backend/src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java
  35. 2
      backend/src/main/java/com/teaching/backend/service/impl/records/RecordKnowledgeFinishServiceImpl.java
  36. 2
      backend/src/main/java/com/teaching/backend/service/impl/records/RecordResourceFinishServiceImpl.java
  37. 5
      backend/src/main/java/com/teaching/backend/service/impl/records/ResourceLearningRecordServiceImpl.java
  38. 34
      backend/src/main/java/com/teaching/backend/service/impl/resource/ResourceMysqlServiceImpl.java
  39. 20
      backend/src/main/java/com/teaching/backend/service/impl/resource/ResourceServiceImpl.java
  40. 2
      backend/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java
  41. 19
      backend/src/main/java/com/teaching/backend/service/resource/IResourceMysqlService.java
  42. 8
      backend/src/main/java/com/teaching/backend/service/resource/ResourceService.java
  43. 0
      backend/src/main/resources/mapper/IResourceMysqlService.xml

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/knowledge.iml" filepath="$PROJECT_DIR$/.idea/knowledge.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

33
backend/.gitignore vendored

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.1
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip

File diff suppressed because it is too large Load Diff

@ -239,10 +239,10 @@ INSERT INTO `objectives_type` VALUES (2, '知识目标');
INSERT INTO `objectives_type` VALUES (3, '素质目标');
-- ----------------------------
-- Table structure for resource
-- Table structure for resourceMysql
-- ----------------------------
DROP TABLE IF EXISTS `resource`;
CREATE TABLE `resource` (
DROP TABLE IF EXISTS `resourceMysql`;
CREATE TABLE `resourceMysql` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '主键',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资源名称',
`type` int(11) NULL DEFAULT NULL COMMENT '资源类型',
@ -253,7 +253,7 @@ CREATE TABLE `resource` (
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of resource
-- Records of resourceMysql
-- ----------------------------
-- ----------------------------

@ -7,7 +7,7 @@
//import com.teaching.backend.model.entity.resource.CourseResources;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import javax.annotation.ResourceMysql;
//import java.util.List;
//
///**
@ -24,7 +24,7 @@
//public class FavourInformationController{
//
//
// @Resource
// @ResourceMysql
// CourseResourcesService courseResourcesService;
//
//

@ -8,11 +8,11 @@ package com.teaching.backend.controller.Know;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.model.dto.Know.*;
import com.teaching.backend.model.entity.know.*;
import com.teaching.backend.model.entity.knowtmp.Knowtmp;
import com.teaching.backend.model.vo.knowGraph.KnowPathVO;
import com.teaching.backend.model.vo.knowGraph.KnowVO;
import com.teaching.backend.model.vo.knowGraph.RelsNodesVO;
import com.teaching.backend.service.Know.KnowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@ -33,7 +33,7 @@ public class CmsEssayController {
* @return
*/
@PostMapping("/add")
public BaseResponse<String> addEssay(CmsEssay cmsEssay){
public BaseResponse<String> addEssay(@RequestBody CmsEssay cmsEssay){
return cmsEssayService.addEssay(cmsEssay);
}
@ -59,7 +59,7 @@ public class CmsEssayController {
}
/**
* 查询文章
* 根据栏目id查询文章
* @param category_id
* @return
*/
@ -68,6 +68,16 @@ public class CmsEssayController {
return cmsEssayService.queryEssay(category_id);
}
/**
* 根据文章id查询文章
* @param essay_id
* @return
*/
@GetMapping("/queryessaybyid")
public BaseResponse<CmsEssay> queryEssayById(Integer essay_id){
return cmsEssayService.queryEssayById(essay_id);
}
/**
* 取消发布
* @param cmsEssay

@ -12,7 +12,7 @@
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import javax.annotation.ResourceMysql;
//
///**
// * @Author:youhang
@ -24,7 +24,7 @@
//@Slf4j
//public class SeKnowFavourController {
//
// @Resource
// @ResourceMysql
// private SeKnowFavourService seKnowFavourService;
//
//

@ -16,7 +16,7 @@
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import javax.annotation.ResourceMysql;
//
///**
// * @Author:youhang
@ -28,7 +28,7 @@
//@Slf4j
//public class SeResourceFavourController {
//
// @Resource
// @ResourceMysql
// private SeResourceFavourService seResourceFavourService;
//
//

@ -37,7 +37,7 @@ public class ResourceLearningRecordController {
// @ValidateParams({"userId","type","coursesId"})
@PostMapping("/saverecords")
public BaseResponse<String> saveResourceRecords(@RequestBody ResourceLearningRecord resourceLearningRecord) {
return resourceLearningRecordService.saveCoursesRecords(resourceLearningRecord);
return resourceLearningRecordService.saveResourceRecords(resourceLearningRecord);
}
/**

@ -8,11 +8,10 @@ package com.teaching.backend.controller.resource;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.model.dto.resource.ResourceUploadDto;
import com.teaching.backend.model.entity.resource.ResourceMysql;
import com.teaching.backend.model.entity.resource.Resources;
import com.teaching.backend.service.resource.ResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.InputStreamResource;
@ -20,9 +19,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Set;
@RestController
@RequestMapping("/api/resource")
@ -55,4 +51,5 @@ public class ResourceController {
return resourceService.readFile(filename);
}
}

@ -0,0 +1,43 @@
package com.teaching.backend.controller.resource;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.entity.resource.ResourceMysql;
import com.teaching.backend.service.impl.resource.ResourceMysqlServiceImpl;
import com.teaching.backend.service.impl.resource.ResourceServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 前端控制器
* </p>
*
* @author author
* @since 2024-09-02
*/
@RestController
@RequestMapping("/resourcemysql")
@Api(tags= "数据库资源管理")
public class ResourceMysqlController {
private ResourceMysqlServiceImpl resourceMysqlService;
private ResourceServiceImpl resourceService;
//添加资源
@PostMapping("/add")
@ApiOperation(value = "添加资源")
public BaseResponse<String> addFile(@RequestPart("file") MultipartFile file, ResourceMysql resourceMysql) {
System.out.println("资源:"+ resourceMysql);
System.out.println(file);
String url = resourceService.upload(file).getData().getUrl();
System.out.println(url);
//return ResultUtils.success("添加xx");
return resourceMysqlService.resourceUpload(file, resourceMysql);
}
}

@ -12,7 +12,7 @@
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import javax.annotation.ResourceMysql;
//
///**
// * @Author:youhang
@ -24,7 +24,7 @@
//@Slf4j
//public class SeKnowThumbController {
//
// @Resource
// @ResourceMysql
// private SeKnowThumbService seKnowThumbService;
//
//

@ -12,7 +12,7 @@
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import javax.annotation.ResourceMysql;
//
///**
// * @Author:youhang
@ -24,7 +24,7 @@
//@Slf4j
//public class SeResourceThumbController {
//
// @Resource
// @ResourceMysql
// private SeResourceThumbService seResourceThumbService;
//
//

@ -0,0 +1,17 @@
package com.teaching.backend.mapper.resource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.resource.ResourceMysql;
/**
* <p>
* Mapper 接口
* </p>
*
* @author author
* @since 2024-09-02
*/
public interface ResourceMysqlMapper extends BaseMapper<ResourceMysql> {
}

@ -74,7 +74,7 @@ public interface ResourcesRepository extends Neo4jRepository<Resources, Long> {
//
//
// @Query("MATCH(n:Know)-[r:resources]->(nn:Resources) where ID(nn) = $id RETURN nn")
// List<Resource> queryResourceAllId(Long id);
// List<ResourceMysql> queryResourceAllId(Long id);
//
// @Query("MATCH p = (a:Know)-[rels*]-(b:Resources) WHERE ID(a) = $KnowId and ANY(rel IN rels WHERE TYPE(rel) = 'resources') RETURN b")
// Set<Resources> queryCourseKnowToResources(Long KnowId);

@ -1,4 +1,4 @@
package com.teaching.backend.controller.Know;
package com.teaching.backend.model.entity.know;
import lombok.AllArgsConstructor;
import lombok.Data;

@ -1,4 +1,4 @@
package com.teaching.backend.controller.Know;
package com.teaching.backend.model.entity.know;
import lombok.AllArgsConstructor;
import lombok.Data;

@ -0,0 +1,65 @@
package com.teaching.backend.model.entity.resource;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author wenyu
* @since 2024-09-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("resource")
@ApiModel(value="Resource对象", description="")
public class ResourceMysql implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
@ApiModelProperty(value = "课程id")
private String courseId;
@ApiModelProperty(value = "章节id")
private String chapterId;
@ApiModelProperty(value = "知识点id")
private String knowledgeId;
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty(value = "资源类型")
private Integer type;
@ApiModelProperty(value = "资源路径")
private String path;
@ApiModelProperty(value = "资源状态")
private Integer status;
@ApiModelProperty(value = "标签")
private String tags;
@ApiModelProperty(value = "简介")
private String description;
@ApiModelProperty(value = "封面")
private String img;
}

@ -1,4 +1,4 @@
package com.teaching.backend.controller.Know;
package com.teaching.backend.model.vo.knowGraph;
import lombok.Data;

@ -1,4 +1,4 @@
package com.teaching.backend.controller.Know;
package com.teaching.backend.model.vo.knowGraph;
import lombok.Data;

@ -1,8 +1,6 @@
package com.teaching.backend.controller.Know;
package com.teaching.backend.model.vo.knowGraph;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.teaching.backend.model.entity.know.KnowJson;
import java.io.Serializable;
import java.util.List;

@ -1,4 +1,4 @@
package com.teaching.backend.controller.Know;
package com.teaching.backend.model.vo.knowGraph;
import lombok.AllArgsConstructor;
import lombok.Data;

@ -1,25 +0,0 @@
package com.teaching.backend.model.vo.knowGraph;
import lombok.Data;
import java.io.Serializable;
@Data
public class KnowVO1 implements Serializable {
/**
* id
*/
private Long id;
/**
* 知识点名称
*/
private String label;
}

@ -1,4 +1,4 @@
package com.teaching.backend.controller.Know;
package com.teaching.backend.model.vo.knowGraph;
import lombok.AllArgsConstructor;
import lombok.Data;

@ -1,17 +1,12 @@
package com.teaching.backend.service.Know;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.controller.Know.KnowPathVO;
import com.teaching.backend.model.vo.knowGraph.KnowPathVO;
import com.teaching.backend.model.dto.Know.*;
import com.teaching.backend.model.entity.know.*;
import com.teaching.backend.model.entity.knowtmp.Knowtmp;
import com.teaching.backend.model.entity.resource.Resources;
import com.teaching.backend.model.vo.knowGraph.KnowVO;
import com.teaching.backend.model.vo.knowGraph.KnowVO1;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Set;
/**
* @Author:youhang

@ -26,4 +26,6 @@ public interface ICmsEssayService extends IService<CmsEssay> {
BaseResponse<List<?>> queryEssay(Integer category_id);
BaseResponse<String> editStatus(CmsEssay cmsEssay);
BaseResponse<CmsEssay> queryEssayById(Integer essayId);
}

@ -25,19 +25,40 @@ public class CmsEssayServiceImpl extends ServiceImpl<CmsEssayMapper, CmsEssay> i
@Override
public BaseResponse<String> addEssay(CmsEssay cmsEssay) {
//设置文章发布时间
cmsEssay.setPublishTime(LocalDate.now());
//如果数据库里没有文章,文章id设为2
Long count = query().count();
if (count == 0){
cmsEssay.setId(2);
}
save(cmsEssay);
return ResultUtils.success("添加成功");
}
@Override
public BaseResponse<String> deleteEssay(List<Integer> ids) {
//如果要删除的文章中包含id为1的文章(就是包含关于我们)就删除失败
if (ids.contains(1)){
return ResultUtils.success("删除失败,不能删除关于我们!");
}
removeByIds(ids);
return ResultUtils.success("删除成功");
}
@Override
public BaseResponse<String> editEssay(CmsEssay cmsEssay) {
//获取要修改的文章id
Integer id = cmsEssay.getId();
//判断文章id是否为1
if (id == 1){
Long count = query().eq("id", id).count();
//如果数据库里没id为的文章就先新增
if (count == 0){
save(cmsEssay);
return ResultUtils.success("添加成功!");
}
}
updateById(cmsEssay);
return ResultUtils.success("编辑成功!");
}
@ -54,4 +75,9 @@ public class CmsEssayServiceImpl extends ServiceImpl<CmsEssayMapper, CmsEssay> i
updateById(cmsEssay);
return ResultUtils.success("修改成功");
}
@Override
public BaseResponse<CmsEssay> queryEssayById(Integer essayId) {
return ResultUtils.success(getById(essayId));
}
}

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.controller.Know.KnowPathVO;
import com.teaching.backend.model.vo.knowGraph.KnowPathVO;
import com.teaching.backend.mapper.Knowtemp.KnowstrMapper;
import com.teaching.backend.mapper.Knowtemp.KnowtmpMapper;
import com.teaching.backend.mapper.chapter.ChapterMapper;

@ -53,11 +53,13 @@ public class RecordKnowledgeFinishServiceImpl extends ServiceImpl<RecordKnowledg
@Override
public void editFinish(ResourceLearningRecord resourceLearningRecord) {
System.out.println(resourceLearningRecord);
//设置完成状态
RecordKnowledgeFinish one = query()
.eq("course_id", resourceLearningRecord.getCoursesId())
.eq("knowledge_id", resourceLearningRecord.getKnowledgeId())
.eq("user_id", resourceLearningRecord.getUserId()).one();
System.out.println(one);
one.setFinish(1);
updateById(one);
}

@ -36,7 +36,7 @@ public class RecordResourceFinishServiceImpl extends ServiceImpl<RecordResourceF
recordResourceFinish.setKnowledgeId(resourceLearningRecord.getKnowledgeId());
recordResourceFinish.setResourceId(resourceLearningRecord.getResourceId());
recordResourceFinish.setFinish(resourceLearningRecord.getFinish());
System.out.println(recordResourceFinish);
System.out.println("资源完成:"+recordResourceFinish);
save(recordResourceFinish);
}

@ -40,7 +40,7 @@ public class ResourceLearningRecordServiceImpl extends ServiceImpl<ResourceLearn
private RecordResourceFinishServiceImpl recordResourceFinishService;
@Override
public BaseResponse<String> saveCoursesRecords(ResourceLearningRecord resourceLearningRecord) {
public BaseResponse<String> saveResourceRecords(ResourceLearningRecord resourceLearningRecord) {
//课程id
String courseId = resourceLearningRecord.getCoursesId();
String knowledgeId = resourceLearningRecord.getKnowledgeId();
@ -67,7 +67,7 @@ public class ResourceLearningRecordServiceImpl extends ServiceImpl<ResourceLearn
.eq("course_id",courseId)
.eq("knowledge_id",knowledgeId)
.eq("resource_id",resourceId).update();
// System.out.println("用户:"+userId+"第一次学这门课");
System.out.println("用户:"+userId+"第一次学这门课");
//添加完成状态
recordResourceFinishService.addFinish(resourceLearningRecord);
}else {
@ -103,7 +103,6 @@ public class ResourceLearningRecordServiceImpl extends ServiceImpl<ResourceLearn
save(resourceLearningRecord);
return ResultUtils.success("添加成功");
}
@Override
public BaseResponse<Page> getPage(int pagenum, int pagesize, String userId, String knowledgeId, String courseId) {
//格式化时间

@ -0,0 +1,34 @@
package com.teaching.backend.service.impl.resource;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.mapper.resource.ResourceMysqlMapper;
import com.teaching.backend.model.entity.resource.ResourceMysql;
import com.teaching.backend.service.resource.IResourceMysqlService;
import org.apache.ibatis.annotations.Results;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 服务实现类
* </p>
*
* @author author
* @since 2024-09-02
*/
@Service
public class ResourceMysqlServiceImpl extends ServiceImpl<ResourceMysqlMapper, ResourceMysql> implements IResourceMysqlService {
private ResourceServiceImpl resourceService;
@Override
public BaseResponse<String> resourceUpload(MultipartFile file, ResourceMysql resourceMysql) {
System.out.println(1);
System.out.println(file);
String url = resourceService.upload(file).getData().getUrl();
resourceMysql.setPath(url);
save(resourceMysql);
return ResultUtils.success("添加成功");
}
}

@ -1,42 +1,28 @@
package com.teaching.backend.service.impl.resource;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.constant.ViewContentTypeEnum;
import com.teaching.backend.mapper.know.KnowRepository;
import com.teaching.backend.mapper.resource.ResourcesRepository;
import com.teaching.backend.model.dto.resource.BucketPolicyConfigDto;
import com.teaching.backend.model.dto.resource.ResourceUploadDto;
import com.teaching.backend.model.entity.know.KnowChapter;
import com.teaching.backend.model.entity.know.KnowCourse;
import com.teaching.backend.model.entity.resource.ResourceMysql;
import com.teaching.backend.model.entity.resource.Resources;
import com.teaching.backend.service.resource.ResourceService;
import com.teaching.backend.utils.MinioUtils;
import io.minio.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.InputStreamResource;
import org.springframework.data.neo4j.core.Neo4jClient;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
@ -115,8 +101,4 @@ public class ResourceServiceImpl implements ResourceService {
public ResponseEntity<InputStreamResource> readFile(String filename) {
return minioUtils.readFile(filename);
}
}

@ -18,7 +18,7 @@ import java.util.List;
*/
public interface IResourceLearningRecordService extends IService<ResourceLearningRecord> {
BaseResponse<String> saveCoursesRecords(ResourceLearningRecord resourceLearningRecord);
BaseResponse<String> saveResourceRecords(ResourceLearningRecord resourceLearningRecord);
BaseResponse<Page> getPage(int pagenum, int pagesize, String userId, String knowledgeId, String courseId);

@ -0,0 +1,19 @@
package com.teaching.backend.service.resource;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.model.entity.resource.ResourceMysql;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 服务类
* </p>
*
* @author author
* @since 2024-09-02
*/
public interface IResourceMysqlService extends IService<ResourceMysql> {
BaseResponse<String> resourceUpload(MultipartFile file, ResourceMysql resourceMysql);
}

@ -2,17 +2,12 @@ package com.teaching.backend.service.resource;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.model.dto.resource.ResourceUploadDto;
import com.teaching.backend.model.entity.resource.ResourceMysql;
import com.teaching.backend.model.entity.resource.Resources;
import org.springframework.core.io.InputStreamResource;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Set;
/**
* @Author:youhang
* @Date:2024-07-26-13:55
@ -27,5 +22,4 @@ public interface ResourceService {
ResponseEntity<InputStreamResource> readFile(String filename);
}

Loading…
Cancel
Save