fix(identity): search org snapshots by phone

This commit is contained in:
2026-07-14 16:37:15 +08:00
parent 52b8a812d7
commit c02cdb7b69
4 changed files with 19 additions and 1 deletions
@@ -469,12 +469,14 @@ public class AihrOrgSyncService {
args.add(like);
} else {
where.append("""
and (ext_party_id like ? or position_name like ? or project_code like ? or project_name like ?)
and (ext_party_id like ? or person_phone like ? or position_name like ?
or project_code like ? or project_name like ?)
""");
args.add(like);
args.add(like);
args.add(like);
args.add(like);
args.add(like);
}
}
String project = clean(projectCode);
@@ -95,6 +95,19 @@ public class AihrOrgSyncServiceTest {
assertEquals(true, ReflectionTestUtils.getField(masked, "suspectText"));
}
@Test
public void hiddenDisplayFieldsStillAllowIdentitySearchByPhone() {
AihrOrgSyncService service = new AihrOrgSyncService(new ObjectMapper(), mock(JdbcTemplate.class), mock(TransactionTemplate.class));
ReflectionTestUtils.setField(service, "storeDisplayFields", false);
List<Object> args = new ArrayList<>();
String where = ReflectionTestUtils.invokeMethod(service, "orgSnapshotWhere",
"13900001111", null, null, "active", args);
assertTrue(where.contains("person_phone like ?"));
assertFalse(where.contains("person_name like ?"));
}
@Test
public void snapshotSuspectTextQuerySearchesLiteralQuestionMarks() {
SnapshotJdbcTemplate jdbcTemplate = new SnapshotJdbcTemplate();