李昊 4 anni fa
parent
commit
cf292cf5fd

+ 4 - 10
GxPress/Repository/GxPress.Repository.Implement/WorkFlow/FlowTodoRepository.cs

@@ -117,17 +117,11 @@ namespace GxPress.Repository.Implement.WorkFlow
         /// <param name="isDone"></param>
         /// <param name="request"></param>
         /// <returns></returns>
-        public async Task<IEnumerable<Flow>> GetMyCheckedTodoIdFlowIdListAsync(int userId, string type, bool isDone, FlowListRequest request)
+        public async Task<IEnumerable<(int FlowId, int TodoId)>> GetMyCheckedTodoIdFlowIdListAsync(int userId, string type, bool isDone, FlowListRequest request)
         {
             string sql = $@"
                            SELECT 
-                                *
-                            FROM
-                                tede_flow
-                            WHERE
-                                Id IN (
-                           SELECT 
-                                FlowId
+                                FlowId,TodoId
                             FROM
                                 tede_flow_todo a
                                     INNER JOIN
@@ -192,13 +186,13 @@ namespace GxPress.Repository.Implement.WorkFlow
                     sql += $" AND b.Id IN ({processId})";
                 }
             }
-            sql += $") ORDER BY CreatedDate DESC limit {(request.Page - 1) * request.PerPage},{request.PerPage}";
+            sql += $" ORDER BY CreatedDate DESC limit {(request.Page - 1) * request.PerPage},{request.PerPage}";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
             var result =
                await connection
-                    .QueryAsync<Flow>(sql);
+                    .QueryAsync<(int FlowId, int TodoId)>(sql);
             return result;
         }
 

+ 1 - 1
GxPress/Repository/GxPress.Repository.Interface/WorkFlow/IFlowTodoRepository.cs

@@ -88,7 +88,7 @@ namespace GxPress.Repository.Interface.WorkFlow
         /// <param name="isDone"></param>
         /// <param name="request"></param>
         /// <returns></returns>
-        Task<IEnumerable<Flow>> GetMyCheckedTodoIdFlowIdListAsync(int userId, string type, bool isDone, FlowListRequest request);
+        Task<IEnumerable<(int FlowId,int TodoId)>> GetMyCheckedTodoIdFlowIdListAsync(int userId, string type, bool isDone, FlowListRequest request);
         /// <summary>
         /// 已审批数量
         /// </summary>

+ 4 - 5
GxPress/Service/GxPress.Service.Implement/Flow/FlowService.List.cs

@@ -49,12 +49,11 @@ namespace GxPress.Service.Implement
         {
             var flowList = await _flowTodoRepository.GetMyCheckedTodoIdFlowIdListAsync(userId, nameof(TodoTypeConst.ApproverCheck), true, request);
             var items = new List<FlowListResult>();
-            foreach (var flow in flowList)
+            foreach (var item in flowList)
             {
-                if (flow != null)
-                {
-                    items.Add(await GetFlowListResultAsync(flow, flow.Id, source));
-                }
+                var flow = await _flowRepository.GetAsync(item.FlowId);
+                items.Add(await GetFlowListResultAsync(flow, item.TodoId, source));
+
             }
             return new ListResult
             {