97 lines
2.6 KiB
C#
97 lines
2.6 KiB
C#
|
|
using Dapper;
|
|||
|
|
using Models.Models;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
//using System.Windows.Documents;
|
|||
|
|
|
|||
|
|
namespace DataDAL.DBContext
|
|||
|
|
{
|
|||
|
|
public class LogDal
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public LogDal()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存日志
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="entity"></param>
|
|||
|
|
/// <param name="sysDict"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public int SaveLog(run_log_info runLogInfo)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//using (IDbConnection dbConnection = new DapperDBContext().Connection)
|
|||
|
|
//{
|
|||
|
|
// dbConnection.Open();
|
|||
|
|
|
|||
|
|
// string insertSql = @"insert into run_log_info ( id,run_date
|
|||
|
|
// ,log_level
|
|||
|
|
// ,log_content,log_type
|
|||
|
|
// )
|
|||
|
|
// values(@id,@run_date
|
|||
|
|
// ,@log_level
|
|||
|
|
// ,@log_content ,@log_type
|
|||
|
|
// )";
|
|||
|
|
|
|||
|
|
|
|||
|
|
// var item = dbConnection.QueryFirstOrDefault<run_log_info>(insertSql, runLogInfo);
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询日志信息
|
|||
|
|
/// </summary>
|
|||
|
|
public List<run_log_info> QueryLogByDate(DateTime dt1,DateTime dt2)
|
|||
|
|
{
|
|||
|
|
using (IDbConnection dbConnection = new DapperDBContext().Connection)
|
|||
|
|
{
|
|||
|
|
dbConnection.Open();
|
|||
|
|
|
|||
|
|
string querySql = "select * from run_log_info where run_date >= @dt1 and run_date <= @dt2";
|
|||
|
|
|
|||
|
|
List<run_log_info> data = dbConnection.Query<run_log_info>(querySql, new { dt1 = dt1,dt2 = dt2 }).ToList();
|
|||
|
|
|
|||
|
|
return data;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
///// <summary>
|
|||
|
|
///// 查询二维码开始编号
|
|||
|
|
///// </summary>
|
|||
|
|
//public string QueryQrcode()
|
|||
|
|
//{
|
|||
|
|
// using (IDbConnection dbConnection = new BaseDBContext().Connection)
|
|||
|
|
// {
|
|||
|
|
// dbConnection.Open();
|
|||
|
|
|
|||
|
|
// string qrcode = "";
|
|||
|
|
|
|||
|
|
// List<sys_dict> data = dbConnection.Query<sys_dict>("select * from sys_dict where data_type='二维码编号'").ToList();
|
|||
|
|
// if (data.Count > 0)
|
|||
|
|
// {
|
|||
|
|
// qrcode = (int.Parse(data[0].data_value) + 1).ToString("0000");
|
|||
|
|
// }
|
|||
|
|
// return qrcode;
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|