namespace NewPdaSqlServer.util { using NewPdaSqlServer.entity; using SqlSugar; using System; public class LogService { /// /// 创建日志记录 /// /// SqlSugar 数据库上下文 /// 用户编号 /// 关联单据id /// 表名称 /// 日志内容 /// 单据号 public void CreateLog(SqlSugarScope db, string edtUserNo, string abtGuid, string abtTable, string detail, string orderNo) { var edtUserGuid = db.Queryable() .Where(it => it.Account == edtUserNo) .Select(it => it.Guid) // .First(); //detail = "[PDA]" + detail; // 执行存储过程 db.Ado.ExecuteCommand( "exec prc_log_create @edtUserGuid, @abtGuid, @abtTable, @detail, @orderNo", new { edtUserGuid, abtGuid, abtTable, detail, orderNo } ); } public void CreateLogI( SqlSugarScope db, Guid edtUserGuid, string abtGuid, string abtTable, string detail, string orderNo, string sendJson, string rtnJson, string xkyBeginTime, string xkyEndTime, int sendStatus, string executeTime) { db.Ado.ExecuteCommand( "exec prc_log_create @edtUserGuid, @abtGuid, @abtTable, @detail, @hNo,@RtnLogGuid, @SendJson, @RtnJson, @xkyBeginTime, @xkyEndTime, @sendStatus, @executeTime", new { edtUserGuid, abtGuid = string.IsNullOrEmpty(abtGuid) ? DBNull.Value : (object)abtGuid, abtTable = (object)abtTable ?? DBNull.Value, detail, hNo = orderNo, RtnLogGuid = DBNull.Value, SendJson = sendJson, RtnJson = rtnJson, xkyBeginTime = (object)xkyBeginTime ?? DBNull.Value, xkyEndTime = (object)xkyEndTime ?? DBNull.Value, sendStatus = (object)sendStatus ?? DBNull.Value, executeTime = (object)executeTime ?? DBNull.Value }); } } }