using HxDbContext;
|
using HxModel;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace HxUserManagement.HxDAL
|
{
|
public class OperateAuditLogDAL
|
{
|
#region 获取信息
|
/// <summary>
|
/// 获取Log信息
|
/// </summary>
|
/// <param name="id">ID</param>
|
/// <returns></returns>
|
public OperateAuditLogModel GetLogdById(string id)
|
{
|
var result = new MySqlEF<OperateAuditLogModel>().GetModel(x => x.Id == id);
|
if (result != null)
|
{
|
return result;
|
}
|
return null;
|
}
|
|
/// <summary>
|
/// 获取所有Log列表
|
/// </summary>
|
/// <returns></returns>
|
public List<OperateAuditLogModel> GetAllLogsInfo()
|
{
|
var result = new MySqlEF<OperateAuditLogModel>().GetList(null);
|
|
if (result != null)
|
{
|
return result.ToList();
|
}
|
return null;
|
}
|
|
/// <summary>
|
/// 获取指定用户创建的log
|
/// </summary>
|
/// <param name="UserName"></param>
|
/// <returns></returns>
|
public List<OperateAuditLogModel> GetLogsByCreateUser(string UserName)
|
{
|
var result = new MySqlEF<OperateAuditLogModel>().GetList(x => x.CreateName == UserName);
|
if (result != null)
|
{
|
return result.ToList();
|
}
|
return null;
|
}
|
|
|
|
#endregion
|
|
#region 删除
|
/// <summary>
|
/// 删除
|
/// </summary>
|
/// <param name="id"></param>
|
/// <returns></returns>
|
public bool DelById(string id)
|
{
|
var resultDelModel = new MySqlEF<OperateAuditLogModel>().GetModel(x => x.Id == id);
|
if (resultDelModel != null)
|
{
|
var result = new MySqlEF<OperateAuditLogModel>().Delete(new OperateAuditLogModel { Id = id });
|
return result;
|
}
|
return false;
|
}
|
#endregion
|
|
#region 添加
|
/// <summary>
|
/// 添加
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
public OperateAuditLogModel Add(OperateAuditLogModel model)
|
{
|
try
|
{
|
var result = new MySqlEF<OperateAuditLogModel>().Add(model);
|
if (result != null)
|
{
|
return model;
|
}
|
}
|
catch (Exception ex)
|
{
|
}
|
return null;
|
}
|
|
public OperateAuditLogModel Add(string type, string operation)
|
{
|
try
|
{
|
OperateAuditLogModel model = new OperateAuditLogModel();
|
model.Id = Guid.NewGuid().ToString();
|
model.OperateType = type;
|
model.OperateContent = operation;
|
model.CreateName = UserManagement.currentUser.UserName;
|
model.CreateTime = DateTime.Now;
|
|
var result = new MySqlEF<OperateAuditLogModel>().Add(model);
|
if (result != null)
|
{
|
return model;
|
}
|
}
|
catch (Exception ex)
|
{
|
}
|
return null;
|
}
|
#endregion
|
|
#region 修改
|
/// <summary>
|
/// 修改
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
public OperateAuditLogModel Update(OperateAuditLogModel model)
|
{
|
var result = new MySqlEF<OperateAuditLogModel>().Update(model);
|
if (result != null)
|
{
|
return result;
|
}
|
|
return null;
|
}
|
#endregion
|
}
|
}
|