yuanrf 1 giorno fa
parent
commit
22e22e9dac

+ 16 - 3
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -3612,6 +3612,7 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
             {
                 data = await _sqlSugar.Queryable<Pm_PerformanceAnalysis>()
                 .Where(x => x.UserId == userId && x.Year == year && x.Month == month && x.IsDel == 0)
+                .OrderByDescending(x => x.CreateTime)
                 .FirstAsync();
             }
 
@@ -3698,9 +3699,21 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
                 return Ok(jw);
             }
 
-            var data = await _sqlSugar.Queryable<Pm_PerformanceAnalysis>()
-            .Where(x => x.UserId == userId && x.Year == year && x.Month == month && x.IsDel == 0)
-            .FirstAsync();
+            var data = new Pm_PerformanceAnalysis();
+            if (year < 1 && month < 1)
+            {
+                data = await _sqlSugar.Queryable<Pm_PerformanceAnalysis>()
+                .Where(x => x.UserId == userId && x.IsDel == 0)
+                .OrderByDescending(x => x.CreateTime)
+                .FirstAsync();
+            }
+            else
+            {
+                data = await _sqlSugar.Queryable<Pm_PerformanceAnalysis>()
+                .Where(x => x.UserId == userId && x.Year == year && x.Month == month && x.IsDel == 0)
+                .OrderByDescending(x => x.CreateTime)
+                .FirstAsync();
+            }
 
             if (data == null)
             {