/// <summary> /// 依id查询 /// </summary> /// <param name="id">id</param> /// <returns></returns> public TLogsXmlLog GetById(long id) { TLogsXmlLog xmlLog = null; using (var conn = DapperHelper.CreateConnection()) { xmlLog = conn.Query <TLogsXmlLog>(@"SELECT xmlLogs.system_code AS SystemCode , xmlLogs.machine_name AS MachineName , xmlLogs.ip_address AS IpAddress , xmlLogs.client_ip AS ClientIp, xmlLogs.process_id AS ProcessId , xmlLogs.process_name AS ProcessName , xmlLogs.thread_id AS ThreadId , xmlLogs.thread_name AS ThreadName , xmlLogs.appdomain_name AS AppdomainName , xmlLogs.class_name AS ClassName , xmlLogs.method_name AS MethodName , xmlLogs.method_cname AS MethodCname, xmlLogs.created_time AS CreatedTime , * FROM dbo.t_logs_xml_log AS xmlLogs WHERE xmlLogs.id = @Id;", new { @Id = id }).FirstOrDefault(); } return(xmlLog); }
/// <summary> /// 详情页 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Detail(long id) { TLogsXmlLog xmlLog = null; var rs = _xmlLogService.GetXmlLogById(id); if (rs.ReturnCode == ReturnCodeType.Success) { xmlLog = rs.Content; } return(View(xmlLog)); }
/// <summary> /// 插入 /// </summary> /// <param name="item">待插入的记录</param> public bool Insert(TLogsXmlLog item) { using (var conn = DapperHelper.CreateConnection()) { var effectRows = conn.Execute(@"INSERT INTO dbo.t_logs_xml_log VALUES (@SystemCode ,@Source ,@MachineName ,@IpAddress ,@ProcessId ,@ProcessName ,@ThreadId ,@ThreadName ,@AppdomainName ,@ClassName ,@MethodName ,@Remark ,@CreatedTime,@Rq ,@Rs, @ClientIp, @MethodCname, @Duration);", item); if (effectRows > 0) { return(true); } } return(false); }