部分功能导出Excel新增忽略列

This commit is contained in:
不做码农
2021-12-04 13:15:57 +08:00
parent 13c08eac52
commit c46d5015d2
12 changed files with 55 additions and 67 deletions

View File

@@ -4,27 +4,33 @@ using System;
using System.Collections.Generic;
using System.Text;
using SqlSugar;
using OfficeOpenXml.Attributes;
namespace ZR.Model.System
{
[EpplusTable(PrintHeaders = true, AutofitColumns = true, AutoCalculate = true, ShowTotal = true)]
public class SysBase
{
[SugarColumn(IsOnlyIgnoreUpdate = true)]//设置后修改不会有此字段
[JsonProperty(propertyName: "CreateBy")]
[EpplusIgnore]
public string Create_by { get; set; }
[SugarColumn(IsOnlyIgnoreUpdate = true)]//设置后修改不会有此字段
[JsonProperty(propertyName: "CreateTime")]
[EpplusTableColumn(NumberFormat = "yyyy-MM-dd HH:mm:ss")]
public DateTime Create_time { get; set; } = DateTime.Now;
[JsonIgnore]
[JsonProperty(propertyName: "UpdateBy")]
[SugarColumn(IsOnlyIgnoreInsert = true)]
[EpplusIgnore]
public string Update_by { get; set; }
//[JsonIgnore]
[SugarColumn(IsOnlyIgnoreInsert = true)]//设置后插入数据不会有此字段
[JsonProperty(propertyName: "UpdateTime")]
[EpplusIgnore]
public DateTime? Update_time { get; set; }
public string Remark { get; set; }
@@ -40,6 +46,7 @@ namespace ZR.Model.System
/// </summary>
[SugarColumn(IsIgnore = true)]
[JsonIgnore]
[EpplusIgnore]
public DateTime? BeginTime { get; set; }
/// <summary>
@@ -47,6 +54,7 @@ namespace ZR.Model.System
/// </summary>
[SugarColumn(IsIgnore = true)]
[JsonIgnore]
[EpplusIgnore]
public DateTime? EndTime { get; set; }
}
}

View File

@@ -1,8 +1,5 @@
//using Dapper.Contrib.Extensions;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
namespace ZR.Model.System
{
@@ -30,6 +27,7 @@ namespace ZR.Model.System
/// <summary>
/// 状态 0、正常 1、停用
/// </summary>
[EpplusIgnore]
public string Status { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
//using Dapper.Contrib.Extensions;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
@@ -52,6 +53,7 @@ namespace ZR.Model.System
/// <summary>
/// 访问时间
/// </summary>
[EpplusTableColumn(NumberFormat = "yyyy-MM-dd HH:mm:ss")]
public DateTime loginTime { get; set; } = DateTime.Now;
}
}

View File

@@ -3,6 +3,7 @@ using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
using OfficeOpenXml.Attributes;
namespace ZR.Model.System
{
@@ -26,11 +27,11 @@ namespace ZR.Model.System
/** 请求方法 */
//@Excel(name = "请求方法")
public String method { get; set; }
public string method { get; set; }
/** 请求方式 */
//@Excel(name = "请求方式")
public String requestMethod { get; set; }
public string requestMethod { get; set; }
/** 操作类别0其它 1后台用户 2手机端用户 */
//@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
@@ -38,31 +39,31 @@ namespace ZR.Model.System
/** 操作人员 */
//@Excel(name = "操作人员")
public String operName { get; set; }
public string operName { get; set; }
/** 部门名称 */
//@Excel(name = "部门名称")
public String deptName { get; set; }
public string deptName { get; set; }
/** 请求url */
//@Excel(name = "请求地址")
public String operUrl { get; set; }
public string operUrl { get; set; }
/** 操作地址 */
//@Excel(name = "操作地址")
public String operIp { get; set; }
public string operIp { get; set; }
/** 操作地点 */
//@Excel(name = "操作地点")
public String operLocation { get; set; }
public string operLocation { get; set; }
/** 请求参数 */
//@Excel(name = "请求参数")
public String operParam { get; set; }
public string operParam { get; set; }
/** 返回参数 */
//@Excel(name = "返回参数")
public String jsonResult { get; set; }
public string jsonResult { get; set; }
/** 操作状态0正常 1异常 */
//@Excel(name = "状态", readConverterExp = "0=正常,1=异常")
@@ -70,13 +71,14 @@ namespace ZR.Model.System
/** 错误消息 */
//@Excel(name = "错误消息")
public String errorMsg { get; set; }
public string errorMsg { get; set; }
/** 操作时间 */
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
//[DataType]
[JsonConverter(typeof(JsonDateConverter))]
[EpplusTableColumn(NumberFormat = "yyyy-MM-dd HH:mm:ss")]
public DateTime? operTime { get; set; }
/// <summary>
/// 操作用时

View File

@@ -1,19 +1,22 @@
using SqlSugar;
using OfficeOpenXml.Attributes;
using SqlSugar;
namespace ZR.Model.System
{
[SugarTable("sys_post")]
[Tenant("0")]
public class SysPost: SysBase
public class SysPost : SysBase
{
/// <summary>
/// 岗位Id
/// </summary>
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public long PostId { get; set; }
public string PostCode { get; set; }
public string PostName { get; set; }
[EpplusIgnore]
public int PostSort { get; set; }
[EpplusIgnore]
public string Status { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using SqlSugar;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
@@ -15,7 +16,7 @@ namespace ZR.Model.System
/// <summary>
/// 日志Id
/// </summary>
[SqlSugar.SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public long JobLogId { get; set; }
/// <summary>
/// 任务Id
@@ -39,6 +40,8 @@ namespace ZR.Model.System
/// 调用目标字符串
/// </summary>
public string InvokeTarget { get; set; }
[EpplusTableColumn(NumberFormat = "yyyy-MM-dd HH:mm:ss")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 执行用时,毫秒

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -29,12 +30,13 @@ namespace ZR.Model.System
//[JsonProperty(propertyName: "userType")]
//public string User_type { get; set; } = "";
[SugarColumn(IsOnlyIgnoreInsert = true)]
[EpplusIgnore]
public string Avatar { get; set; }
public string Email { get; set; }
[JsonIgnore]
//[ColName("用户密码")]
[EpplusIgnore]
public string Password { get; set; }
//[ColName("手机号")]
@@ -48,6 +50,7 @@ namespace ZR.Model.System
/// <summary>
/// 帐号状态0正常 1停用
/// </summary>
[EpplusIgnore]
public string Status { get; set; }
/// <summary>
@@ -66,6 +69,7 @@ namespace ZR.Model.System
/// 最后登录时间
/// </summary>
[SugarColumn(IsOnlyIgnoreInsert = true)]
[EpplusTableColumn(NumberFormat = "yyyy-MM-dd HH:mm:ss")]
public DateTime LoginDate { get; set; }
/// <summary>
@@ -94,14 +98,17 @@ namespace ZR.Model.System
/// 角色id集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[EpplusIgnore]
public int[] RoleIds { get; set; }
/// <summary>
/// 岗位集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[EpplusIgnore]
public int[] PostIds { get; set; }
[SugarColumn(IsIgnore = true)]
[EpplusIgnore]
public List<SysRole> Roles { get; set; }
#endregion