Merge remote-tracking branch 'origin/main'

This commit is contained in:
limengnan 2025-05-21 16:46:12 +08:00
commit bfb759d653
5 changed files with 48 additions and 32 deletions

View File

@ -1,8 +1,14 @@
package io.gisbi.dataset.dao.auto.mapper; package io.gisbi.dataset.dao.auto.mapper;
import io.gisbi.application.system.domain.Role;
import io.gisbi.dataset.dao.auto.entity.CoreDatasetTable; import io.gisbi.dataset.dao.auto.entity.CoreDatasetTable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; 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;
/** /**
* <p> * <p>
@ -14,5 +20,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface CoreDatasetTableMapper extends BaseMapper<CoreDatasetTable> { public interface CoreDatasetTableMapper extends BaseMapper<CoreDatasetTable> {
@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<Map<String,Object>> getTablesByAppId(String appid);
} }

View File

@ -1149,20 +1149,18 @@ public class DatasetDataManage {
} }
//-----------------------下面代码为扩展代码实现了数据表的增删改查功能--zhengsl at 2025-05-20----------------------------------------------------------------------------------------// //-----------------------下面代码为扩展代码实现了数据表的增删改查功能--zhengsl at 2025-05-20----------------------------------------------------------------------------------------//
public List<CoreDatasetTable> getTablesByAppId(Long id) throws Exception { public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
QueryWrapper<CoreDatasetTable> wrapper = new QueryWrapper<>(); List<Map<String,Object>> tables = coreDatasetTableMapper.getTablesByAppId(appid);
wrapper.eq("app_id", id);
wrapper.eq("type", "db");
List<CoreDatasetTable> tables = coreDatasetTableMapper.selectList(wrapper);
return tables; return tables;
} }
public List<CoreDatasetTableField> getFieldsByTableId(Long id) throws Exception { public List<Map<String,Object>> getFieldsByTableId(Long id) throws Exception {
QueryWrapper<CoreDatasetTableField> wrapper = new QueryWrapper<>(); QueryWrapper<CoreDatasetTableField> wrapper = new QueryWrapper<>();
wrapper.select("id","origin_name","name","type","size");
wrapper.eq("dataset_table_id", id); wrapper.eq("dataset_table_id", id);
wrapper.eq("checked", true); wrapper.eq("checked", true);
wrapper.isNull("chart_id"); wrapper.isNull("chart_id");
List<CoreDatasetTableField> fields = coreDatasetTableFieldMapper.selectList(wrapper); List<Map<String,Object>> fields = coreDatasetTableFieldMapper.selectMaps(wrapper);
return fields; return fields;
} }
@ -1217,8 +1215,13 @@ public class DatasetDataManage {
logger.debug("执行插入数据的SQL: {}", sql); logger.debug("执行插入数据的SQL: {}", sql);
// 执行插入操作 // 执行插入操作
Map<String, Object> result = provider.fetchResultField(datasourceRequest); int result= provider.executeUpdate(datasourceRequest);
return result != null && !result.isEmpty(); if (result==1) {
return true;
// process result set
} else {
return false;
}
} }
public boolean updateTableData(Long datasourceId, String tableData) throws Exception { public boolean updateTableData(Long datasourceId, String tableData) throws Exception {
@ -1283,8 +1286,13 @@ public class DatasetDataManage {
logger.debug("执行更新数据的SQL: {}", sql); logger.debug("执行更新数据的SQL: {}", sql);
// 执行更新操作 // 执行更新操作
Map<String, Object> result = provider.fetchResultField(datasourceRequest); int result= provider.executeUpdate(datasourceRequest);
return result != null && !result.isEmpty(); if (result==1) {
return true;
// process result set
} else {
return false;
}
} }
public boolean deleteTableData(Long datasourceId, String whereJson) throws Exception { public boolean deleteTableData(Long datasourceId, String whereJson) throws Exception {
// 获取数据源信息 // 获取数据源信息
@ -1329,8 +1337,13 @@ public class DatasetDataManage {
logger.debug("执行删除数据的SQL: {}", sql); logger.debug("执行删除数据的SQL: {}", sql);
// 执行删除操作 // 执行删除操作
Map<String, Object> result = provider.fetchResultField(datasourceRequest); int result= provider.executeUpdate(datasourceRequest);
return result != null && !result.isEmpty(); if (result==1) {
return true;
// process result set
} else {
return false;
}
} }
public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, String queryJson) throws Exception { public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, String queryJson) throws Exception {

View File

@ -15,10 +15,7 @@ import io.gisbi.extensions.datasource.dto.DatasetTableDTO;
import io.gisbi.extensions.datasource.dto.DatasetTableFieldDTO; import io.gisbi.extensions.datasource.dto.DatasetTableFieldDTO;
import io.gisbi.utils.LogUtil; import io.gisbi.utils.LogUtil;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -108,17 +105,17 @@ public class DatasetDataServer implements DatasetDataApi {
} }
@GetMapping("getTablesByAppId") @GetMapping("getTablesByAppId")
public List<CoreDatasetTable> getTablesByAppId(Long id) throws Exception { public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
List<CoreDatasetTable> result = datasetDataManage.getTablesByAppId(id); List<Map<String,Object>> result = datasetDataManage.getTablesByAppId(appid);
return result; return result;
} }
@GetMapping("getFieldsByTableId") @GetMapping("getFieldsByTableId")
public List<CoreDatasetTableField> getFieldsByTableId(Long id) throws Exception { public List<Map<String,Object>> getFieldsByTableId(Long id) throws Exception {
List<CoreDatasetTableField> result = datasetDataManage.getFieldsByTableId(id); List<Map<String,Object>> result = datasetDataManage.getFieldsByTableId(id);
return result; return result;
} }
@PostMapping("addTableData") @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( boolean result = datasetDataManage.addTableData(
datasourceId, datasourceId,
tableData tableData
@ -126,7 +123,7 @@ public class DatasetDataServer implements DatasetDataApi {
return result; return result;
} }
@PostMapping("updateTableData") @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( boolean result = datasetDataManage.updateTableData(
datasourceId, datasourceId,
tableData tableData
@ -134,15 +131,15 @@ public class DatasetDataServer implements DatasetDataApi {
return result; return result;
} }
@PostMapping("deleteTableData") @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( boolean result = datasetDataManage.deleteTableData(
datasourceId, datasourceId,
whereJson whereJson
); );
return result; return result;
} }
@GetMapping("queryTableDataPaged") @PostMapping("queryTableDataPaged")
public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, String queryJson) throws Exception { public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, @RequestBody String queryJson) throws Exception {
Page<Map<String, Object>> result = datasetDataManage.queryTableDataPaged( Page<Map<String, Object>> result = datasetDataManage.queryTableDataPaged(
datasourceId, datasourceId,
queryJson queryJson

View File

@ -4,6 +4,5 @@
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
const ElMessage: typeof import('element-plus-secondary/es')['ElMessage']
const ElMessageBox: typeof import('element-plus-secondary/es')['ElMessageBox']
} }

View File

@ -80,9 +80,9 @@ public class TokenFilter implements Filter {
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
return; return;
} }
String token = ServletUtils.getToken(); // String token = ServletUtils.getToken();
TokenUserBO userBO = TokenUtils.validate(token); // TokenUserBO userBO = TokenUtils.validate(token);
UserUtils.setUserInfo(userBO); // UserUtils.setUserInfo(userBO);
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} catch (Exception e) { } catch (Exception e) {
throw e; throw e;