|
@@ -1,9 +1,6 @@
|
|
package com.ruoyi.system.service.impl;
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
@@ -99,7 +96,7 @@ public class DragTableServiceImpl implements IDragTableService {
|
|
* @return 结果
|
|
* @return 结果
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public int deleteDragTableByTIds(Long[] tIds) {
|
|
|
|
|
|
+ public int deleteDragTableByTIds(List<Long> tIds) {
|
|
return dragTableMapper.deleteDragTableByTIds(tIds);
|
|
return dragTableMapper.deleteDragTableByTIds(tIds);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -144,7 +141,7 @@ public class DragTableServiceImpl implements IDragTableService {
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
- public int addDragTable(DragTableVo dragTableVo) {
|
|
|
|
|
|
+ public String addDragTable(DragTableVo dragTableVo) {
|
|
//生成dtNickname表格别名
|
|
//生成dtNickname表格别名
|
|
String dtNickname = IdUtils.fastSimpleUUID();
|
|
String dtNickname = IdUtils.fastSimpleUUID();
|
|
//生成sqlKey唯一标识
|
|
//生成sqlKey唯一标识
|
|
@@ -194,7 +191,7 @@ public class DragTableServiceImpl implements IDragTableService {
|
|
});
|
|
});
|
|
dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
|
|
dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
|
|
|
|
|
|
- return 1;
|
|
|
|
|
|
+ return sqlKey;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -241,18 +238,30 @@ public class DragTableServiceImpl implements IDragTableService {
|
|
}
|
|
}
|
|
tableSql.setTableCondition(SQL_START + SQL_END);
|
|
tableSql.setTableCondition(SQL_START + SQL_END);
|
|
tableSql.setTableAlias(dragTableVo.getDtTableName());
|
|
tableSql.setTableAlias(dragTableVo.getDtTableName());
|
|
|
|
+ tableSql.setSqlKey(dragTableVo.getSqlKey());
|
|
tableSql.setTableExportField(JSON.toJSONString(dragTableVo.getTableExportField()));
|
|
tableSql.setTableExportField(JSON.toJSONString(dragTableVo.getTableExportField()));
|
|
-
|
|
|
|
|
|
+ tableSqlMapper.updateTableSqlBySqlKey(tableSql);
|
|
|
|
|
|
//update drag_table_condition
|
|
//update drag_table_condition
|
|
|
|
+ //delete
|
|
|
|
+ dragTableConditionMapper.deleteDragTableConditionBytIds(Collections.singletonList(dragTableVo.gettId()));
|
|
|
|
|
|
|
|
+ //insert
|
|
List<DragTableCondition> dragTableConditionList = new ArrayList<>();
|
|
List<DragTableCondition> dragTableConditionList = new ArrayList<>();
|
|
dragTableVo.getSearchFieldList().forEach(item -> {
|
|
dragTableVo.getSearchFieldList().forEach(item -> {
|
|
dragTableConditionList.add(new DragTableCondition(dragTableVo.gettId(), item));
|
|
dragTableConditionList.add(new DragTableCondition(dragTableVo.gettId(), item));
|
|
});
|
|
});
|
|
- dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
|
|
|
|
-
|
|
|
|
|
|
+ return dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
|
|
|
|
+ }
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ @Override
|
|
|
|
+ public int deleteDragTable(List<Long> tIds, List<String> sqlKeys) {
|
|
|
|
+ // delete drag_table
|
|
|
|
+ dragTableMapper.deleteDragTableByTIds(tIds);
|
|
|
|
+ //delete table_sql
|
|
|
|
+ tableSqlMapper.deleteTableSqlBySqlKeys(sqlKeys);
|
|
|
|
+ //delete drag_table_condition
|
|
|
|
+ return dragTableConditionMapper.deleteDragTableConditionBytIds(tIds);
|
|
}
|
|
}
|
|
}
|
|
}
|