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 @@ - +