lihao 4 years ago
parent
commit
8f9159c650

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicRepository.cs

@@ -422,7 +422,7 @@ namespace GxPress.Repository.Implement
                                         tede_comment
                                     WHERE
                                         ArticleId = a.Id AND pid = 0
-                                            AND TypeValue = 1) AS CommentCount,
+                                            AND TypeValue =={topicConst}) AS CommentCount,
                                 (SELECT 
                                         COUNT(1)
                                     FROM

+ 15 - 12
gx_api/GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -1080,19 +1080,22 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         public async Task<int> GetUserUReadFlowTodoCountAsync(int userId)
         {
+            var folderTypeConst = AllTypeConst.Inbox.GetHashCode();
+            var myCheckedConst = AllTypeConst.MyChecked.GetHashCode();
             string sql = $@"SELECT 
-                            count(1)
-                        FROM
-                            tede_flow_todo
-                        WHERE
-                            FlowId IN (SELECT 
-                                    SonId
-                                FROM
-                                    tede_notice
-                                WHERE
-                                    userId ={userId} AND TypeValue = 15
-                                        AND IsDelete = 0)
-                                AND Type = 'ApproverCheck' and IsRead=0";
+                                count(1)
+                            FROM
+                                tede_flow_todo a
+                                    INNER JOIN
+                                tede_notice b ON a.FlowId = b.SourceId
+                                    INNER JOIN
+                                tede_middle c ON c.MiddleId = b.Id
+                            WHERE
+                                1 = 1 AND b.TypeValue ={myCheckedConst} and c.FolderType={folderTypeConst}
+                                    AND a.Type = 'ApproverCheck'
+                                    and c.UserId={userId}
+                                    AND a.IsDone = 0
+                                    AND c.IsDelete = 0;";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();