Revert "feat(EmployeeDAO): 添加员工查询功能"

This reverts commit c0f3efb8dd.
This commit is contained in:
fly6516 2025-03-26 11:28:23 +08:00
parent c0f3efb8dd
commit 876d2ff6ac

View File

@ -37,40 +37,8 @@ public class EmployeeDAO {
table.close();
}
public static void queryByPerformance() throws IOException {
Table table = HBaseConnectionManager.getConnection().getTable(TableName.valueOf("emp1520"));
Scan scan = new Scan();
scan.addFamily(Bytes.toBytes(CF_PERFORMANCE));
ResultScanner scanner = table.getScanner(scan);
for (Result result : scanner) {
String perf = Bytes.toString(result.getValue(
Bytes.toBytes(CF_PERFORMANCE), Bytes.toBytes("performance_score")));
if (perf != null && Integer.parseInt(perf) >= 90) {
System.out.println("高绩效员工: " +
Bytes.toString(result.getValue(Bytes.toBytes(CF_EMPNUM), Bytes.toBytes("empno"))));
}
}
table.close();
}
public static void queryRecentPromotion() throws IOException {
Table table = HBaseConnectionManager.getConnection().getTable(TableName.valueOf("emp1520"));
Scan scan = new Scan();
scan.addColumn(Bytes.toBytes(CF_PERFORMANCE), Bytes.toBytes("promotion_date"));
ResultScanner scanner = table.getScanner(scan);
for (Result result : scanner) {
String dateStr = Bytes.toString(result.getValue(
Bytes.toBytes(CF_PERFORMANCE), Bytes.toBytes("promotion_date")));
if (dateStr != null && !dateStr.isEmpty()) {
LocalDate date = LocalDate.parse(dateStr);
if (date.isAfter(LocalDate.now().minusYears(1))) {
System.out.println("近一年晋升员工: " +
Bytes.toString(result.getValue(Bytes.toBytes(CF_EMPNUM), Bytes.toBytes("empno"))));
}
}
}
table.close();
}
// 其他查询方法实现与原HBaseEmpManager逻辑相同
// ... existing query methods ...
private static String generateRowKey(String empno) throws NoSuchAlgorithmException {
String prefix = empno.substring(0, 3);