提交 6e686f5a authored 作者: ww1xhqc's avatar ww1xhqc

[数据模型] 部分优化更新

上级 16572591
......@@ -3,6 +3,9 @@ package com.tykj.datawarehouse;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author HASEE
*/
@SpringBootApplication
public class DataWarehouseApplication {
......
......@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -80,8 +81,7 @@ public class ModelController {
Rule rule;
try {
rule = ruleDao.findAllByColumnId(columnInfo.getId());
}
catch (Exception e){
} catch (Exception e) {
throw new ApiException("规则不唯一!");
}
columnInfo.setRule(rule);
......@@ -99,7 +99,7 @@ public class ModelController {
**/
@ApiOperation("新增数据模型")
@PostMapping(value = "/addModel")
public ResponseEntity addModel(@RequestBody TableVO tableVO) throws Exception {
public ResponseEntity addModel(@RequestBody TableVO tableVO) {
long start = System.currentTimeMillis();
modelService.newTable(tableVO);
......@@ -197,8 +197,8 @@ public class ModelController {
@ApiOperation("获得获得非聚合对象example")
@GetMapping("/example")
public ResponseEntity getjsonExample(Integer id) {
return ResultUtil.success(modelHelper.getJsonExpample(id),
public ResponseEntity getJSONExample(Integer id) {
return ResultUtil.success(modelHelper.getJsonExample(id),
"获得example成功!");
}
......@@ -227,18 +227,12 @@ public class ModelController {
@GetMapping("/type")
public ResponseEntity type() {
//这代码狗都不改
List<ColumnTypeVO> list = new ArrayList<>();
ColumnTypeVO c1 = new ColumnTypeVO("数字", "java.lang.Integer", "11");
ColumnTypeVO c2 = new ColumnTypeVO("浮点数", "java.lang.Double", "11");
ColumnTypeVO c3 = new ColumnTypeVO("单/多行文本", "java.lang.String", "255");
ColumnTypeVO c4 = new ColumnTypeVO("布尔值", "java.lang.Boolean", "1");
list.add(c1);
list.add(c2);
list.add(c3);
list.add(c4);
return ResultUtil.success(list, "查询成功!");
List<ColumnTypeVO> columnTypeVOS = Arrays.asList(
new ColumnTypeVO("数字", "java.lang.Integer", "11")
, new ColumnTypeVO("浮点数", "java.lang.Double", "11")
, new ColumnTypeVO("单/多行文本", "java.lang.String", "255")
, new ColumnTypeVO("布尔值", "java.lang.Boolean", "1"));
return ResultUtil.success(columnTypeVOS, "查询成功!");
}
}
......@@ -27,12 +27,6 @@ public class QuoteController {
@Autowired
private QuoteService quoteService;
@Autowired
ModelImpl model;
@Autowired
ColumnInfoDao columnInfoDao;
@ApiOperation("引用删除")
@GetMapping("/delete")
public ResponseEntity deleteQuote(Integer id) {
......
......@@ -4,7 +4,6 @@ import com.tykj.datawarehouse.base.result.ResultUtil;
import com.tykj.datawarehouse.model.entity.vo.RuleVo;
import com.tykj.datawarehouse.model.service.RuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
......
......@@ -9,7 +9,13 @@ package com.tykj.datawarehouse.model.entity.customEnums;
*/
public enum ConnectionType {
/**
* or
*/
OR(" or "),
/**
* and
*/
AND(" and ");
private final String type;
......
......@@ -35,7 +35,7 @@ public class ModelHelper {
* @param tableInfoId 指定id
* @return json格式的数据示例
*/
public String getJsonExpample(Integer tableInfoId) {
public String getJsonExample(Integer tableInfoId) {
/* 你要放10个元素,10/0.75+1=14 */
Map<String, Object> result = new HashMap<>();
TableInfo tableInfo = tableInfoDao.findById(tableInfoId)
......
......@@ -167,15 +167,15 @@ public class ModelImpl implements ModelService {
);
ColumnInfo save = columnInfoDao.save(columnInfo);
/***/
List<Quote> quoteList = columnVO.getQuoteList();
if (quoteList != null) {
for (Quote quote : quoteList) {
if (isNotEmpty(quote.getValue())) {
quote.setColumnId(save.getId());
quoteDao.save(quote);
}
}
}
// List<Quote> quoteList = columnVO.getQuoteList();
// if (quoteList != null) {
// for (Quote quote : quoteList) {
// if (isNotEmpty(quote.getValue())) {
// quote.setColumnId(save.getId());
// quoteDao.save(quote);
// }
// }
// }
}
//关闭会话
return tableInfo;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论