Compare commits

..

No commits in common. "8c35dc4d5e61bfd5611b21e05950e6d8b7632f7b" and "15ae73cc1592a90fe97c115714d056cd8ec4328e" have entirely different histories.

5 changed files with 32 additions and 48 deletions

View File

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

View File

@ -15,7 +15,10 @@ 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.*;
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 java.util.List;
import java.util.Map;
@ -105,17 +108,17 @@ public class DatasetDataServer implements DatasetDataApi {
}
@GetMapping("getTablesByAppId")
public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
List<Map<String,Object>> result = datasetDataManage.getTablesByAppId(appid);
public List<CoreDatasetTable> getTablesByAppId(Long id) throws Exception {
List<CoreDatasetTable> result = datasetDataManage.getTablesByAppId(id);
return result;
}
@GetMapping("getFieldsByTableId")
public List<Map<String,Object>> getFieldsByTableId(Long id) throws Exception {
List<Map<String,Object>> result = datasetDataManage.getFieldsByTableId(id);
public List<CoreDatasetTableField> getFieldsByTableId(Long id) throws Exception {
List<CoreDatasetTableField> result = datasetDataManage.getFieldsByTableId(id);
return result;
}
@PostMapping("addTableData")
public boolean addTableData(Long datasourceId, @RequestBody String tableData) throws Exception {
public boolean addTableData(Long datasourceId, String tableData) throws Exception {
boolean result = datasetDataManage.addTableData(
datasourceId,
tableData
@ -123,7 +126,7 @@ public class DatasetDataServer implements DatasetDataApi {
return result;
}
@PostMapping("updateTableData")
public boolean updateTableData(Long datasourceId, @RequestBody String tableData) throws Exception {
public boolean updateTableData(Long datasourceId, String tableData) throws Exception {
boolean result = datasetDataManage.updateTableData(
datasourceId,
tableData
@ -131,15 +134,15 @@ public class DatasetDataServer implements DatasetDataApi {
return result;
}
@PostMapping("deleteTableData")
public boolean deleteTableData(Long datasourceId, @RequestBody String whereJson) throws Exception {
public boolean deleteTableData(Long datasourceId, String whereJson) throws Exception {
boolean result = datasetDataManage.deleteTableData(
datasourceId,
whereJson
);
return result;
}
@PostMapping("queryTableDataPaged")
public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, @RequestBody String queryJson) throws Exception {
@GetMapping("queryTableDataPaged")
public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, String queryJson) throws Exception {
Page<Map<String, Object>> result = datasetDataManage.queryTableDataPaged(
datasourceId,
queryJson

View File

@ -4,5 +4,6 @@
// 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;