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;
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;
/**
* <p>
@ -14,5 +20,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
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----------------------------------------------------------------------------------------//
public List<CoreDatasetTable> getTablesByAppId(Long id) throws Exception {
QueryWrapper<CoreDatasetTable> wrapper = new QueryWrapper<>();
wrapper.eq("app_id", id);
wrapper.eq("type", "db");
List<CoreDatasetTable> tables = coreDatasetTableMapper.selectList(wrapper);
public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
List<Map<String,Object>> tables = coreDatasetTableMapper.getTablesByAppId(appid);
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<>();
wrapper.select("id","origin_name","name","type","size");
wrapper.eq("dataset_table_id", id);
wrapper.eq("checked", true);
wrapper.isNull("chart_id");
List<CoreDatasetTableField> fields = coreDatasetTableFieldMapper.selectList(wrapper);
List<Map<String,Object>> fields = coreDatasetTableFieldMapper.selectMaps(wrapper);
return fields;
}
@ -1217,8 +1215,13 @@ public class DatasetDataManage {
logger.debug("执行插入数据的SQL: {}", sql);
// 执行插入操作
Map<String, Object> 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<String, Object> 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<String, Object> 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<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.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<CoreDatasetTable> getTablesByAppId(Long id) throws Exception {
List<CoreDatasetTable> result = datasetDataManage.getTablesByAppId(id);
public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
List<Map<String,Object>> result = datasetDataManage.getTablesByAppId(appid);
return result;
}
@GetMapping("getFieldsByTableId")
public List<CoreDatasetTableField> getFieldsByTableId(Long id) throws Exception {
List<CoreDatasetTableField> result = datasetDataManage.getFieldsByTableId(id);
public List<Map<String,Object>> getFieldsByTableId(Long id) throws Exception {
List<Map<String,Object>> 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<Map<String, Object>> queryTableDataPaged(Long datasourceId, String queryJson) throws Exception {
@PostMapping("queryTableDataPaged")
public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, @RequestBody String queryJson) throws Exception {
Page<Map<String, Object>> result = datasetDataManage.queryTableDataPaged(
datasourceId,
queryJson

View File

@ -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']
}

View File

@ -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;