import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class VerifySql {
    public static void main(String[] args) {
        String url = "jdbc:dm://8.142.21.6:5236?schema=JZ_TEST";
        String username = "SYSDBA";
        String password = "Dameng1@34";
        
        try {
            Class.forName("dm.jdbc.driver.DmDriver");
            Connection conn = DriverManager.getConnection(url, username, password);
            Statement stmt = conn.createStatement();
            
            System.out.println("=== 吉林省行政区划数据验证 ===");
            
            ResultSet rs1 = stmt.executeQuery("SELECT COUNT(*) as total FROM sys_area");
            rs1.next();
            System.out.println("总记录数: " + rs1.getInt("total"));
            
            ResultSet rs2 = stmt.executeQuery("SELECT COUNT(*) as province FROM sys_area WHERE area_type = '0'");
            rs2.next();
            System.out.println("省级记录数: " + rs2.getInt("province"));
            
            ResultSet rs3 = stmt.executeQuery("SELECT COUNT(*) as city FROM sys_area WHERE area_type = '1'");
            rs3.next();
            System.out.println("市级记录数: " + rs3.getInt("city"));
            
            ResultSet rs4 = stmt.executeQuery("SELECT COUNT(*) as district FROM sys_area WHERE area_type = '2'");
            rs4.next();
            System.out.println("县级记录数: " + rs4.getInt("district"));
            
            ResultSet rs5 = stmt.executeQuery("SELECT COUNT(*) as town FROM sys_area WHERE area_type = '3'");
            rs5.next();
            System.out.println("乡级记录数: " + rs5.getInt("town"));
            
            System.out.println("");
            System.out.println("=== 吉林省城市列表 ===");
            ResultSet rs6 = stmt.executeQuery("SELECT area_code, area_name FROM sys_area WHERE area_type = '1' ORDER BY area_code");
            while (rs6.next()) {
                System.out.println(rs6.getString("area_code") + " - " + rs6.getString("area_name"));
            }
            
            stmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}
