Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Train
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
朱旭欣
Train
Commits
63f40143
提交
63f40143
authored
6月 06, 2022
作者:
朱旭欣
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
第二次提交
上级
0af199f3
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
126 行增加
和
29 行删除
+126
-29
pom.xml
pom.xml
+2
-2
Swagger2Config.java
src/main/java/com/example/train/config/Swagger2Config.java
+15
-15
WebMvcConfig.java
src/main/java/com/example/train/config/WebMvcConfig.java
+49
-0
TainController.java
...ain/java/com/example/train/controller/TainController.java
+16
-12
DatumPojo.java
src/main/java/com/example/train/pojo/DatumPojo.java
+43
-0
VideoServiceImpl.java
...java/com/example/train/service/impl/VideoServiceImpl.java
+1
-0
没有找到文件。
pom.xml
浏览文件 @
63f40143
...
...
@@ -30,12 +30,12 @@
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.9.
2
</version>
<version>
2.9.
1
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.9.
2
</version>
<version>
2.9.
1
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
src/main/java/com/example/train/config/Swagger2Config.java
浏览文件 @
63f40143
...
...
@@ -47,20 +47,20 @@ public class Swagger2Config extends WebMvcConfigurationSupport {
.
build
();
}
/**
* 我们使用的 @Configuration 继承了WebMvcConfigurationSupport,导致默认的Swagger静态资源被覆盖,而缺失了配置。
* @param registry registry
*/
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"doc.html"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"swagger-ui.html"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"/webjars/**"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
// registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
}
//
/**
//
* 我们使用的 @Configuration 继承了WebMvcConfigurationSupport,导致默认的Swagger静态资源被覆盖,而缺失了配置。
//
* @param registry registry
//
*/
//
@Override
//
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//
registry.addResourceHandler("doc.html")
//
.addResourceLocations("classpath:/META-INF/resources/");
//
//
registry.addResourceHandler("swagger-ui.html")
//
.addResourceLocations("classpath:/META-INF/resources/");
//
registry.addResourceHandler("/webjars/**")
//
.addResourceLocations("classpath:/META-INF/resources/webjars/");
//
//
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
//
}
}
src/main/java/com/example/train/config/WebMvcConfig.java
0 → 100644
浏览文件 @
63f40143
package
com
.
example
.
train
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.CorsRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* @author zsp
* @version V1.0
* @data 2020/6/11
**/
@Configuration
public
class
WebMvcConfig
{
@Bean
public
WebMvcConfigurer
corsConfigurer
()
{
return
new
WebMvcConfigurer
()
{
@Override
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/**"
)
.
allowCredentials
(
true
)
.
allowedOriginPatterns
(
"*"
)
.
allowedMethods
(
"GET"
,
"POST"
,
"DELETE"
,
"PUT"
,
"PATCH"
)
.
maxAge
(
3600
);
}
// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("swagger-ui.html")
// .addResourceLocations("classpath:/META-INF/resources/");
// .addResourceLocations("classpath:/META-INF/resources/");
//
// registry.addResourceHandler("swagger-ui.html")
// .addResourceLocations("classpath:/META-INF/resources/");
// registry.addResourceHandler("/webjars/**")
// .addResourceLocations("classpath:/META-INF/resources/webjars/");
//// r
// egistry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
// }
};
}
}
src/main/java/com/example/train/controller/Controller.java
→
src/main/java/com/example/train/controller/
Tain
Controller.java
浏览文件 @
63f40143
...
...
@@ -20,9 +20,9 @@ import java.util.List;
* @author tykj
*/
@RestController
@RequestMapping
(
"/
model4
"
)
@RequestMapping
(
"/
zt/train
"
)
@Api
(
tags
=
"浙江省培训管理系统"
,
description
=
"基础接口"
)
public
class
Controller
{
public
class
Tain
Controller
{
@Autowired
private
ParticularsService
particularsService
;
...
...
@@ -40,14 +40,13 @@ public class Controller {
@PostMapping
(
"/findAll"
)
@ApiOperation
(
value
=
"动态查询培训信息"
)
public
PagePojo
findAll
(
ParticularsCondition
particularsCondition
)
{
public
PagePojo
findAll
(
@RequestBody
ParticularsCondition
particularsCondition
)
{
return
particularsService
.
findAll
(
particularsCondition
);
}
@PostMapping
(
"/saveParticulars"
)
@ApiOperation
(
value
=
"发起培训"
)
public
Particulars
saveParticulars
(
Particulars
particulars
,
MultipartFile
file1
,
MultipartFile
file2
)
throws
IOException
{
public
Particulars
saveParticulars
(
Particulars
particulars
,
MultipartFile
file1
,
MultipartFile
file2
)
throws
IOException
{
String
upload1
=
particularsService
.
upload
(
file1
);
String
upload2
=
particularsService
.
upload
(
file2
);
particulars
.
setCoursewareUpload
(
upload1
);
...
...
@@ -55,20 +54,25 @@ public class Controller {
return
particularsService
.
saveOne
(
particulars
);
}
@PostMapping
(
"/saveVideo"
)
@ApiOperation
(
value
=
"视频上传"
)
public
Video
saveVideo
(
Video
video
,
MultipartFile
videoFile
)
throws
IOException
{
String
videoUpload
=
videoService
.
uploadVideo
(
videoFile
);
video
.
setVideoUpload
(
videoUpload
);
video
.
setVideoLength
(
VideoUtil
.
getDurationBackString
(
videoUpload
));
public
Video
saveVideo
(
@RequestBody
Video
video
)
{
video
.
setVideoLength
(
VideoUtil
.
getDurationBackString
(
video
.
getVideoUpload
()));
return
videoService
.
saveVideo
(
video
);
}
@PostMapping
(
"/saveFile"
)
@ApiOperation
(
value
=
"视频文件上传"
)
public
String
saveFile1
(
@RequestParam
(
"multipartFile"
)
MultipartFile
multipartFile
){
try
{
return
videoService
.
uploadVideo
(
multipartFile
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
"上传失败"
;
}
@PostMapping
(
"findVideo"
)
@ApiOperation
(
value
=
"视频动态查询"
)
public
PagePojo
findVideo
(
VideoCondition
videoCondition
){
public
PagePojo
findVideo
(
@RequestBody
VideoCondition
videoCondition
){
return
videoService
.
findVideo
(
videoCondition
);
}
...
...
src/main/java/com/example/train/pojo/DatumPojo.java
0 → 100644
浏览文件 @
63f40143
package
com
.
example
.
train
.
pojo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
/**
* @author tykj
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@ApiModel
(
"资料详情详情"
)
public
class
DatumPojo
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
value
=
"资料主键ID"
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"视频标题"
,
example
=
"输入一段文字"
)
private
String
videoTitle
;
@ApiModelProperty
(
value
=
"视频分类"
,
example
=
"分类1"
)
private
String
videoType
;
@ApiModelProperty
(
value
=
"视频简介"
,
example
=
"输入一段文字"
)
private
String
videoProcess
;
@ApiModelProperty
(
value
=
"视频上传"
,
example
=
"视频保存路径"
)
private
String
videoUpload
;
}
src/main/java/com/example/train/service/impl/VideoServiceImpl.java
浏览文件 @
63f40143
...
...
@@ -59,6 +59,7 @@ public class VideoServiceImpl implements VideoService {
@Override
public
Video
saveVideo
(
Video
video
)
{
return
videoDao
.
save
(
video
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论