新增加文件存储
This commit is contained in:
parent
842e4a156a
commit
021993f85a
@ -12,7 +12,7 @@ namespace Infrastructure
|
||||
/// 按时间来创建文件夹
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>eg: /{yourPath}/2020/11/3</returns>
|
||||
/// <returns>eg: /{yourPath}/2020/11/3/</returns>
|
||||
public static string GetdirPath(string path = "")
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
@ -21,7 +21,7 @@ namespace Infrastructure
|
||||
int day = date.Day;
|
||||
int hour = date.Hour;
|
||||
|
||||
string timeDir = $"{year}{month}{day}";// date.ToString("yyyyMM/dd/HH/");
|
||||
string timeDir = $"{year}{month}{day}/";// date.ToString("yyyyMM/dd/HH/");
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
|
||||
@ -9,8 +9,10 @@ using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Common;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
@ -82,17 +84,20 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// 存储文件
|
||||
/// </summary>
|
||||
/// <param name="formFile"></param>
|
||||
/// <param name="fileDir">存储目录</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Verify]
|
||||
[ActionPermissionFilter(Permission = "common")]
|
||||
public IActionResult UploadFile([FromForm(Name = "file")] IFormFile formFile)
|
||||
public IActionResult UploadFile([FromForm(Name = "file")] IFormFile formFile, string fileDir = "uploads")
|
||||
{
|
||||
if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空");
|
||||
string fileExt = Path.GetExtension(formFile.FileName);
|
||||
string fileName = FileUtil.HashFileName(Guid.NewGuid().ToString()).ToLower() + fileExt;
|
||||
string finalFilePath = Path.Combine(WebHostEnvironment.WebRootPath, FileUtil.GetdirPath("uploads"), fileName);
|
||||
string filePath = FileUtil.GetdirPath(fileDir);
|
||||
string finalFilePath = Path.Combine(WebHostEnvironment.WebRootPath, filePath, fileName);
|
||||
finalFilePath = finalFilePath.Replace("\\", "/").Replace("//", "/");
|
||||
double fileSize = formFile.Length / 1024;
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(finalFilePath)))
|
||||
{
|
||||
@ -104,11 +109,24 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
formFile.CopyTo(stream);
|
||||
}
|
||||
|
||||
string accessPath = $"{OptionsSetting.Upload.UploadUrl}/{FileUtil.GetdirPath("uploads").Replace("\\", " /")}{fileName}";
|
||||
string accessPath = $"{OptionsSetting.Upload.UploadUrl}/{filePath.Replace("\\", " /")}{fileName}";
|
||||
SysFile file = new()
|
||||
{
|
||||
AccessUrl = accessPath,
|
||||
Create_by = HttpContext.GetName(),
|
||||
FileExt = fileExt,
|
||||
FileName = fileName,
|
||||
FileSize = fileSize + "kb",
|
||||
StoreType = 1,
|
||||
FileUrl = finalFilePath,
|
||||
Create_time = DateTime.Now
|
||||
};
|
||||
long fileId = SysFileService.InsertFile(file);
|
||||
return ToResponse(ResultCode.SUCCESS, new
|
||||
{
|
||||
url = accessPath,
|
||||
fileName
|
||||
fileName,
|
||||
fileId
|
||||
});
|
||||
}
|
||||
|
||||
@ -127,7 +145,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
string fileExt = Path.GetExtension(formFile.FileName);
|
||||
string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".jpeg", ".webp", ".svga", ".xls" };
|
||||
int MaxContentLength = 1024 * 1024 * 5;
|
||||
|
||||
double fileSize = formFile.Length / 1024;
|
||||
if (!AllowedFileExtensions.Contains(fileExt))
|
||||
{
|
||||
return ToResponse(ResultCode.CUSTOM_ERROR, "上传失败,未经允许上传类型");
|
||||
@ -138,11 +156,21 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
return ToResponse(ResultCode.CUSTOM_ERROR, "上传文件过大,不能超过 " + (MaxContentLength / 1024).ToString() + " MB");
|
||||
}
|
||||
(bool, string, string) result = SysFileService.SaveFile(fileDir, formFile);
|
||||
|
||||
long fileId = SysFileService.InsertFile(new SysFile()
|
||||
{
|
||||
AccessUrl = result.Item2,
|
||||
Create_by = HttpContext.GetName(),
|
||||
FileExt = fileExt,
|
||||
FileName = result.Item3,
|
||||
FileSize = fileSize + "kb",
|
||||
StoreType = 2,
|
||||
StorePath = fileDir
|
||||
});
|
||||
return ToResponse(ResultCode.SUCCESS, new
|
||||
{
|
||||
url = result.Item2,
|
||||
fileName = result.Item3
|
||||
fileName = result.Item3,
|
||||
fileId
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
163
ZR.Admin.WebApi/Controllers/System/SysFileController.cs
Normal file
163
ZR.Admin.WebApi/Controllers/System/SysFileController.cs
Normal file
@ -0,0 +1,163 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Common;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service.System.IService;
|
||||
using ZR.Model.System.Dto;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储Controller
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("tool/file")]
|
||||
public class SysFileController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储接口
|
||||
/// </summary>
|
||||
private readonly ISysFileService _SysFileService;
|
||||
|
||||
public SysFileController(ISysFileService SysFileService)
|
||||
{
|
||||
_SysFileService = SysFileService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询文件存储列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "tool:file:list")]
|
||||
public IActionResult QuerySysFile([FromQuery] SysFileQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件
|
||||
var predicate = Expressionable.Create<SysFile>();
|
||||
//搜索条件查询语法参考Sqlsugar
|
||||
predicate = predicate.AndIF(parm.BeginCreate_time != null, it => it.Create_time >= parm.BeginCreate_time);
|
||||
predicate = predicate.AndIF(parm.EndCreate_time != null, it => it.Create_time <= parm.EndCreate_time);
|
||||
predicate = predicate.AndIF(parm.StoreType != null, m => m.StoreType == parm.StoreType);
|
||||
|
||||
//搜索条件查询语法参考Sqlsugar
|
||||
var response = _SysFileService.GetPages(predicate.ToExpression(), parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询文件存储详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "tool:file:query")]
|
||||
public IActionResult GetSysFile(int Id)
|
||||
{
|
||||
var response = _SysFileService.GetFirst(x => x.Id == Id);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加文件存储
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "tool:file:add")]
|
||||
[Log(Title = "文件存储", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddSysFile([FromBody] SysFileDto parm)
|
||||
{
|
||||
if (parm == null)
|
||||
{
|
||||
throw new CustomException("请求参数错误");
|
||||
}
|
||||
//从 Dto 映射到 实体
|
||||
var model = parm.Adapt<SysFile>().ToCreate(HttpContext);
|
||||
|
||||
var response = _SysFileService.Insert(model, it => new
|
||||
{
|
||||
it.FileName,
|
||||
it.FileUrl,
|
||||
it.StorePath,
|
||||
it.FileSize,
|
||||
it.FileExt,
|
||||
it.Create_by,
|
||||
it.Create_time,
|
||||
it.StoreType,
|
||||
it.AccessUrl,
|
||||
});
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新文件存储
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "tool:file:update")]
|
||||
[Log(Title = "文件存储", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateSysFile([FromBody] SysFileDto parm)
|
||||
{
|
||||
if (parm == null)
|
||||
{
|
||||
throw new CustomException("请求实体不能为空");
|
||||
}
|
||||
//从 Dto 映射到 实体
|
||||
var model = parm.Adapt<SysFile>().ToUpdate(HttpContext);
|
||||
|
||||
var response = _SysFileService.Update(w => w.Id == model.Id, it => new SysFile()
|
||||
{
|
||||
//Update 字段映射
|
||||
FileUrl = model.FileUrl,
|
||||
StorePath = model.StorePath,
|
||||
FileSize = model.FileSize,
|
||||
FileExt = model.FileExt,
|
||||
StoreType = model.StoreType,
|
||||
AccessUrl = model.AccessUrl,
|
||||
});
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除文件存储
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "tool:file:delete")]
|
||||
[Log(Title = "文件存储", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteSysFile(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _SysFileService.Delete(idsArr);
|
||||
//TODO 删除本地资源
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件存储导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "文件存储")]
|
||||
[HttpGet("export")]
|
||||
[ActionPermissionFilter(Permission = "tool:file:export")]
|
||||
public IActionResult Export()
|
||||
{
|
||||
var list = _SysFileService.GetAll();
|
||||
|
||||
string sFileName = ExportExcel(list, "SysFile", "文件存储");
|
||||
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,10 +55,9 @@
|
||||
<!--<logger name="System.*" writeTo="blackhole" final="true" />-->
|
||||
<!-- Quartz -->
|
||||
<logger name="Quartz*" minlevel="Trace" maxlevel="Info" final="true" />
|
||||
<logger name="*" minLevel="Debug" writeTo="console"/>
|
||||
<logger name="ZR.Admin.WebApi.Startup" final="true" writeTo="sqlfile"/>
|
||||
|
||||
<logger name="*" minLevel="Debug" writeTo="console"/>
|
||||
<!--所有日志都写入到控制台-->
|
||||
<logger name="*" minLevel="Trace" writeTo="allfile" />
|
||||
<!--Skip non-critical Microsoft logs and so log only own logs-->
|
||||
<logger name="Microsoft.*,Quartz.Core.QuartzSchedulerThread" maxlevel="Info" final="true" />
|
||||
|
||||
@ -42,6 +42,7 @@ namespace ${options.ApiControllerNamespace}.Controllers
|
||||
/// <summary>
|
||||
/// 查询${genTable.FunctionName}列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:list")]
|
||||
|
||||
@ -4,7 +4,26 @@ using System.Text;
|
||||
|
||||
namespace ZR.Model.System.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储输入对象
|
||||
/// </summary>
|
||||
public class SysFileDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string FileUrl { get; set; }
|
||||
public string StorePath { get; set; }
|
||||
public string FileSize { get; set; }
|
||||
public string FileExt { get; set; }
|
||||
public string Create_by { get; set; }
|
||||
public DateTime? Create_time { get; set; }
|
||||
public int? StoreType { get; set; }
|
||||
public string AccessUrl { get; set; }
|
||||
}
|
||||
public class SysFileQueryDto : PagerInfo
|
||||
{
|
||||
public DateTime? BeginCreate_time { get; set; }
|
||||
public DateTime? EndCreate_time { get; set; }
|
||||
public int? StoreType { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,14 +9,56 @@ namespace ZR.Model.System
|
||||
[SugarTable("sys_file")]
|
||||
public class SysFile
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 自增id
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 文件名
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public string FileName { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 文件存储地址
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public string FileUrl { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 仓库位置
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public string StorePath { get; set; }
|
||||
public string AccessPat { get; set; }
|
||||
public int FileSize { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 文件大小
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public string FileSize { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 文件扩展名
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public string FileExt { get; set; }
|
||||
public DateTime? AddTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 创建人
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public string Create_by { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 上传时间
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public DateTime? Create_time { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 存储类型
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public int? StoreType { get; set; }
|
||||
/// <summary>
|
||||
/// 描述 : 访问路径
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
public string AccessUrl { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
21
ZR.Repository/System/SysFileRepository.cs
Normal file
21
ZR.Repository/System/SysFileRepository.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Model.Models;
|
||||
using ZR.Model.System;
|
||||
|
||||
namespace ZR.Repository.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储仓储
|
||||
///
|
||||
/// @author zz
|
||||
/// @date 2021-12-15
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysFileRepository : BaseRepository<SysFile>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,14 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using ZR.Model.Models;
|
||||
using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysFileService
|
||||
public interface ISysFileService : IBaseService<SysFile>
|
||||
{
|
||||
long InsertFile(SysFile file);
|
||||
|
||||
/// <summary>
|
||||
/// 上传文件
|
||||
/// </summary>
|
||||
|
||||
@ -8,6 +8,8 @@ using System;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.Net;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
@ -15,9 +17,15 @@ namespace ZR.Service.System
|
||||
/// 文件管理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysFileService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysFileService : ISysFileService
|
||||
public class SysFileService : BaseService<SysFile>, ISysFileService
|
||||
{
|
||||
private string domainUrl = ConfigUtils.Instance.GetConfig("ALIYUN_OSS:domainUrl");
|
||||
private readonly SysFileRepository SysFileRepository;
|
||||
|
||||
public SysFileService(SysFileRepository repository) : base(repository)
|
||||
{
|
||||
SysFileRepository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传文件到阿里云
|
||||
@ -65,5 +73,17 @@ namespace ZR.Service.System
|
||||
return BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(str)), 4, 8).Replace("-", "");
|
||||
}
|
||||
|
||||
public long InsertFile(SysFile file)
|
||||
{
|
||||
try
|
||||
{
|
||||
return InsertReturnBigIdentity(file);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("存储图片失败" + ex.Message);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
69
ZR.Vue/src/api/tool/file.js
Normal file
69
ZR.Vue/src/api/tool/file.js
Normal file
@ -0,0 +1,69 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 文件存储分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listSysfile(query) {
|
||||
return request({
|
||||
url: 'tool/file/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件存储
|
||||
* @param data
|
||||
*/
|
||||
export function addSysfile(data) {
|
||||
return request({
|
||||
url: 'tool/file',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件存储
|
||||
* @param data
|
||||
*/
|
||||
export function updateSysfile(data) {
|
||||
return request({
|
||||
url: 'tool/file',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件存储详情
|
||||
* @param {Id}
|
||||
*/
|
||||
export function getSysfile(id) {
|
||||
return request({
|
||||
url: 'tool/file/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件存储
|
||||
* @param {主键} pid
|
||||
*/
|
||||
export function delSysfile(pid) {
|
||||
return request({
|
||||
url: 'tool/file/' + pid,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出文件存储
|
||||
export function exportSysfile(query) {
|
||||
return request({
|
||||
url: 'tool/file/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="upload-file">
|
||||
<el-upload :action="uploadFileUrl" :before-upload="handleBeforeUpload" :file-list="fileList" :limit="limit" :on-error="handleUploadError"
|
||||
:on-exceed="handleExceed" :on-success="handleUploadSuccess" :show-file-list="false" :headers="headers" class="upload-file-uploader"
|
||||
:on-exceed="handleExceed" :on-success="handleUploadSuccess" :show-file-list="false" :data="data" :headers="headers" class="upload-file-uploader"
|
||||
ref="upload">
|
||||
<!-- 上传按钮 -->
|
||||
<el-button size="mini" type="primary" icon="el-icon-upload">选取文件</el-button>
|
||||
@ -61,7 +61,12 @@ export default {
|
||||
type: String,
|
||||
default: "/Common/UploadFile",
|
||||
},
|
||||
// form 列名
|
||||
column: [String],
|
||||
// 上传携带的参数
|
||||
data: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -145,6 +150,7 @@ export default {
|
||||
// 上传成功回调
|
||||
handleUploadSuccess(res, file) {
|
||||
if (res.code != 200) {
|
||||
this.fileList = [];
|
||||
this.msgError(`上传失败,原因:${res.msg}!`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,126 +1,225 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="24">
|
||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" v-show="showSearch" @submit.native.prevent>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="存储位置" prop="saveStore">
|
||||
<el-select v-model="queryParams.saveStore" placeholder="请选择存储位置">
|
||||
<el-option v-for="dict in options" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="文件仓库" prop="savePath">
|
||||
<el-input v-model="queryParams.savePath" placeholder="请输入文件仓库" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="文件名" prop="fileName">
|
||||
<el-input v-model="queryParams.fileName" placeholder="请输入文件名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" style="text-align:center;">
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-form>
|
||||
</el-row>
|
||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||
<el-form-item label="上传时间">
|
||||
<el-date-picker v-model="dateRangeCreate_time" size="small" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" placeholder="请选择上传时间"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="存储类型" prop="storeType">
|
||||
<el-select v-model="queryParams.storeType" placeholder="请选择存储类型" size="small" clearable="">
|
||||
<el-option v-for="item in storeTypeOptions" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-row class="mb8" style="text-align:center">
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-upload size="mini" :action="uploadUrl" :on-change="handleChange">上传文件</el-upload>
|
||||
<el-button type="primary" v-hasPermi="['System:sysfile:add']" plain icon="el-icon-upload" size="mini" @click="handleAdd">上传文件</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" :disabled="single" v-hasPermi="['System:sysfile:update']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" :disabled="multiple" v-hasPermi="['System:sysfile:delete']" plain icon="el-icon-delete" size="mini"
|
||||
@click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 数据区域 -->
|
||||
<el-table :data="dataList" ref="table" border>
|
||||
<el-table-column prop="id" label="id" width="60" sortable> </el-table-column>
|
||||
<el-table-column prop="saveStore" label="存储位置" :show-overflow-tooltip="true"> </el-table-column>
|
||||
<el-table-column prop="savePath" label="文件仓库" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="fileName" label="文件名" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="fileExt" label="文件扩展名" />
|
||||
<el-table-column prop="fileSize" label="文件大小" />
|
||||
<el-table-column prop="addtime" label="创建时间"> </el-table-column>
|
||||
<el-table :data="dataList" v-loading="loading" ref="table" border highlight-current-row @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column prop="id" label="文件id" align="center" width="80" />
|
||||
<el-table-column prop="fileName" label="文件名" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="storePath" label="仓库位置" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="fileSize" label="文件大小" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="fileExt" label="扩展名" align="center" :show-overflow-tooltip="true" width="80px" />
|
||||
<el-table-column prop="storeType" label="存储类型" align="center" :formatter="storeTypeFormat" />
|
||||
<el-table-column prop="create_time" label="存储时间" align="center"/>
|
||||
<el-table-column prop="accessUrl" label="访问路径" align="center" :show-overflow-tooltip="true">
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">详情</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<!-- <el-button v-hasPermi="['System:sysfile:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button> -->
|
||||
<el-button v-hasPermi="['System:sysfile:delete']" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改文件存储对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
|
||||
<el-row>
|
||||
<!-- <el-col :span="12">
|
||||
<el-form-item label="自定文件名" prop="fileName">
|
||||
<el-input v-model="form.fileName" placeholder="请输入文件名" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="存储类型" prop="storeType">
|
||||
<el-select v-model="form.storeType" placeholder="请选择存储类型" @change="handleSelectStore">
|
||||
<el-option v-for="item in storeTypeOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="存储文件夹前缀" prop="storePath">
|
||||
<span slot="label">
|
||||
<el-tooltip content="比如存储到'/uploads' '如果不填写默认按时间存储eg:/2021/12/16(固定段)'" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
存储文件夹前缀
|
||||
</span>
|
||||
<el-input v-model="form.storePath" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上传文件" prop="accessUrl">
|
||||
<UploadFile v-model="form.accessUrl" :uploadUrl="uploadUrl" :fileType="fileType" :data="{ 'fileDir' : form.storePath}"
|
||||
column="accessUrl" @input="handleUploadSuccess" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import { getXXXX} from '@/api/xxxx.js'
|
||||
import {
|
||||
listSysfile,
|
||||
addSysfile,
|
||||
delSysfile,
|
||||
updateSysfile,
|
||||
getSysfile,
|
||||
exportSysfile,
|
||||
} from "@/api/tool/file.js";
|
||||
|
||||
export default {
|
||||
name: "file",
|
||||
name: "Sysfile",
|
||||
data() {
|
||||
return {
|
||||
labelWidth: "100px",
|
||||
formLabelWidth: "100px",
|
||||
// 选中id数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 查询参数
|
||||
queryParams: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
storeType: 1,
|
||||
},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// xxx下拉框
|
||||
options: [
|
||||
{
|
||||
dictValue: 1,
|
||||
dictLabel: "阿里云",
|
||||
},
|
||||
{
|
||||
dictValue: 2,
|
||||
dictLabel: "腾讯云",
|
||||
},
|
||||
{
|
||||
dictValue: 3,
|
||||
dictLabel: "七牛云",
|
||||
},
|
||||
{
|
||||
dictValue: 4,
|
||||
dictLabel: "本地",
|
||||
},
|
||||
form: {
|
||||
},
|
||||
columns: [
|
||||
{ index: 0, key: "id", label: `自增id`, checked: true },
|
||||
{ index: 1, key: "fileName", label: `文件名`, checked: true },
|
||||
{ index: 2, key: "fileUrl", label: `文件存储地址`, checked: true },
|
||||
{ index: 3, key: "storePath", label: `仓库位置`, checked: true },
|
||||
{ index: 4, key: "fileSize", label: `文件大小`, checked: true },
|
||||
{ index: 5, key: "fileExt", label: `文件扩展名`, checked: true },
|
||||
{ index: 6, key: "create_by", label: `创建人`, checked: true },
|
||||
{ index: 7, key: "create_time", label: `上传时间`, checked: true },
|
||||
{ index: 8, key: "storeType", label: `存储类型`, checked: true },
|
||||
{ index: 9, key: "accessUrl", label: `访问路径`, checked: false },
|
||||
],
|
||||
//上传时间时间范围
|
||||
dateRangeCreate_time: [],
|
||||
// 存储类型选项列表
|
||||
storeTypeOptions: [
|
||||
{ dictLabel: "本地存储", dictValue: 1 },
|
||||
{ dictLabel: "阿里云存储", dictValue: 2 },
|
||||
],
|
||||
// 上传文件地址
|
||||
uploadUrl: "/common/uploadFile",
|
||||
fileType: [
|
||||
"doc",
|
||||
"xls",
|
||||
"ppt",
|
||||
"txt",
|
||||
"pdf",
|
||||
"svga",
|
||||
"json",
|
||||
"jpg",
|
||||
"jpeg",
|
||||
"png",
|
||||
],
|
||||
uploadUrl: process.env.VUE_APP_BASE_API + "/upload/SaveFile",
|
||||
// 数据列表
|
||||
dataList: [
|
||||
|
||||
],
|
||||
dataList: [],
|
||||
// 总记录数
|
||||
total: 0,
|
||||
// 提交按钮是否显示
|
||||
btnSubmitVisible: true,
|
||||
// 表单校验
|
||||
rules: {
|
||||
accessUrl: [
|
||||
{
|
||||
required: true,
|
||||
message: "上传文件不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
storeType: [
|
||||
{
|
||||
required: true,
|
||||
message: "存储类型不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
// 列表数据查询
|
||||
this.getList();
|
||||
|
||||
var dictParams = [];
|
||||
},
|
||||
methods: {
|
||||
// 查询数据
|
||||
getList() {
|
||||
console.log(JSON.stringify(this.queryParams));
|
||||
console.log(process.env.VUE_APP_BASE_API);
|
||||
//TODO 请求数据
|
||||
this.queryParams["beginCreate_time"] = this.addDateRange2(
|
||||
this.dateRangeCreate_time,
|
||||
0
|
||||
);
|
||||
this.queryParams["endCreate_time"] = this.addDateRange2(
|
||||
this.dateRangeCreate_time,
|
||||
1
|
||||
);
|
||||
this.loading = true;
|
||||
listSysfile(this.queryParams).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.dataList = res.data.result;
|
||||
this.total = res.data.totalNum;
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
@ -129,81 +228,125 @@ export default {
|
||||
},
|
||||
// 重置数据表单
|
||||
reset() {
|
||||
this.btnSubmitVisible = true;
|
||||
this.form = {
|
||||
Id: undefined,
|
||||
// TODO 其他列字段
|
||||
fileName: undefined,
|
||||
fileUrl: undefined,
|
||||
storePath: "",
|
||||
fileSize: undefined,
|
||||
fileExt: undefined,
|
||||
storeType: 1,
|
||||
accessUrl: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 重置查询操作 */
|
||||
resetQuery() {
|
||||
this.timeRange = [];
|
||||
//上传时间时间范围
|
||||
this.dateRangeCreate_time = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
handleChange(file, fileList) {
|
||||
// this.fileList = fileList.slice(-3);
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "上传文件";
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$confirm("是否确认删除吗?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
const Ids = row.id || this.ids;
|
||||
|
||||
this.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
|
||||
.then(function () {
|
||||
// TODO 网络请求删除操作
|
||||
//return delMenu(row.menuId);
|
||||
return delSysfile(Ids);
|
||||
})
|
||||
.then(() => {
|
||||
// this.getList();
|
||||
this.handleQuery();
|
||||
this.msgSuccess("删除成功");
|
||||
});
|
||||
|
||||
//TODO 业务代码
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "编辑";
|
||||
//TODO 业务代码
|
||||
console.log(JSON.stringify(row));
|
||||
const id = row.id || this.ids;
|
||||
getSysfile(id).then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
this.open = true;
|
||||
this.title = "修改数据";
|
||||
|
||||
// TODO 给表单赋值
|
||||
this.form = {
|
||||
content: row.content,
|
||||
userId: row.userId,
|
||||
name: row.name,
|
||||
sortId: row.sortId,
|
||||
};
|
||||
this.form = {
|
||||
...data,
|
||||
};
|
||||
}
|
||||
});
|
||||
},
|
||||
//图片上传成功方法
|
||||
handleUploadSuccess(columnName, filelist) {
|
||||
this.form[columnName] = filelist;
|
||||
},
|
||||
// 存储类型字典翻译
|
||||
storeTypeFormat(row, column) {
|
||||
return this.selectDictLabel(this.storeTypeOptions, row.storeType);
|
||||
},
|
||||
handleSelectStore(val) {
|
||||
if (val == 1) {
|
||||
this.uploadUrl = "/common/uploadFile";
|
||||
} else if (val == 2) {
|
||||
thiis.uploadUrl = "/common/UploadFileAliyun";
|
||||
}
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(JSON.stringify(this.form));
|
||||
// TODO 记得改成表的主键
|
||||
if (this.form.Id != undefined) {
|
||||
//TODO 业务代码
|
||||
|
||||
if (this.form.id != undefined && this.title === "修改数据") {
|
||||
updateSysfile(this.form)
|
||||
.then((res) => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
})
|
||||
.catch((err) => {
|
||||
//TODO 错误逻辑
|
||||
});
|
||||
} else {
|
||||
//TODO 业务代码
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 详情
|
||||
handleView(row) {
|
||||
this.open = true;
|
||||
this.title = "详情";
|
||||
// TODO 给表单赋值
|
||||
this.form = {
|
||||
|
||||
};
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
// handleExport() {
|
||||
// const queryParams = this.queryParams;
|
||||
// this.$confirm("是否确认导出所有文件存储数据项?", "警告", {
|
||||
// confirmButtonText: "确定",
|
||||
// cancelButtonText: "取消",
|
||||
// type: "warning",
|
||||
// })
|
||||
// .then(function () {
|
||||
// return exportSysfile(queryParams);
|
||||
// })
|
||||
// .then((response) => {
|
||||
// this.download(response.data.path);
|
||||
// });
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
@ -339,6 +339,30 @@ INSERT INTO sys_menu VALUES (1063, '导入代码', 115, 1, '#', NULL, 0, 0, 'F',
|
||||
INSERT INTO sys_menu VALUES (1064, '生成代码', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:gen:code', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (1065, '预览代码', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:gen:preview', '', '', SYSDATE(), '', NULL, NULL);
|
||||
|
||||
|
||||
-- 文件存储菜单
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by, create_time, remark)
|
||||
VALUES ('文件存储', 3, 1, 'file', 'tool/file/index', 0, 0, 'C', '0', '0', 'tool:file:list', 'upload', '', sysdate(), '文件存储菜单');
|
||||
|
||||
-- 按钮父菜单id
|
||||
SELECT @fileMenuId := LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('查询', @fileMenuId, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:query', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('新增', @fileMenuId, 2, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:add', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('删除', @fileMenuId, 3, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:delete', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('修改', @fileMenuId, 4, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:update', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('导出', @fileMenuId, 5, '#', NULL, 0, 0, 'F', '0', '0', 'tool:file:export', '', sysdate());
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_oper_log
|
||||
-- ----------------------------
|
||||
@ -362,7 +386,7 @@ CREATE TABLE `sys_oper_log` (
|
||||
`operTime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
|
||||
`elapsed` bigint(20) NULL DEFAULT NULL COMMENT '请求用时',
|
||||
PRIMARY KEY (`operId`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 117 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '操作日志记录' ROW_FORMAT = Dynamic;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '操作日志记录' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_post
|
||||
@ -700,8 +724,6 @@ CREATE TABLE `gen_table_column` (
|
||||
PRIMARY KEY (`columnId`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 63 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '代码生成业务表字段' ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
-- ----------------------------
|
||||
-- 代码生成测试
|
||||
-- Table structure for gen_demo
|
||||
@ -722,4 +744,22 @@ CREATE TABLE `gen_demo` (
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
GO
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_file 文件存储
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_file`;
|
||||
CREATE TABLE `sys_file` (
|
||||
`id` BIGINT(11) NOT NULL AUTO_INCREMENT,
|
||||
`fileName` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件名',
|
||||
`fileUrl` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件存储地址',
|
||||
`storePath` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '仓库位置',
|
||||
`accessUrl` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '访问路径',
|
||||
`fileSize` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件大小',
|
||||
`fileExt` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件扩展名',
|
||||
`create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '上传时间',
|
||||
`storeType` int(4) NULL DEFAULT NULL COMMENT '存储类型',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user