提交 3700df1e authored 作者: 1239068511@qq.com's avatar 1239068511@qq.com

[数据模型] 修改了一个修改表结构时的BUG

上级 f794900b
......@@ -124,10 +124,10 @@ public class ModelController {
public ResponseEntity addModel(@RequestBody TableVO tableVO) {
long start = System.currentTimeMillis();
modelService.newTable(tableVO);
TableInfo tableInfo = modelService.newTable(tableVO);
long end = System.currentTimeMillis();
log.warn("创建总用时为:{}秒", (end - start) / 1000.0);
return ResultUtil.success("", "新建成功!");
return ResultUtil.success(tableInfo, "新建成功!");
}
/**
......@@ -203,9 +203,10 @@ public class ModelController {
@ApiOperation("编辑操作")
@PutMapping("/update")
public ResponseEntity updateTable(@RequestBody UpdateTableInfoVO updateTableInfoVO) {
return modelService.updateTable(updateTableInfoVO);
sessionUtil.addXml(modelService.updateTable(updateTableInfoVO));
// return
// if (i == 1) {
// return ResultUtil.success("", "修改成功!");
return ResultUtil.success("", "修改成功!");
// }
// return ResultUtil.failed("业务不支持修改!");
}
......
......@@ -122,7 +122,7 @@ public interface ModelService {
* @param updateTableInfoVO
* @return
*/
ResponseEntity updateTable(UpdateTableInfoVO updateTableInfoVO);
String updateTable(UpdateTableInfoVO updateTableInfoVO);
/**
......
......@@ -383,7 +383,7 @@ public class ModelImpl implements ModelService {
@Override
@Transactional(rollbackFor = Exception.class)
public ResponseEntity updateTable(UpdateTableInfoVO updateTableInfoVO) {
public String updateTable(UpdateTableInfoVO updateTableInfoVO) {
//tableInfo和columnInfo变化
//查询到TableInfo和ColumnInfo
TableVO tableVO = updateTableInfoVO.getTableVO();
......@@ -413,6 +413,7 @@ public class ModelImpl implements ModelService {
} catch (Exception exception) {
//todo
exception.printStackTrace();
throw new ApiException("出错");
// if (exception instanceof OSQLException) {
// String error = exception.getMessage();
......@@ -444,9 +445,8 @@ public class ModelImpl implements ModelService {
tableInfo.setXml(xml);
tableInfoDao.save(tableInfo);
sessionUtil.deleteTableInMeteData(tableInfo.getModelName());
sessionUtil.addXml(xml);
return ResultUtil.success("修改成功!");
return xml;
}
......
......@@ -11,6 +11,7 @@ import com.tykj.model.entity.Quote;
import com.tykj.model.entity.vo.SearchQuoteVO;
import com.tykj.model.entity.vo.UpdateQuoteVO;
import com.tykj.model.service.QuoteService;
import com.tykj.model.utils.SessionUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -67,6 +68,7 @@ public class QuoteServiceImpl implements QuoteService {
@Override
public Quote saveQuote(Quote quote) {
if (existValue(quote.getColumnId(), quote.getValue())) {
return quoteDao.save(quote);
}
......
......@@ -69,11 +69,11 @@ public class CreateTableUtil {
for (ColumnVO columnVO : dataList) {
try {
//由于ID属于自动建立的列 不允许用户自己建立
if (!columnVO.getFieldName().toUpperCase(Locale.ROOT).equals("ID")){
// if (!columnVO.getFieldName().toUpperCase(Locale.ROOT).equals("ID")){
xmlMapping +=
"\n <property type=\"" + columnVO.getFieldType() + "\" name=\"" + columnVO.getFieldName().toUpperCase() + "\" length=\"" + columnVO.getFieldLength() +
"\" column=\"" + columnVO.getFieldName().toUpperCase() + "\"/>\n";
}
// }
} catch (Exception e) {
throw new ApiException("名称不合法!");
}
......
......@@ -3,7 +3,7 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
datasource:
username: ANNUAL_PERFORMANCE_EVALUATION_INDEX_SYSTEM
username: PUNISH
password: 123456
url: jdbc:oscar://192.168.102.200:2003/OSRDB
driver-class-name: com.oscar.Driver
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论