删除Npoi.Mapper包,SqlSugarCoreNoDrive升级至5.0.43
This commit is contained in:
parent
1263023c46
commit
01cd8aaf15
@ -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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入 ok
|
||||
/// </summary>
|
||||
/// <param name="formFile">使用IFromFile必须使用name属性否则获取不到文件</param>
|
||||
/// <returns></returns>
|
||||
[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<SysUser>(0);
|
||||
foreach (var item in rows)
|
||||
{
|
||||
SysUser u = item.Value;
|
||||
}
|
||||
//TODO 业务逻辑
|
||||
return SUCCESS(1);
|
||||
}
|
||||
///// <summary>
|
||||
///// 导入 ok
|
||||
///// </summary>
|
||||
///// <param name="formFile">使用IFromFile必须使用name属性否则获取不到文件</param>
|
||||
///// <returns></returns>
|
||||
//[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<SysUser>(0);
|
||||
// foreach (var item in rows)
|
||||
// {
|
||||
// SysUser u = item.Value;
|
||||
// }
|
||||
// //TODO 业务逻辑
|
||||
// return SUCCESS(1);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 用户模板 ok
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("importTemplate")]
|
||||
[Log(Title = "用户模板", BusinessType = BusinessType.EXPORT)]
|
||||
[ActionPermissionFilter(Permission = "system:user:export")]
|
||||
public IActionResult ImportTemplateExcel()
|
||||
{
|
||||
List<SysUser> user = new List<SysUser>();
|
||||
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");
|
||||
}
|
||||
///// <summary>
|
||||
///// 用户模板 ok
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[HttpGet("importTemplate")]
|
||||
//[Log(Title = "用户模板", BusinessType = BusinessType.EXPORT)]
|
||||
//[ActionPermissionFilter(Permission = "system:user:export")]
|
||||
//public IActionResult ImportTemplateExcel()
|
||||
//{
|
||||
// List<SysUser> user = new List<SysUser>();
|
||||
// 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");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -7,6 +7,5 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.15.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
|
||||
<PackageReference Include="Npoi.Mapper" Version="3.5.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -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
|
||||
/// </summary>
|
||||
[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; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -11,8 +11,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Npoi.Mapper" Version="3.5.1" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<PackageReference Include="MySql.Data" Version="8.0.25" />
|
||||
<PackageReference Include="NETCore.Encrypt" Version="2.0.9" />
|
||||
<PackageReference Include="SqlSugar.IOC" Version="1.7.0" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user