fix(aihr): preserve empty scenario filters
This commit is contained in:
+1
-1
@@ -265,7 +265,7 @@ public class AihrPracticeSeedService {
|
||||
AND (? = '' OR scenario_type = ?)
|
||||
ORDER BY sort_order ASC, id ASC
|
||||
""", this::mapScenarioResponse, tenantId(), safePosition, safePosition, safeType, safeType);
|
||||
return rows.isEmpty() ? fallbackScenarios() : rows;
|
||||
return rows;
|
||||
} catch (DataAccessException e) {
|
||||
return fallbackScenarios();
|
||||
}
|
||||
|
||||
+13
@@ -5,6 +5,7 @@ import org.dromara.aihr.domain.AihrPracticeDto.CompetencyResponse;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.FinishRequest;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.PracticeAssignmentRequest;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.ReviewAdviceRequest;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.ScenarioResponse;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.StartRequest;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.TurnRequest;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
@@ -109,6 +110,18 @@ public class AihrPracticeSeedServiceTest {
|
||||
assertEquals("缺少员工ID,无法派发专项训练", error.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scenarioFilterKeepsRealEmptyDatabaseResultEmpty() {
|
||||
JdbcTemplate jdbcTemplate = mock(JdbcTemplate.class);
|
||||
when(jdbcTemplate.query(any(String.class), any(RowMapper.class), eq("000000"), eq("未配置岗位"), eq("未配置岗位"), eq(""), eq("")))
|
||||
.thenReturn(List.of());
|
||||
AihrPracticeSeedService service = new AihrPracticeSeedService(new ObjectMapper(), jdbcTemplate, null, null);
|
||||
|
||||
List<ScenarioResponse> result = service.scenarios("未配置岗位", null);
|
||||
|
||||
assertTrue(result.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void supervisorAssignmentSourceIsServerOwned() throws Exception {
|
||||
String source = Files.readString(Path.of("src/main/java/org/dromara/aihr/service/AihrPracticeSeedService.java"));
|
||||
|
||||
Reference in New Issue
Block a user