master
parent
0633328c8c
commit
c352cc236a
43 changed files with 859 additions and 612 deletions
@ -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> |
@ -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
@ -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); |
||||
} |
||||
|
||||
} |
@ -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> { |
||||
|
||||
} |
@ -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; |
@ -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("添加成功"); |
||||
} |
||||
} |
@ -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); |
||||
} |
Loading…
Reference in new issue