Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.tinyengine.it.dynamic.dto;

import lombok.Data;

import java.util.Map;

@Data
public class DynamicDelete {
private String nameEn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ public class DynamicModelService {
* 创建动态表
*/
@Transactional
public void createDynamicTable(Model modelMetadata) {
public void createDynamicTable(Model modelMetadata) {
String tableName = getTableName(modelMetadata.getNameEn());
String sql = generateCreateTableSQL(tableName, modelMetadata);

log.info("创建动态表SQL: \n{}", sql);
log.info("createDynamicTable SQL: \n{}", sql);

try {
jdbcTemplate.execute(sql);
log.info("创建动态表成功: {}", tableName);
log.info("createDynamicTable ok: {}", tableName);

} catch (Exception e) {
log.error("创建动态表失败: {}", tableName, e);
throw new RuntimeException("创建动态表失败: " + e.getMessage());
log.error("createDynamicTable failed: {}", tableName, e);
}
}
private String generateDropTableSQL(String tableName) {
Expand Down Expand Up @@ -82,7 +81,6 @@ public void dropDynamicTable(Model modelMetadata) {
log.info("Successfully dropped table: {}", tableName);
} catch (Exception e) {
log.error("Failed to drop table: {}", tableName, e);
throw new RuntimeException("Failed to drop table: " + tableName, e);
}
}
/**
Expand Down Expand Up @@ -553,7 +551,7 @@ public PreparedStatement createPreparedStatement(Connection con) throws SQLExcep
* 获取表名
*/
private String getTableName(String modelId) {
return "dynamic_" + modelId.toLowerCase();
return "dynamic_" + modelId.toLowerCase(Locale.ROOT);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ public boolean preHandle(HttpServletRequest request,
} catch (Exception e) {
log.error("Token validation exception: {}", e.getMessage(), e);
DefaultLoginUserContext.clear();
if(e instanceof ServiceException) {
throw e;
}
throw new ServiceException(ExceptionEnum.CM339.getResultCode(), ExceptionEnum.CM339.getResultMsg());
throw new Exception(e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ public Model createModel(Model model) {
}
// 创建动态表
dynamicModelService.createDynamicTable(model);
//初始化模型表數據
// dynamicModelService.initializeDynamicTable(model, Long.valueOf(model.getCreatedBy()));

return model;
}

Expand Down
Loading