20200527-zlp-1
培训大视频上传至七牛
This commit is contained in:
@ -249,6 +249,32 @@
|
||||
<version>5.1.5.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 网络连接相关 -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 七牛云包 -->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>7.2.8</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 其他工具包 -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
72
ruoyi/src/main/java/com/ruoyi/common/utils/ByFileUtil.java
Normal file
72
ruoyi/src/main/java/com/ruoyi/common/utils/ByFileUtil.java
Normal file
@ -0,0 +1,72 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.qiniu.common.QiniuException;
|
||||
import com.qiniu.common.Zone;
|
||||
import com.qiniu.http.Response;
|
||||
import com.qiniu.storage.Configuration;
|
||||
import com.qiniu.storage.UploadManager;
|
||||
import com.qiniu.storage.model.DefaultPutRet;
|
||||
import com.qiniu.util.Auth;
|
||||
import com.ruoyi.framework.config.FileConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Base64;
|
||||
|
||||
public class ByFileUtil {
|
||||
|
||||
/**
|
||||
* File转成编码成BASE64
|
||||
*
|
||||
* @param file 文件对象
|
||||
* @return String
|
||||
*/
|
||||
public static String fileToBase64(File file) {
|
||||
String base64 = null;
|
||||
try {
|
||||
byte[] b = Files.readAllBytes(Paths.get(file.getAbsolutePath()));
|
||||
return Base64.getEncoder().encodeToString(b);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return base64;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将文件上传到七牛云
|
||||
*/
|
||||
public static String uploadQNImg(InputStream file, String key, FileConfig constantQiniu) {
|
||||
// 构造一个带指定Zone对象的配置类 华北 2020-02-06 已改用华东
|
||||
Configuration cfg = new Configuration(Zone.zone0());
|
||||
// 其他参数参考类注释
|
||||
UploadManager uploadManager = new UploadManager(cfg);
|
||||
// 生成上传凭证,然后准备上传
|
||||
try {
|
||||
Auth auth = Auth.create(constantQiniu.getAccessKey(), constantQiniu.getSecretKey());
|
||||
String upToken = auth.uploadToken(constantQiniu.getBucket());
|
||||
try {
|
||||
Response response = uploadManager.put(file, key, upToken, null, null);
|
||||
// 解析上传成功的结果
|
||||
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
|
||||
|
||||
String returnPath = constantQiniu.getDomain() + "" + putRet.key;
|
||||
return returnPath;
|
||||
} catch (QiniuException ex) {
|
||||
Response r = ex.response;
|
||||
System.err.println(r.toString());
|
||||
try {
|
||||
System.err.println(r.bodyString());
|
||||
} catch (QiniuException ex2) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -21,9 +21,9 @@ import com.ruoyi.framework.config.RuoYiConfig;
|
||||
public class FileUploadUtils
|
||||
{
|
||||
/**
|
||||
* 默认大小 50M
|
||||
* 默认大小 500M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
|
||||
public static final long DEFAULT_MAX_SIZE = 500 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认的文件名最大长度 100
|
||||
|
@ -32,7 +32,9 @@ public class MimeTypeUtils
|
||||
// 压缩文件
|
||||
"rar", "zip", "gz", "bz2",
|
||||
// pdf
|
||||
"pdf" };
|
||||
"pdf",
|
||||
//视频
|
||||
"mp4"};
|
||||
|
||||
public static String getExtension(String prefix)
|
||||
{
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.ruoyi.framework.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class FileConfig {
|
||||
@Value("${file.access.key}")
|
||||
private String accessKey;
|
||||
|
||||
@Value("${file.secret.key}")
|
||||
private String secretKey;
|
||||
|
||||
@Value("${file.bucket}")
|
||||
private String bucket;
|
||||
|
||||
@Value("${file.domain}")
|
||||
private String domain;
|
||||
|
||||
public String getAccessKey() {
|
||||
return accessKey;
|
||||
}
|
||||
|
||||
public String getSecretKey() {
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
public String getBucket() {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
}
|
@ -113,4 +113,12 @@ public class RuoYiConfig
|
||||
{
|
||||
return getProfile() + "/upload";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频上传路径
|
||||
*/
|
||||
public static String getUploadVideoPath()
|
||||
{
|
||||
return getProfile() + "/video";
|
||||
}
|
||||
}
|
@ -48,6 +48,18 @@ public class ByLecturerController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位id获取用户信息列表
|
||||
*/
|
||||
@GetMapping("/listAll")
|
||||
public AjaxResult getAllLecturerList(ByLecturer byLecturer) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<ByLecturer> list = byLecturerService.selectByLecturerList(byLecturer);
|
||||
ajax.put("lecturer", list);
|
||||
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出讲师列表
|
||||
*/
|
||||
|
@ -1,6 +1,11 @@
|
||||
package com.ruoyi.project.benyi.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.qiniu.util.Auth;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.config.FileConfig;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -33,6 +38,7 @@ public class ByTrainVideoController extends BaseController
|
||||
@Autowired
|
||||
private IByTrainVideoService byTrainVideoService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询培训列表
|
||||
*/
|
||||
@ -76,6 +82,8 @@ public class ByTrainVideoController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ByTrainVideo byTrainVideo)
|
||||
{
|
||||
byTrainVideo.setCreatetime(new Date());
|
||||
byTrainVideo.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||
return toAjax(byTrainVideoService.insertByTrainVideo(byTrainVideo));
|
||||
}
|
||||
|
||||
|
@ -10,42 +10,63 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* 培训对象 by_train_video
|
||||
*
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-05-25
|
||||
*/
|
||||
public class ByTrainVideo extends BaseEntity
|
||||
{
|
||||
public class ByTrainVideo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 编号 */
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 培训视频标题 */
|
||||
/**
|
||||
* 培训视频标题
|
||||
*/
|
||||
@Excel(name = "培训视频标题")
|
||||
private String title;
|
||||
|
||||
/** 简介 */
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
@Excel(name = "简介")
|
||||
private String information;
|
||||
|
||||
/** 讲师 */
|
||||
/**
|
||||
* 讲师
|
||||
*/
|
||||
@Excel(name = "讲师")
|
||||
private String lecturer;
|
||||
private Long lecturer;
|
||||
|
||||
/** 视频路径 */
|
||||
/**
|
||||
* 讲师
|
||||
*/
|
||||
@Excel(name = "讲师")
|
||||
private String lecturername;
|
||||
|
||||
/**
|
||||
* 视频路径
|
||||
*/
|
||||
@Excel(name = "视频路径")
|
||||
private String videourl;
|
||||
|
||||
/** 所属类别 */
|
||||
/**
|
||||
* 所属类别
|
||||
*/
|
||||
@Excel(name = "所属类别")
|
||||
private String type;
|
||||
|
||||
/** 适用班级 */
|
||||
/**
|
||||
* 适用班级
|
||||
*/
|
||||
@Excel(name = "适用班级")
|
||||
private String classtype;
|
||||
|
||||
/** 上传人员 */
|
||||
/**
|
||||
* 上传人员
|
||||
*/
|
||||
@Excel(name = "上传人员")
|
||||
private Long createuserid;
|
||||
|
||||
@ -55,76 +76,75 @@ public class ByTrainVideo extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createtime;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setTitle(String title)
|
||||
{
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setInformation(String information)
|
||||
{
|
||||
|
||||
public void setInformation(String information) {
|
||||
this.information = information;
|
||||
}
|
||||
|
||||
public String getInformation()
|
||||
{
|
||||
public String getInformation() {
|
||||
return information;
|
||||
}
|
||||
public void setLecturer(String lecturer)
|
||||
{
|
||||
|
||||
public void setLecturer(Long lecturer) {
|
||||
this.lecturer = lecturer;
|
||||
}
|
||||
|
||||
public String getLecturer()
|
||||
{
|
||||
public Long getLecturer() {
|
||||
return lecturer;
|
||||
}
|
||||
public void setVideourl(String videourl)
|
||||
{
|
||||
|
||||
public void setLecturername(String lecturername) {
|
||||
this.lecturername = lecturername;
|
||||
}
|
||||
|
||||
public String getLecturername() {
|
||||
return lecturername;
|
||||
}
|
||||
|
||||
public void setVideourl(String videourl) {
|
||||
this.videourl = videourl;
|
||||
}
|
||||
|
||||
public String getVideourl()
|
||||
{
|
||||
public String getVideourl() {
|
||||
return videourl;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setClasstype(String classtype)
|
||||
{
|
||||
|
||||
public void setClasstype(String classtype) {
|
||||
this.classtype = classtype;
|
||||
}
|
||||
|
||||
public String getClasstype()
|
||||
{
|
||||
public String getClasstype() {
|
||||
return classtype;
|
||||
}
|
||||
public void setCreateuserid(Long createuserid)
|
||||
{
|
||||
|
||||
public void setCreateuserid(Long createuserid) {
|
||||
this.createuserid = createuserid;
|
||||
}
|
||||
|
||||
public Long getCreateuserid()
|
||||
{
|
||||
public Long getCreateuserid() {
|
||||
return createuserid;
|
||||
}
|
||||
|
||||
@ -138,16 +158,17 @@ public class ByTrainVideo extends BaseEntity
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("title", getTitle())
|
||||
.append("information", getInformation())
|
||||
.append("lecturer", getLecturer())
|
||||
.append("videourl", getVideourl())
|
||||
.append("type", getType())
|
||||
.append("classtype", getClasstype())
|
||||
.append("createuserid", getCreateuserid())
|
||||
.append("createtime", getCreatetime())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("title", getTitle())
|
||||
.append("information", getInformation())
|
||||
.append("lecturer", getLecturer())
|
||||
.append("lecturername", getLecturername())
|
||||
.append("videourl", getVideourl())
|
||||
.append("type", getType())
|
||||
.append("classtype", getClasstype())
|
||||
.append("createuserid", getCreateuserid())
|
||||
.append("createtime", getCreatetime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.ruoyi.project.common;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.qiniu.util.Auth;
|
||||
import com.ruoyi.common.utils.ByFileUtil;
|
||||
import com.ruoyi.framework.config.FileConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -17,32 +22,40 @@ import com.ruoyi.framework.config.RuoYiConfig;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
import static com.ruoyi.common.utils.file.FileUploadUtils.extractFilename;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class CommonController
|
||||
{
|
||||
public class CommonController {
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
@Resource
|
||||
private FileConfig fileConfig;
|
||||
@Autowired
|
||||
private FileConfig constantQiniu;
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("common/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.isValidFilename(fileName))
|
||||
{
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
|
||||
try {
|
||||
if (!FileUtils.isValidFilename(fileName)) {
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
@ -53,26 +66,23 @@ public class CommonController
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
if (delete) {
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
*/
|
||||
@PostMapping("/common/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
System.out.println("path=" + filePath);
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
@ -80,19 +90,57 @@ public class CommonController
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
*/
|
||||
@PostMapping("/common/uploadqiniu")
|
||||
public AjaxResult uploadFileQiNiu(MultipartFile file) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
//String fileName =FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String fileName = "video" + extractFilename(file);
|
||||
System.out.println("start===filename=" + fileName);
|
||||
|
||||
InputStream in = file.getInputStream();
|
||||
String url = ByFileUtil.uploadQNImg(in, fileName, fileConfig);
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
System.out.println("end===");
|
||||
return ajax;
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取七牛token
|
||||
**/
|
||||
@PostMapping("/common/getQiNiuToken")
|
||||
public AjaxResult getQiNiuToken() {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
|
||||
Auth auth = Auth.create(constantQiniu.getAccessKey(), constantQiniu.getSecretKey());
|
||||
System.out.println("auth:" + auth);
|
||||
String upToken = auth.uploadToken(constantQiniu.getBucket());
|
||||
ajax.put("token", upToken);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/common/download/resource")
|
||||
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
|
||||
{
|
||||
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
|
@ -138,7 +138,7 @@ public class VelocityUtils
|
||||
{
|
||||
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
|
||||
}
|
||||
else if (template.contains("serviceImpl.java.vm"))
|
||||
else if (template.contains("service.java.vm"))
|
||||
{
|
||||
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
||||
}
|
||||
|
@ -40,15 +40,15 @@ spring:
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
profiles:
|
||||
active: druid
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 50MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 100MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
@ -61,7 +61,7 @@ spring:
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 密码
|
||||
password:
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
@ -77,40 +77,40 @@ spring:
|
||||
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌秘钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌秘钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.project.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mybatis/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.project.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mybatis/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
params: count=countSql
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice/*
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
|
||||
# 代码生成
|
||||
gen:
|
||||
gen:
|
||||
# 作者
|
||||
author: tsbz
|
||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||
@ -118,4 +118,13 @@ gen:
|
||||
# 自动去除表前缀,默认是true
|
||||
autoRemovePre: false
|
||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||
tablePrefix: sys_
|
||||
tablePrefix: sys_
|
||||
|
||||
#七牛云
|
||||
file:
|
||||
access:
|
||||
key: 3leP0wEJvWdIck7x4QyzA3lS_Ua8eiFOUEDUro30
|
||||
secret:
|
||||
key: auEPimrlHeCBJFc8fcT3s8bOBULKwH_zK95xpQzV
|
||||
domain: https://files.benyiedu.com/
|
||||
bucket: bywebfile
|
||||
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="title" column="title" />
|
||||
<result property="information" column="information" />
|
||||
<result property="lecturer" column="lecturer" />
|
||||
<result property="lecturername" column="lecturername" />
|
||||
<result property="videourl" column="videourl" />
|
||||
<result property="type" column="type" />
|
||||
<result property="classtype" column="classtype" />
|
||||
@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectByTrainVideoVo">
|
||||
select id, title, information, lecturer, videourl, type, classtype, createuserid, createtime from by_train_video
|
||||
select id, title, information, lecturer,(select name from by_lecturer where lecturer=by_lecturer.id) as lecturername, videourl, type, classtype, createuserid, createtime from by_train_video
|
||||
</sql>
|
||||
|
||||
<select id="selectByTrainVideoList" parameterType="ByTrainVideo" resultMap="ByTrainVideoResult">
|
||||
@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||
<if test="information != null and information != ''"> and information = #{information}</if>
|
||||
<if test="lecturer != null and lecturer != ''"> and lecturer = #{lecturer}</if>
|
||||
<if test="lecturer != null "> and lecturer = #{lecturer}</if>
|
||||
<if test="videourl != null and videourl != ''"> and videourl = #{videourl}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="classtype != null and classtype != ''"> and classtype = #{classtype}</if>
|
||||
@ -44,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">title,</if>
|
||||
<if test="information != null and information != ''">information,</if>
|
||||
<if test="lecturer != null and lecturer != ''">lecturer,</if>
|
||||
<if test="lecturer != null ">lecturer,</if>
|
||||
<if test="videourl != null and videourl != ''">videourl,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="classtype != null and classtype != ''">classtype,</if>
|
||||
@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">#{title},</if>
|
||||
<if test="information != null and information != ''">#{information},</if>
|
||||
<if test="lecturer != null and lecturer != ''">#{lecturer},</if>
|
||||
<if test="lecturer != null ">#{lecturer},</if>
|
||||
<if test="videourl != null and videourl != ''">#{videourl},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="classtype != null and classtype != ''">#{classtype},</if>
|
||||
@ -68,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">title = #{title},</if>
|
||||
<if test="information != null and information != ''">information = #{information},</if>
|
||||
<if test="lecturer != null and lecturer != ''">lecturer = #{lecturer},</if>
|
||||
<if test="lecturer != null ">lecturer = #{lecturer},</if>
|
||||
<if test="videourl != null and videourl != ''">videourl = #{videourl},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="classtype != null and classtype != ''">classtype = #{classtype},</if>
|
||||
|
Reference in New Issue
Block a user