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

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

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