소스 검색

操作记录新增
page

leiy 1 년 전
부모
커밋
cb208f06f9

+ 40 - 0
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -16,6 +16,7 @@ using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Business;
+using OASystem.Domain.ViewModels.CRM;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Business;
@@ -709,6 +710,45 @@ Where c.ConfListId = {0}", ConfId);
             }
         }
 
+
+
+        /// <summary>
+        /// 表操作记录
+        /// 分页
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostTableOperationRecordPageList(TableOperationRecordPageDto _dto)
+        {
+            try
+            {
+                string whereSql = "";
+
+                if (!string.IsNullOrEmpty(_dto.TableName))
+                {
+                    whereSql = string.Format(" And tor.TableName = '{0}'", _dto.TableName);
+                }
+
+                string sql = string.Format(@"Select row_number() over(order by tor.CreateTime Desc) As Row_Number,
+                                             tor.TableName,tor.PortType,tor.OperationItem,tor.DataId,u.CnName As OperationUserName,
+                                             tor.CreateTime,tor.Remark
+                                             From Crm_TableOperationRecord tor
+                                             Left Join Sys_Users u On tor.CreateUserId = u.Id
+                                             Where tor.Isdel = 0 {0}", whereSql);
+
+                RefAsync<int> total = 0;//REF和OUT不支持异步,想要真的异步这是最优解
+                var _view = await _TableOperationRecordRep._sqlSugar.SqlQueryable<TableOperationRecordPageView>(sql).ToPageListAsync(_dto.PageIndex, _dto.PageSize, total);//ToPageAsync
+
+                return Ok(JsonView(true, "查询成功!", _view, total));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!Msg:" + ex.Message));
+            }
+        }
+       
+
         #endregion
 
 

+ 0 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -344,8 +344,6 @@ namespace OASystem.API.Controllers
                     Data = _DelegationList
                 };
                 return Ok(JsonView(true, "查询成功!", _view, total));
-
-
             }
             else
             {

+ 14 - 1
OASystem/OASystem.Domain/Dtos/CRM/TableOperationRecordDto.cs

@@ -1,4 +1,5 @@
-using OASystem.Domain.Enums;
+using OASystem.Domain.Dtos.System;
+using OASystem.Domain.Enums;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -45,4 +46,16 @@ namespace OASystem.Domain.Dtos.CRM
         /// </summary>
         public int DataId { get; set; } = 0;
     }
+
+    public class TableOperationRecordPageDto
+    {
+
+        public int PageIndex { get; set; } = 1;
+        public int PageSize { get; set; } = 10;
+        /// <summary>
+        /// 表名
+        /// 资料操作表记录 'Crm_NewClientData'
+        /// </summary>
+        public string TableName { get; set; }
+    }
 }

+ 91 - 0
OASystem/OASystem.Domain/ViewModels/CRM/TableOperationRecordView.cs

@@ -1,4 +1,5 @@
 using OASystem.Domain.Entities.Customer;
+using OASystem.Domain.Enums;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -13,4 +14,94 @@ namespace OASystem.Domain.ViewModels.CRM
     public class TableOperationRecordView : Crm_TableOperationRecord
     {
     }
+
+    /// <summary>
+    /// 操作记录page
+    /// </summary>
+    public class TableOperationRecordPageView
+    {
+        public int Row_Number { get; set; }
+        /// <summary>
+        /// 表名
+        /// Crm_NewClientData
+        /// </summary>
+        public string TableName { get; set; }
+
+        /// <summary>
+        /// 表名
+        /// Crm_NewClientData
+        /// </summary>
+        public string TableNameStr
+        {
+            get
+            {
+                string str = "";
+                if (TableName.Equals("Crm_NewClientData")) str = "客户资料(新)";
+
+                return str;
+            }
+        }
+
+        /// <summary>
+        /// 操作端口
+        /// </summary>
+        public int PortType { get; set; }
+
+        public string PortTypeStr
+        {
+            get
+            {
+                string str = "";
+                if (PortType == 1) str = "Web";
+                else if (PortType == 2) str = "Android";
+                else if (PortType == 3) str = "Ios";
+
+                return str;
+            }
+        }
+
+        /// <summary>
+        /// 操作项目
+        /// </summary>
+        public OperationEnum OperationItem { get; set; }
+
+        public string OperationItemStr
+        {
+            get
+            {
+                string str = "";
+                if (OperationItem == OperationEnum.NoOperation) str = "未操作";
+                else if (OperationItem == OperationEnum.List) str = "浏览列表";
+                else if (OperationItem == OperationEnum.Details) str = "浏览详情";
+                else if (OperationItem == OperationEnum.Add) str = "添加";
+                else if (OperationItem == OperationEnum.Edit) str = "编辑";
+                else if (OperationItem == OperationEnum.Del) str = "删除";
+                else if (OperationItem == OperationEnum.Audit) str = "审核";
+                else if (OperationItem == OperationEnum.Upload) str = "文件上传";
+                else if (OperationItem == OperationEnum.Download) str = "文件下载";
+                else if (OperationItem == OperationEnum.BatchAssignment) str = "批量指派";
+                return str;
+            }
+        }
+
+        /// <summary>
+        /// 数据Id
+        /// </summary>
+        public int DataId { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        public string? OperationUserName { get; set; }
+
+        /// <summary>
+        /// 操作时间
+        /// </summary>
+        public DateTime CreateTime { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+    }
 }