修改日志模块

master
leo 3 years ago
parent 0d42f66266
commit 84a26cd395

@ -4,6 +4,7 @@ using FactorySystemBll;
using FactorySystemCommon;
using FactorySystemModel.BusinessModel;
using FactorySystemModel.ResponseModel;
using Newtonsoft.Json.Linq;
namespace FactorySystemApi.Controllers
{
@ -22,12 +23,29 @@ namespace FactorySystemApi.Controllers
public ApiResult GetPageList(Dictionary<string, object> inParam)
{
var apiResult = new ApiResult();
int pageNumber = int.Parse(inParam["current"].ToString());
int pageSize = int.Parse(inParam["limit"].ToString());
string FName = inParam.ContainsKey("FName") ? inParam["FName"].ToString() : "";
int FType = int.Parse(inParam.ContainsKey("FType") && !string.IsNullOrEmpty(inParam["FType"].ToString()) ? inParam["FType"].ToString() : "0");
int FModule = int.Parse(inParam.ContainsKey("FModule") && !string.IsNullOrEmpty(inParam["FModule"].ToString()) ? inParam["FModule"].ToString() : "0");
string FDateRangeStr = inParam.ContainsKey("FDateRange") ? inParam["FDateRange"].ToString() : "";
string dateFrom = null;
string dateTo = null;
if (!string.IsNullOrEmpty(FDateRangeStr))
{
var dataRange = JArray.Parse(FDateRangeStr);
dateFrom = dataRange[0].ToString();
dateTo = dataRange[1].ToString();
}
return ExceptionHelper.TryReturnException(() =>
{
apiResult.Data = new
{
List = _operateLogBll.GetPageList(inParam, out int totalCount),
Total = totalCount
//List = _operateLogBll.GetPageList(inParam, out int totalCount),
List = _operateLogBll.GetLogsByPage(FName, FType, FModule, dateFrom, dateTo, pageNumber, pageSize, out var totalNumber),
Total = totalNumber
};
}, apiResult, Request);
}

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using FactorySystemCommon;
using FactorySystemModel.ResponseModel;
using FactorySystemModel.SqlSugarModel;
using SqlSugar;
@ -44,6 +46,22 @@ namespace FactorySystemBll
return temp.ToPageList(pageIndex, pageSize, ref totalCount);
}
public List<LogRow> GetLogsByPage(string FName, int FType, int FModule, string dateFrom, string dateTo, int pageNumber, int pageSize, out int totalNumber)
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
totalNumber = 0;
List<LogRow> logs = db.Queryable<TFS_OperateLog, TUser>((a, b)=> new JoinQueryInfos(JoinType.Left, a.FAddUser == b.FID))
.WhereIF(!string.IsNullOrEmpty(FName), (a, b) => b.FName.Contains(FName))
.WhereIF(FType > 0, (a, b) => a.FType == FType)
.WhereIF(FModule > 0, (a, b) => a.FModule == FModule)
.WhereIF(!string.IsNullOrEmpty(dateFrom), (a, b) => a.FAddDate >= DateTime.Parse(dateFrom))
.WhereIF(!string.IsNullOrEmpty(dateTo), (a, b) => a.FAddDate <= DateTime.Parse(dateTo))
.Select<LogRow>("a.*,b.FName").OrderBy((a) => a.FID, OrderByType.Desc)
.ToPageList(pageNumber, pageSize, ref totalNumber);
return logs;
}
/// <summary>
/// 保存日志
/// </summary>
@ -64,6 +82,5 @@ namespace FactorySystemBll
}).ExecuteCommand();
}
}
}

@ -63,6 +63,7 @@
<Compile Include="RequestModel\UploadTempFileRequest.cs" />
<Compile Include="ResponseModel\ApiResult.cs" />
<Compile Include="ResponseModel\FormulaRow.cs" />
<Compile Include="ResponseModel\LogRow.cs" />
<Compile Include="ResponseModel\MaterialTaskRow.cs" />
<Compile Include="ResponseModel\MaterialTeamworkRow.cs" />
<Compile Include="ResponseModel\TaskRow.cs" />

@ -0,0 +1,14 @@
using FactorySystemModel.SqlSugarModel;
namespace FactorySystemModel.ResponseModel
{
public class LogRow: TFS_OperateLog
{
/// <summary>
/// Desc:操作人
/// Default:
/// Nullable:False
/// </summary>
public string FName { get; set; }
}
}

@ -56,5 +56,12 @@ namespace FactorySystemModel.SqlSugarModel
/// </summary>
public int FAddUser { get; set; }
/// <summary>
/// Desc:模块
/// Default:-1
/// Nullable:False
/// </summary>
public int FModule { get; set; }
}
}

Loading…
Cancel
Save