/// <summary> /// 依据id获取 /// </summary> /// <param name="id"></param> /// <returns></returns> public TLogsPerformanceLog GetById(long id) { TLogsPerformanceLog perfLog = null; using (var conn = DapperHelper.CreateConnection()) { perfLog = conn.Query <TLogsPerformanceLog>(@"SELECT perfLogs.system_code AS SystemCode , perfLogs.machine_name AS MachineName , perfLogs.ip_address AS IpAddress , perfLogs.client_ip AS ClientIp , perfLogs.process_id AS ProcessId , perfLogs.process_name AS ProcessName , perfLogs.thread_id AS ThreadId , perfLogs.thread_name AS ThreadName , perfLogs.class_name AS ClassName , perfLogs.method_name AS MethodName , perfLogs.method_cname AS MethodCname , perfLogs.created_time AS CreatedTime , * FROM dbo.t_logs_performance_log (NOLOCK) AS perfLogs WHERE perfLogs.id = @Id;", new { @Id = id }).FirstOrDefault(); } return(perfLog); }
/// <summary> /// 详情页 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Detail(long id) { TLogsPerformanceLog model = null; var rs = _perfLogService.GetPerfLogById(id); if (rs.ReturnCode == ReturnCodeType.Success) { model = rs.Content; } return(View(model)); }
/// <summary> /// 插入 /// </summary> /// <param name="item">待插入的记录</param> public bool Insert(TLogsPerformanceLog item) { using (var conn = DapperHelper.CreateConnection()) { var effectRows = conn.Execute(@"INSERT INTO dbo.t_logs_performance_log ( system_code , source , machine_name , ip_address , process_id , process_name , thread_id , thread_name , class_name , method_name , duration , remark , created_time, client_ip, method_cname ) VALUES ( @SystemCode , @Source , @MachineName , @IpAddress , @ProcessId , @ProcessName , @ThreadId , @ThreadName , @ClassName , @MethodName , @Duration , @Remark , @CreatedTime, @ClientIp, @MethodCname );", item); if (effectRows > 0) { return(true); } } return(false); }