From 01cd8aaf157bcdbf3451b0225133bc477e164750 Mon Sep 17 00:00:00 2001
From: izory <791736813@qq.com>
Date: Sat, 20 Nov 2021 17:43:55 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4Npoi.Mapper=E5=8C=85=EF=BC=8C?=
=?UTF-8?q?SqlSugarCoreNoDrive=E5=8D=87=E7=BA=A7=E8=87=B35.0.43?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/System/SysUserController.cs | 73 +++++++++----------
ZR.CodeGenerator/ZR.CodeGenerator.csproj | 2 +-
ZR.Common/ZR.Common.csproj | 1 -
ZR.Model/System/SysUser.cs | 5 --
ZR.Model/ZR.Model.csproj | 3 +-
ZR.Repository/ZR.Repository.csproj | 2 +-
6 files changed, 39 insertions(+), 47 deletions(-)
diff --git a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs
index 91f1566..b428aa1 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs
@@ -3,7 +3,6 @@ using Infrastructure.Enums;
using Infrastructure.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Npoi.Mapper;
using System.Collections.Generic;
using System.IO;
using ZR.Admin.WebApi.Filters;
@@ -167,42 +166,42 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ToJson(result));
}
- ///
- /// 导入 ok
- ///
- /// 使用IFromFile必须使用name属性否则获取不到文件
- ///
- [HttpPost("importData")]
- [Log(Title = "用户导入", BusinessType = BusinessType.IMPORT)]
- [ActionPermissionFilter(Permission = "system:user:import")]
- public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile)
- {
- var mapper = new Mapper(formFile.OpenReadStream());// 从流获取
- //读取的sheet信息
- var rows = mapper.Take(0);
- foreach (var item in rows)
- {
- SysUser u = item.Value;
- }
- //TODO 业务逻辑
- return SUCCESS(1);
- }
+ /////
+ ///// 导入 ok
+ /////
+ ///// 使用IFromFile必须使用name属性否则获取不到文件
+ /////
+ //[HttpPost("importData")]
+ //[Log(Title = "用户导入", BusinessType = BusinessType.IMPORT)]
+ //[ActionPermissionFilter(Permission = "system:user:import")]
+ //public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile)
+ //{
+ // var mapper = new Mapper(formFile.OpenReadStream());// 从流获取
+ // //读取的sheet信息
+ // var rows = mapper.Take(0);
+ // foreach (var item in rows)
+ // {
+ // SysUser u = item.Value;
+ // }
+ // //TODO 业务逻辑
+ // return SUCCESS(1);
+ //}
- ///
- /// 用户模板 ok
- ///
- ///
- [HttpGet("importTemplate")]
- [Log(Title = "用户模板", BusinessType = BusinessType.EXPORT)]
- [ActionPermissionFilter(Permission = "system:user:export")]
- public IActionResult ImportTemplateExcel()
- {
- List user = new List();
- var mapper = new Mapper();
- MemoryStream stream = new MemoryStream();
- mapper.Save(stream, user, "sheel1", overwrite: true, xlsx: true);
- //Response.Headers.Append("content-disposition", "attachment;filename=sysUser.xlsx");
- return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "sysUser.xlsx");
- }
+ /////
+ ///// 用户模板 ok
+ /////
+ /////
+ //[HttpGet("importTemplate")]
+ //[Log(Title = "用户模板", BusinessType = BusinessType.EXPORT)]
+ //[ActionPermissionFilter(Permission = "system:user:export")]
+ //public IActionResult ImportTemplateExcel()
+ //{
+ // List user = new List();
+ // var mapper = new Mapper();
+ // MemoryStream stream = new MemoryStream();
+ // mapper.Save(stream, user, "sheel1", overwrite: true, xlsx: true);
+ // //Response.Headers.Append("content-disposition", "attachment;filename=sysUser.xlsx");
+ // return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "sysUser.xlsx");
+ //}
}
}
diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
index a54fe25..99e3b60 100644
--- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj
+++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/ZR.Common/ZR.Common.csproj b/ZR.Common/ZR.Common.csproj
index 1e5d7f1..988d309 100644
--- a/ZR.Common/ZR.Common.csproj
+++ b/ZR.Common/ZR.Common.csproj
@@ -7,6 +7,5 @@
-
diff --git a/ZR.Model/System/SysUser.cs b/ZR.Model/System/SysUser.cs
index af36710..f4390bf 100644
--- a/ZR.Model/System/SysUser.cs
+++ b/ZR.Model/System/SysUser.cs
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
-using Npoi.Mapper.Attributes;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -18,13 +17,9 @@ namespace ZR.Model.System
///
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public long UserId { get; set; }
- [Column("用户名")]//对应Excel列名
- //[Required]//校验必填
//[Duplication]//校验模板类该列数据是否重复
public string UserName { get; set; }
- [Column("用户昵称")]
- //[Required]
public string NickName { get; set; }
///
diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj
index 70c07c2..9d0f89b 100644
--- a/ZR.Model/ZR.Model.csproj
+++ b/ZR.Model/ZR.Model.csproj
@@ -11,8 +11,7 @@
-
-
+
diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj
index e91f923..952da5b 100644
--- a/ZR.Repository/ZR.Repository.csproj
+++ b/ZR.Repository/ZR.Repository.csproj
@@ -14,7 +14,7 @@
-
+