diff --git a/src/main/java/EmpHBaseClient.java b/src/main/java/EmpHBaseClient.java index 2487c71..bc4ca7d 100644 --- a/src/main/java/EmpHBaseClient.java +++ b/src/main/java/EmpHBaseClient.java @@ -238,4 +238,40 @@ public class EmpHBaseClient { return date; } } + + // 新增main方法作为入口 + public static void main(String[] args) { + EmpHBaseClient client = null; + try { + client = new EmpHBaseClient(); + System.out.println("1. 创建表结构..."); + client.createEmpTable(); + + System.out.println("2. 加载CSV数据..."); + client.loadEmployeesFromCSV("emp.txt"); + + System.out.println("\n3. 查询ID≥7500的员工:"); + client.findEmployeesWithEmpnoAbove7500(); + + System.out.println("\n4. 查询绩效>4且入职早于2022的员工:"); + client.findQualifiedEmployees(); + + System.out.println("\n5. 最近晋升记录:"); + client.findLatestPromotion(); + + System.out.println("\n6. 培训课程统计:"); + client.countTrainingCourses(); + + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (client != null) { + try { + client.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } } \ No newline at end of file