diff --git a/core/core-backend/src/main/java/io/gisbi/dataset/dao/auto/mapper/CoreDatasetTableMapper.java b/core/core-backend/src/main/java/io/gisbi/dataset/dao/auto/mapper/CoreDatasetTableMapper.java index 23dbc25..94497d5 100644 --- a/core/core-backend/src/main/java/io/gisbi/dataset/dao/auto/mapper/CoreDatasetTableMapper.java +++ b/core/core-backend/src/main/java/io/gisbi/dataset/dao/auto/mapper/CoreDatasetTableMapper.java @@ -1,8 +1,14 @@ package io.gisbi.dataset.dao.auto.mapper; +import io.gisbi.application.system.domain.Role; import io.gisbi.dataset.dao.auto.entity.CoreDatasetTable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; /** *

@@ -14,5 +20,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CoreDatasetTableMapper extends BaseMapper { - + @Select("select b.name group_name,a.table_name table_name,a.id table_id from core_dataset_table a join core_dataset_group b on (a.dataset_group_id=b.id) where b.app_id=#{appid} and a.type='db' order by a.name") + List> getTablesByAppId(String appid); } diff --git a/core/core-backend/src/main/java/io/gisbi/dataset/manage/DatasetDataManage.java b/core/core-backend/src/main/java/io/gisbi/dataset/manage/DatasetDataManage.java index 3b3891b..e832b89 100644 --- a/core/core-backend/src/main/java/io/gisbi/dataset/manage/DatasetDataManage.java +++ b/core/core-backend/src/main/java/io/gisbi/dataset/manage/DatasetDataManage.java @@ -1149,20 +1149,18 @@ public class DatasetDataManage { } //-----------------------下面代码为扩展代码,实现了数据表的增删改查功能--zhengsl at 2025-05-20----------------------------------------------------------------------------------------// - public List getTablesByAppId(Long id) throws Exception { - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("app_id", id); - wrapper.eq("type", "db"); - List tables = coreDatasetTableMapper.selectList(wrapper); + public List> getTablesByAppId(String appid) throws Exception { + List> tables = coreDatasetTableMapper.getTablesByAppId(appid); return tables; } - public List getFieldsByTableId(Long id) throws Exception { + public List> getFieldsByTableId(Long id) throws Exception { QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("id","origin_name","name","type","size"); wrapper.eq("dataset_table_id", id); wrapper.eq("checked", true); wrapper.isNull("chart_id"); - List fields = coreDatasetTableFieldMapper.selectList(wrapper); + List> fields = coreDatasetTableFieldMapper.selectMaps(wrapper); return fields; } @@ -1217,8 +1215,13 @@ public class DatasetDataManage { logger.debug("执行插入数据的SQL: {}", sql); // 执行插入操作 - Map result = provider.fetchResultField(datasourceRequest); - return result != null && !result.isEmpty(); + int result= provider.executeUpdate(datasourceRequest); + if (result==1) { + return true; + // process result set + } else { + return false; + } } public boolean updateTableData(Long datasourceId, String tableData) throws Exception { @@ -1283,8 +1286,13 @@ public class DatasetDataManage { logger.debug("执行更新数据的SQL: {}", sql); // 执行更新操作 - Map result = provider.fetchResultField(datasourceRequest); - return result != null && !result.isEmpty(); + int result= provider.executeUpdate(datasourceRequest); + if (result==1) { + return true; + // process result set + } else { + return false; + } } public boolean deleteTableData(Long datasourceId, String whereJson) throws Exception { // 获取数据源信息 @@ -1329,8 +1337,13 @@ public class DatasetDataManage { logger.debug("执行删除数据的SQL: {}", sql); // 执行删除操作 - Map result = provider.fetchResultField(datasourceRequest); - return result != null && !result.isEmpty(); + int result= provider.executeUpdate(datasourceRequest); + if (result==1) { + return true; + // process result set + } else { + return false; + } } public Page> queryTableDataPaged(Long datasourceId, String queryJson) throws Exception { diff --git a/core/core-backend/src/main/java/io/gisbi/dataset/server/DatasetDataServer.java b/core/core-backend/src/main/java/io/gisbi/dataset/server/DatasetDataServer.java index eb27d59..6eed024 100644 --- a/core/core-backend/src/main/java/io/gisbi/dataset/server/DatasetDataServer.java +++ b/core/core-backend/src/main/java/io/gisbi/dataset/server/DatasetDataServer.java @@ -15,10 +15,7 @@ import io.gisbi.extensions.datasource.dto.DatasetTableDTO; import io.gisbi.extensions.datasource.dto.DatasetTableFieldDTO; import io.gisbi.utils.LogUtil; import jakarta.annotation.Resource; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; @@ -108,17 +105,17 @@ public class DatasetDataServer implements DatasetDataApi { } @GetMapping("getTablesByAppId") - public List getTablesByAppId(Long id) throws Exception { - List result = datasetDataManage.getTablesByAppId(id); + public List> getTablesByAppId(String appid) throws Exception { + List> result = datasetDataManage.getTablesByAppId(appid); return result; } @GetMapping("getFieldsByTableId") - public List getFieldsByTableId(Long id) throws Exception { - List result = datasetDataManage.getFieldsByTableId(id); + public List> getFieldsByTableId(Long id) throws Exception { + List> result = datasetDataManage.getFieldsByTableId(id); return result; } @PostMapping("addTableData") - public boolean addTableData(Long datasourceId, String tableData) throws Exception { + public boolean addTableData(Long datasourceId, @RequestBody String tableData) throws Exception { boolean result = datasetDataManage.addTableData( datasourceId, tableData @@ -126,7 +123,7 @@ public class DatasetDataServer implements DatasetDataApi { return result; } @PostMapping("updateTableData") - public boolean updateTableData(Long datasourceId, String tableData) throws Exception { + public boolean updateTableData(Long datasourceId, @RequestBody String tableData) throws Exception { boolean result = datasetDataManage.updateTableData( datasourceId, tableData @@ -134,15 +131,15 @@ public class DatasetDataServer implements DatasetDataApi { return result; } @PostMapping("deleteTableData") - public boolean deleteTableData(Long datasourceId, String whereJson) throws Exception { + public boolean deleteTableData(Long datasourceId, @RequestBody String whereJson) throws Exception { boolean result = datasetDataManage.deleteTableData( datasourceId, whereJson ); return result; } - @GetMapping("queryTableDataPaged") - public Page> queryTableDataPaged(Long datasourceId, String queryJson) throws Exception { + @PostMapping("queryTableDataPaged") + public Page> queryTableDataPaged(Long datasourceId, @RequestBody String queryJson) throws Exception { Page> result = datasetDataManage.queryTableDataPaged( datasourceId, queryJson diff --git a/core/core-frontend/auto-imports.d.ts b/core/core-frontend/auto-imports.d.ts index 2b3ed01..918aad8 100644 --- a/core/core-frontend/auto-imports.d.ts +++ b/core/core-frontend/auto-imports.d.ts @@ -4,6 +4,5 @@ // Generated by unplugin-auto-import export {} declare global { - const ElMessage: typeof import('element-plus-secondary/es')['ElMessage'] - const ElMessageBox: typeof import('element-plus-secondary/es')['ElMessageBox'] + } diff --git a/sdk/common/src/main/java/io/gisbi/auth/filter/TokenFilter.java b/sdk/common/src/main/java/io/gisbi/auth/filter/TokenFilter.java index f354926..df9c254 100644 --- a/sdk/common/src/main/java/io/gisbi/auth/filter/TokenFilter.java +++ b/sdk/common/src/main/java/io/gisbi/auth/filter/TokenFilter.java @@ -80,9 +80,9 @@ public class TokenFilter implements Filter { filterChain.doFilter(servletRequest, servletResponse); return; } - String token = ServletUtils.getToken(); - TokenUserBO userBO = TokenUtils.validate(token); - UserUtils.setUserInfo(userBO); +// String token = ServletUtils.getToken(); +// TokenUserBO userBO = TokenUtils.validate(token); +// UserUtils.setUserInfo(userBO); filterChain.doFilter(servletRequest, servletResponse); } catch (Exception e) { throw e;