|
@@ -80,17 +80,17 @@ public class DragTableServiceImpl implements IDragTableService {
|
|
|
return dragTableMapper.insertDragTable(dragTable);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 修改动态格
|
|
|
- *
|
|
|
- * @param dragTable 动态格
|
|
|
- * @return 结果
|
|
|
- */
|
|
|
- @Override
|
|
|
- public int updateDragTable(DragTable dragTable) {
|
|
|
- dragTable.setUpdateTime(DateUtils.getNowDate());
|
|
|
- return dragTableMapper.updateDragTable(dragTable);
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 修改动态格
|
|
|
+// *
|
|
|
+// * @param dragTable 动态格
|
|
|
+// * @return 结果
|
|
|
+// */
|
|
|
+// @Override
|
|
|
+// public int updateDragTable(DragTable dragTable) {
|
|
|
+// dragTable.setUpdateTime(DateUtils.getNowDate());
|
|
|
+// return dragTableMapper.updateDragTable(dragTable);
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 批量删除动态格
|
|
@@ -196,4 +196,63 @@ public class DragTableServiceImpl implements IDragTableService {
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public DragTableVo selectDragTableVoByTId(Long tId) {
|
|
|
+ DragTableVo vo = dragTableMapper.selectDragTableVoByTId(tId);
|
|
|
+ vo.setSearchFieldList(dragTableConditionMapper.selectDragTableSearchField(tId));
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public int updateDragTable(DragTableVo dragTableVo) {
|
|
|
+ //update drag_table
|
|
|
+ DragTable dragTable = new DragTable();
|
|
|
+ BeanUtils.copyProperties(dragTableVo, dragTable);
|
|
|
+ dragTable.setDtColumnName(JSON.toJSONString(dragTableVo.getDtColumnName()));
|
|
|
+ dragTableMapper.updateDragTable(dragTable);
|
|
|
+
|
|
|
+ //update table_sql
|
|
|
+ TableSql tableSql = new TableSql();
|
|
|
+ tableSql.setTableSql(dragTableVo.getTableSql());
|
|
|
+ // 拼接sql查询条件
|
|
|
+ switch ("MYSQL") {
|
|
|
+ case "MYSQL":
|
|
|
+ case "DM":
|
|
|
+ for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
+ SQL_START += SQL_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
|
|
|
+ SQL_START += dragTableVo.getSearchFieldList().size() - 1 == i ? ")" : ",\n";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "SQLSERVER":
|
|
|
+ for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
+ SQL_START += SQLSERVER_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
|
|
|
+ SQL_START += dragTableVo.getSearchFieldList().size() - 1 == i ? ")" : ",\n";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "ORACLE":
|
|
|
+ SQL_START = "";
|
|
|
+ for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
+ SQL_START += dragTableVo.getSearchFieldList().get(i);
|
|
|
+ SQL_START += dragTableVo.getSearchFieldList().size() - 1 == i ? " " : "||";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ tableSql.setTableCondition(SQL_START + SQL_END);
|
|
|
+ tableSql.setTableAlias(dragTableVo.getDtTableName());
|
|
|
+ tableSql.setTableExportField(JSON.toJSONString(dragTableVo.getTableExportField()));
|
|
|
+
|
|
|
+
|
|
|
+ //update drag_table_condition
|
|
|
+
|
|
|
+ List<DragTableCondition> dragTableConditionList = new ArrayList<>();
|
|
|
+ dragTableVo.getSearchFieldList().forEach(item -> {
|
|
|
+ dragTableConditionList.add(new DragTableCondition(dragTableVo.gettId(), item));
|
|
|
+ });
|
|
|
+ dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
|
|
|
+
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|