添加项目文件。
This commit is contained in:
96
SamplePre.DAL/DAL/LogDal.cs
Normal file
96
SamplePre.DAL/DAL/LogDal.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
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;
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
72
SamplePre.DAL/DAL/SOPDal.cs
Normal file
72
SamplePre.DAL/DAL/SOPDal.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Dapper;
|
||||
using DataDAL.DBContext;
|
||||
using Models.Models;
|
||||
using SamplePre.Common;
|
||||
using SamplePre.DAL.DBContext;
|
||||
using SamplePre.Models.Ext;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Dapper.SqlMapper;
|
||||
|
||||
namespace SamplePre.DAL
|
||||
{
|
||||
public class SOPDal
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取标准下的动作,动作中包含参数
|
||||
/// </summary>
|
||||
/// <param name="standId"></param>
|
||||
/// <returns></returns>
|
||||
public List<sys_standard_action_ext> QueryStandardProcessByStandardId(string standId)
|
||||
{
|
||||
using (IDbConnection dbConnection = new DapperDBContext().Connection)
|
||||
{
|
||||
dbConnection.Open();
|
||||
|
||||
string querySql = @"
|
||||
SELECT
|
||||
a.*,
|
||||
b.action_name,
|
||||
b.action_unit,
|
||||
e.data_value AS action_unit_name,
|
||||
b.remark,
|
||||
c.all_param
|
||||
FROM
|
||||
sys_standard_action a
|
||||
LEFT JOIN sys_action b ON a.process_id = b.id
|
||||
LEFT JOIN sys_dict e ON b.action_unit = e.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
x.action_id,
|
||||
x.action_seqno,
|
||||
GROUP_CONCAT( CONCAT( y.title, ':', x.data_value, y.unit ) SEPARATOR ',' ) AS all_param
|
||||
FROM
|
||||
sys_standard_action_parm x
|
||||
LEFT JOIN sys_parm y ON x.parm_id = y.id
|
||||
WHERE
|
||||
x.standard_id = @standId
|
||||
GROUP BY
|
||||
x.action_id,
|
||||
x.action_seqno
|
||||
) c ON a.process_id = c.action_id
|
||||
AND a.process_no = c.action_seqno
|
||||
WHERE
|
||||
a.standard_id = @standId
|
||||
ORDER BY a.process_no
|
||||
";
|
||||
|
||||
List<sys_standard_action_ext> data = dbConnection.Query<sys_standard_action_ext>(querySql, new { standId = standId }).ToList();
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
24
SamplePre.DAL/DAL/SampleSequenceDal.cs
Normal file
24
SamplePre.DAL/DAL/SampleSequenceDal.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Dapper;
|
||||
using DataDAL.DBContext;
|
||||
using Models.Models;
|
||||
using SamplePre.Common;
|
||||
using SamplePre.DAL.DBContext;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.Models.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Dapper.SqlMapper;
|
||||
|
||||
namespace SamplePre.DAL
|
||||
{
|
||||
public class SampleSequenceDal
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
59
SamplePre.DAL/DAL/SystemDal.cs
Normal file
59
SamplePre.DAL/DAL/SystemDal.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Dapper;
|
||||
using DataDAL.DBContext;
|
||||
using Models.Models;
|
||||
using SamplePre.DAL.DBContext;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.Models.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePre.DAL
|
||||
{
|
||||
public class SystemDal
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取用户数据
|
||||
/// </summary>
|
||||
/// <param name="standId"></param>
|
||||
/// <returns></returns>
|
||||
public List<config_user_ext> QueryUserData()
|
||||
{
|
||||
using (IDbConnection dbConnection = new DapperDBContext().Connection)
|
||||
{
|
||||
dbConnection.Open();
|
||||
|
||||
string querySql = @"
|
||||
SELECT a.*,b.all_role_names from config_user a
|
||||
LEFT JOIN (
|
||||
|
||||
SELECT
|
||||
x.user_id,
|
||||
|
||||
GROUP_CONCAT(x.role_id SEPARATOR ',') AS all_role_ids,
|
||||
|
||||
GROUP_CONCAT(y.`name` SEPARATOR ',') AS all_role_names
|
||||
FROM
|
||||
config_user_role x
|
||||
LEFT JOIN config_role y ON x.role_id = y.id
|
||||
|
||||
GROUP BY
|
||||
x.user_id
|
||||
|
||||
) b on a.id = b.user_id
|
||||
";
|
||||
|
||||
List<config_user_ext> data = dbConnection.Query<config_user_ext>(querySql).ToList();
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user