|
@@ -5,7 +5,67 @@ class AxiosRequestAPI {
|
|
constructor() {
|
|
constructor() {
|
|
this.doQueryUrl = '/public/pgBase/doQuery'
|
|
this.doQueryUrl = '/public/pgBase/doQuery'
|
|
this.geoQueryUrl = "/search/geoQuery"
|
|
this.geoQueryUrl = "/search/geoQuery"
|
|
|
|
+ this.doQueryUrl1 = '/searchtubiao/getClassAreaSum'
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ listShapeArea() {
|
|
|
|
+ // 定义多个表名
|
|
|
|
+ const tableNames = [
|
|
|
|
+ 'ty2014_shuiti',
|
|
|
|
+ 'ty2017_1_jianzhuwu',
|
|
|
|
+ 'ty2021_jianzhu',
|
|
|
|
+ 'ty2023_shuiti'
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ // 使用 UNION ALL 来将所有表的查询结果合并
|
|
|
|
+ const sql = tableNames.map(table =>
|
|
|
|
+ `SELECT class_name, SUM(shape_area) AS total_area
|
|
|
|
+ FROM ${table}
|
|
|
|
+ GROUP BY class_name`
|
|
|
|
+ ).join(' UNION ALL ');
|
|
|
|
+
|
|
|
|
+ // 定义查询参数
|
|
|
|
+ const params = {
|
|
|
|
+ sql: sql
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ axios_8004.get(this.doQueryUrl, { params })
|
|
|
|
+ .then(data => {
|
|
|
|
+ // 如果查询成功,返回查询到的 rows 数据
|
|
|
|
+ resolve(data.data.rows);
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ // 处理请求或查询失败的情况
|
|
|
|
+ console.error("查询失败:", error);
|
|
|
|
+ reject(error);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //用于查询指定表的 class_name 和 shape_area
|
|
|
|
+ listClassNameAndShapeArea() {
|
|
|
|
+ let tableName = "jjj2019_1__cc1407252017000258"; // 指定表名
|
|
|
|
+ const params = {
|
|
|
|
+ sql: `SELECT class_name, SUM(shape_area) AS total_area
|
|
|
|
+ FROM ${tableName} GROUP BY class_name`
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ axios_8004.get(this.doQueryUrl, {
|
|
|
|
+ params
|
|
|
|
+ }).then(data => {
|
|
|
|
+ // 如果查询成功,返回查询到的 rows 数据
|
|
|
|
+ resolve(data.data.rows);
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ // 处理请求或查询失败的情况
|
|
|
|
+ console.error("查询失败:", error);
|
|
|
|
+ reject(error);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
// 获取某个表的所有geom数据
|
|
// 获取某个表的所有geom数据
|
|
listAllGeomByTableName(tableName) {
|
|
listAllGeomByTableName(tableName) {
|
|
|
|
|