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
Expand Up @@ -3,6 +3,8 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.tinyengine.it.common.context.LoginUserContext;
import com.tinyengine.it.common.exception.ExceptionEnum;
import com.tinyengine.it.common.exception.ServiceException;
import com.tinyengine.it.dynamic.dto.DynamicDelete;
import com.tinyengine.it.dynamic.dto.DynamicInsert;
import com.tinyengine.it.dynamic.dto.DynamicQuery;
Expand Down Expand Up @@ -53,6 +55,8 @@ public void createDynamicTable(Model modelMetadata) {

} catch (Exception e) {
log.error("createDynamicTable failed: {}", tableName, e);
throw new ServiceException(ExceptionEnum.CM001.getResultCode(), ExceptionEnum.CM001.getResultCode());

}
}
private String generateDropTableSQL(String tableName) {
Expand Down Expand Up @@ -81,6 +85,8 @@ public void dropDynamicTable(Model modelMetadata) {
log.info("Successfully dropped table: {}", tableName);
} catch (Exception e) {
log.error("Failed to drop table: {}", tableName, e);
throw new ServiceException(ExceptionEnum.CM001.getResultCode(), ExceptionEnum.CM001.getResultCode());

}
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void validateTableExists(String tableName) {
}
}
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,7 +115,7 @@ public boolean preHandle(HttpServletRequest request,
} catch (Exception e) {
log.error("Token validation exception: {}", e.getMessage(), e);
DefaultLoginUserContext.clear();
throw new Exception(e.getMessage());
throw new ServiceException(ExceptionEnum.CM336.getResultCode(), ExceptionEnum.CM336.getResultMsg());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public Model deleteModelById(Integer id) {
try {
dynamicModelService.dropDynamicTable(model);
} catch (Exception e) {
log.error("刪除动态表失败", e);
throw new RuntimeException("刪除动态表失败: " + e.getMessage());
log.error("deleteModelById", e);
throw new ServiceException(ExceptionEnum.CM001.getResultCode(), ExceptionEnum.CM001.getResultCode());

}
return model;
}
Expand Down Expand Up @@ -188,8 +189,8 @@ public Model updateModelById(Model model) {
try {
dynamicModelService.modifyTableStructure(model);
} catch (Exception e) {
log.error("修改动态表失败", e);
throw new RuntimeException("修改动态表失败: " + e.getMessage());
log.error("updateModelById", e);
throw new ServiceException(ExceptionEnum.CM001.getResultCode(), ExceptionEnum.CM001.getResultCode());
}
Model modelResult = this.baseMapper.selectById(model.getId());
return modelResult;
Expand Down
Loading