From 876d2ff6aceb44e037ab4ffdcc6aeed3d4cdc2a5 Mon Sep 17 00:00:00 2001 From: fly6516 Date: Wed, 26 Mar 2025 11:28:23 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat(EmployeeDAO):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=91=98=E5=B7=A5=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c0f3efb8ddb1397016d9dd7bbe5a996362cd28d1. --- src/main/java/EmployeeDAO.java | 36 ++-------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/src/main/java/EmployeeDAO.java b/src/main/java/EmployeeDAO.java index c0ce76c..07af7dd 100644 --- a/src/main/java/EmployeeDAO.java +++ b/src/main/java/EmployeeDAO.java @@ -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);