From 842e4a156af5326dff1ad12088098f3eada4decb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Wed, 15 Dec 2021 22:30:09 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Vue/.env.development | 2 +-
ZR.Vue/.env.production | 4 ++--
ZR.Vue/.env.staging | 2 +-
ZR.Vue/package.json | 2 +-
ZR.Vue/src/settings.js | 4 ++--
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ZR.Vue/.env.development b/ZR.Vue/.env.development
index e3942d6..e3d7f72 100644
--- a/ZR.Vue/.env.development
+++ b/ZR.Vue/.env.development
@@ -2,7 +2,7 @@
ENV = 'development'
# 页面标题
-VUE_APP_TITLE = ZrAdmin.NET管理系统
+VUE_APP_TITLE = 'ZrAdmin.NET后台管理'
# 开发环境
VUE_APP_BASE_API = '/dev-api'
diff --git a/ZR.Vue/.env.production b/ZR.Vue/.env.production
index c615a61..d54f532 100644
--- a/ZR.Vue/.env.production
+++ b/ZR.Vue/.env.production
@@ -2,10 +2,10 @@
ENV = 'production'
# 页面标题
-VUE_APP_TITLE = ZrAdmin.NET管理系统
+VUE_APP_TITLE = 'ZrAdmin.NET后台管理'
# 生产环境
VUE_APP_BASE_API = '/prod-api'
# 路由前缀
-VUE_APP_ROUTER_PREFIX = '/admin/'
+VUE_APP_ROUTER_PREFIX = '/'
diff --git a/ZR.Vue/.env.staging b/ZR.Vue/.env.staging
index 6907d21..4504612 100644
--- a/ZR.Vue/.env.staging
+++ b/ZR.Vue/.env.staging
@@ -2,7 +2,7 @@
ENV = 'staging'
# 页面标题
-VUE_APP_TITLE = ZrAdmin.NET管理系统
+VUE_APP_TITLE = 'ZrAdmin.NET后台管理'
# 测试环境
VUE_APP_BASE_API = '/stage-api'
diff --git a/ZR.Vue/package.json b/ZR.Vue/package.json
index 0564ec4..c8b8421 100644
--- a/ZR.Vue/package.json
+++ b/ZR.Vue/package.json
@@ -1,6 +1,6 @@
{
"name": "zradmin",
- "description": "ZrAdmnin.NET管理系统",
+ "description": "ZrAdmnin.NET后台管理",
"author": "ZR",
"scripts": {
"dev": "vue-cli-service serve",
diff --git a/ZR.Vue/src/settings.js b/ZR.Vue/src/settings.js
index 27e509d..1504f07 100644
--- a/ZR.Vue/src/settings.js
+++ b/ZR.Vue/src/settings.js
@@ -2,8 +2,8 @@ module.exports = {
/**
* 框架版本号
*/
- version: '3.7.0',
- title: 'ZrAdmin.NET-管理系统',
+ version: '3.7.2',
+ title: 'ZrAdmin.NET-后台管理',
/**
* 主题颜色
*/
From 021993f85a6ec4a6a89c60272f927d9a2c87d88c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Thu, 16 Dec 2021 11:29:03 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E5=AD=98=E5=82=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Infrastructure/Helper/FileUtil.cs | 4 +-
.../Controllers/CommonController.cs | 42 +-
.../Controllers/System/SysFileController.cs | 163 ++++++++
ZR.Admin.WebApi/NLog.config | 3 +-
.../CodeGenTemplate/TplControllers.txt | 1 +
ZR.Model/System/Dto/SysFileQueryDto.cs | 19 +
ZR.Model/System/SysFile.cs | 56 ++-
ZR.Repository/System/SysFileRepository.cs | 21 +
ZR.Service/System/IService/ISysFileService.cs | 6 +-
ZR.Service/System/SysFileService.cs | 22 +-
ZR.Vue/src/api/tool/file.js | 69 ++++
ZR.Vue/src/components/FileUpload/index.vue | 8 +-
ZR.Vue/src/views/tool/file/index.vue | 373 ++++++++++++------
document/admin-mysql.sql | 48 ++-
document/admin-sqlserver.sql | Bin 113514 -> 115006 bytes
15 files changed, 695 insertions(+), 140 deletions(-)
create mode 100644 ZR.Admin.WebApi/Controllers/System/SysFileController.cs
create mode 100644 ZR.Repository/System/SysFileRepository.cs
create mode 100644 ZR.Vue/src/api/tool/file.js
diff --git a/Infrastructure/Helper/FileUtil.cs b/Infrastructure/Helper/FileUtil.cs
index 1a3c000..d9bbb0a 100644
--- a/Infrastructure/Helper/FileUtil.cs
+++ b/Infrastructure/Helper/FileUtil.cs
@@ -12,7 +12,7 @@ namespace Infrastructure
/// 按时间来创建文件夹
///
///
- /// eg: /{yourPath}/2020/11/3
+ /// eg: /{yourPath}/2020/11/3/
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))
{
diff --git a/ZR.Admin.WebApi/Controllers/CommonController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs
index 14f1be7..b2b940f 100644
--- a/ZR.Admin.WebApi/Controllers/CommonController.cs
+++ b/ZR.Admin.WebApi/Controllers/CommonController.cs
@@ -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
/// 存储文件
///
///
+ /// 存储目录
///
[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
diff --git a/ZR.Admin.WebApi/Controllers/System/SysFileController.cs b/ZR.Admin.WebApi/Controllers/System/SysFileController.cs
new file mode 100644
index 0000000..05f2537
--- /dev/null
+++ b/ZR.Admin.WebApi/Controllers/System/SysFileController.cs
@@ -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
+{
+ ///
+ /// 文件存储Controller
+ ///
+ [Verify]
+ [Route("tool/file")]
+ public class SysFileController : BaseController
+ {
+ ///
+ /// 文件存储接口
+ ///
+ private readonly ISysFileService _SysFileService;
+
+ public SysFileController(ISysFileService SysFileService)
+ {
+ _SysFileService = SysFileService;
+ }
+
+ ///
+ /// 查询文件存储列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ [ActionPermissionFilter(Permission = "tool:file:list")]
+ public IActionResult QuerySysFile([FromQuery] SysFileQueryDto parm)
+ {
+ //开始拼装查询条件
+ var predicate = Expressionable.Create();
+ //搜索条件查询语法参考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);
+ }
+
+ ///
+ /// 查询文件存储详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "tool:file:query")]
+ public IActionResult GetSysFile(int Id)
+ {
+ var response = _SysFileService.GetFirst(x => x.Id == Id);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 添加文件存储
+ ///
+ ///
+ [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().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);
+ }
+
+ ///
+ /// 更新文件存储
+ ///
+ ///
+ [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().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);
+ }
+
+ ///
+ /// 删除文件存储
+ ///
+ ///
+ [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);
+ }
+
+ ///
+ /// 文件存储导出
+ ///
+ ///
+ [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 });
+ }
+ }
+}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/NLog.config b/ZR.Admin.WebApi/NLog.config
index 4982ce8..95cb5ee 100644
--- a/ZR.Admin.WebApi/NLog.config
+++ b/ZR.Admin.WebApi/NLog.config
@@ -55,10 +55,9 @@
+
-
-
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
index 0996ead..74c282b 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
@@ -42,6 +42,7 @@ namespace ${options.ApiControllerNamespace}.Controllers
///
/// 查询${genTable.FunctionName}列表
///
+ ///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:list")]
diff --git a/ZR.Model/System/Dto/SysFileQueryDto.cs b/ZR.Model/System/Dto/SysFileQueryDto.cs
index 868534d..4cfa45d 100644
--- a/ZR.Model/System/Dto/SysFileQueryDto.cs
+++ b/ZR.Model/System/Dto/SysFileQueryDto.cs
@@ -4,7 +4,26 @@ using System.Text;
namespace ZR.Model.System.Dto
{
+ ///
+ /// 文件存储输入对象
+ ///
+ 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; }
}
}
diff --git a/ZR.Model/System/SysFile.cs b/ZR.Model/System/SysFile.cs
index 569abb6..0bfc99f 100644
--- a/ZR.Model/System/SysFile.cs
+++ b/ZR.Model/System/SysFile.cs
@@ -9,14 +9,56 @@ namespace ZR.Model.System
[SugarTable("sys_file")]
public class SysFile
{
- public int Id { get; set; }
- public string FilePath { get; set; }
+ ///
+ /// 描述 : 自增id
+ /// 空值 : false
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public long Id { get; set; }
+ ///
+ /// 描述 : 文件名
+ /// 空值 : true
+ ///
public string FileName { get; set; }
+ ///
+ /// 描述 : 文件存储地址
+ /// 空值 : true
+ ///
+ public string FileUrl { get; set; }
+ ///
+ /// 描述 : 仓库位置
+ /// 空值 : true
+ ///
public string StorePath { get; set; }
- public string AccessPat { get; set; }
- public int FileSize { get; set; }
+ ///
+ /// 描述 : 文件大小
+ /// 空值 : true
+ ///
+ public string FileSize { get; set; }
+ ///
+ /// 描述 : 文件扩展名
+ /// 空值 : true
+ ///
public string FileExt { get; set; }
- public DateTime? AddTime { get; set; }
-
+ ///
+ /// 描述 : 创建人
+ /// 空值 : true
+ ///
+ public string Create_by { get; set; }
+ ///
+ /// 描述 : 上传时间
+ /// 空值 : true
+ ///
+ public DateTime? Create_time { get; set; }
+ ///
+ /// 描述 : 存储类型
+ /// 空值 : true
+ ///
+ public int? StoreType { get; set; }
+ ///
+ /// 描述 : 访问路径
+ /// 空值 : true
+ ///
+ public string AccessUrl { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/ZR.Repository/System/SysFileRepository.cs b/ZR.Repository/System/SysFileRepository.cs
new file mode 100644
index 0000000..867dd5f
--- /dev/null
+++ b/ZR.Repository/System/SysFileRepository.cs
@@ -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
+{
+ ///
+ /// 文件存储仓储
+ ///
+ /// @author zz
+ /// @date 2021-12-15
+ ///
+ [AppService(ServiceLifetime = LifeTime.Transient)]
+ public class SysFileRepository : BaseRepository
+ {
+ #region 业务逻辑代码
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/ZR.Service/System/IService/ISysFileService.cs b/ZR.Service/System/IService/ISysFileService.cs
index c4dc983..e3971a3 100644
--- a/ZR.Service/System/IService/ISysFileService.cs
+++ b/ZR.Service/System/IService/ISysFileService.cs
@@ -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
{
+ long InsertFile(SysFile file);
+
///
/// 上传文件
///
diff --git a/ZR.Service/System/SysFileService.cs b/ZR.Service/System/SysFileService.cs
index bab5cb3..e189b0f 100644
--- a/ZR.Service/System/SysFileService.cs
+++ b/ZR.Service/System/SysFileService.cs
@@ -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
/// 文件管理
///
[AppService(ServiceType = typeof(ISysFileService), ServiceLifetime = LifeTime.Transient)]
- public class SysFileService : ISysFileService
+ public class SysFileService : BaseService, ISysFileService
{
private string domainUrl = ConfigUtils.Instance.GetConfig("ALIYUN_OSS:domainUrl");
+ private readonly SysFileRepository SysFileRepository;
+
+ public SysFileService(SysFileRepository repository) : base(repository)
+ {
+ SysFileRepository = repository;
+ }
///
/// 上传文件到阿里云
@@ -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;
+ }
}
}
diff --git a/ZR.Vue/src/api/tool/file.js b/ZR.Vue/src/api/tool/file.js
new file mode 100644
index 0000000..03b64a8
--- /dev/null
+++ b/ZR.Vue/src/api/tool/file.js
@@ -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
+ })
+}
+
diff --git a/ZR.Vue/src/components/FileUpload/index.vue b/ZR.Vue/src/components/FileUpload/index.vue
index 9617600..b4f4adb 100644
--- a/ZR.Vue/src/components/FileUpload/index.vue
+++ b/ZR.Vue/src/components/FileUpload/index.vue
@@ -1,7 +1,7 @@
选取文件
@@ -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;
}
diff --git a/ZR.Vue/src/views/tool/file/index.vue b/ZR.Vue/src/views/tool/file/index.vue
index ef152d8..9488882 100644
--- a/ZR.Vue/src/views/tool/file/index.vue
+++ b/ZR.Vue/src/views/tool/file/index.vue
@@ -1,126 +1,225 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 查询
- 重置
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
- 上传文件
+ 上传文件
-
+
+
+ 删除
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
- 详情
- 编辑
- 删除
+
+ 删除
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 存储文件夹前缀
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/document/admin-mysql.sql b/document/admin-mysql.sql
index 77245aa..328d071 100644
--- a/document/admin-mysql.sql
+++ b/document/admin-mysql.sql
@@ -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;
+
diff --git a/document/admin-sqlserver.sql b/document/admin-sqlserver.sql
index d0b4a1d06b8a3b8d10bf32fa97b26d26c4c0edd2..94f1367f8cb215d134603b20d62153951e73a015 100644
GIT binary patch
delta 741
zcmZva-%Aux6vw}(qIIk-EKS9ik&VmE53TP=sJ0
zJ&o>p=qVx)dn{oc?0-t(t+{Og;@>o1hs
z;pNM8vwh8}Su?X+sr*~6Y|y-0xzKiW0gJqsp{a;WP=LezpJ?cOeE}VVh@xFaUAE_;
z`7w@3+~Du;sgHAIvN*dG!=rEvQqxQdwX*@=Oe|)6wjwIp|F-fm0aF~|1Oxo
zQj)QQ>KE&*M@dfY(iv}Xm&WNYwd0@U
delta 104
zcmdnj#Qy3VTf-K{xNXyYLK!8d$82U)G7n~OWe8zVV9;RjVen^gX7FZ+2Z{s(S&l#v
zN1&W1P}~ow!WM`_fFe#nao6qXdl==Jr-gfRSUm&H+ZQ?SJ+&IxzwObi^7<