|
@@ -67,8 +67,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
* @return 拖拽格组
|
|
|
*/
|
|
|
@Override
|
|
|
- public DragTableGroup selectDragTableGroupById(Long id)
|
|
|
- {
|
|
|
+ public DragTableGroup selectDragTableGroupById(Long id) {
|
|
|
return dragTableGroupMapper.selectDragTableGroupById(id);
|
|
|
}
|
|
|
|
|
@@ -79,8 +78,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
* @return 拖拽格组
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<DragTableGroup> selectDragTableGroupList(DragTableGroup dragTableGroup)
|
|
|
- {
|
|
|
+ public List<DragTableGroup> selectDragTableGroupList(DragTableGroup dragTableGroup) {
|
|
|
return dragTableGroupMapper.selectDragTableGroupList(dragTableGroup);
|
|
|
}
|
|
|
|
|
@@ -93,11 +91,10 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int insertDragTableGroup(DragTableGroupVo dragTableGroupVo)
|
|
|
- {
|
|
|
+ public int insertDragTableGroup(DragTableGroupVo dragTableGroupVo) {
|
|
|
//表格组实体类拷贝数据
|
|
|
- DragTableGroup dragTableGroup=new DragTableGroup();
|
|
|
- BeanUtils.copyProperties(dragTableGroupVo,dragTableGroup);
|
|
|
+ DragTableGroup dragTableGroup = new DragTableGroup();
|
|
|
+ BeanUtils.copyProperties(dragTableGroupVo, dragTableGroup);
|
|
|
//添加动态表格列表
|
|
|
dragTableService.addDragTable(dragTableGroupVo);
|
|
|
//默认添加的是联动表格
|
|
@@ -108,11 +105,10 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int insertDragTableConfigurationGroup(DragTableGroupVo dragTableGroupVo)
|
|
|
- {
|
|
|
+ public int insertDragTableConfigurationGroup(DragTableGroupVo dragTableGroupVo) {
|
|
|
//表格组实体类拷贝数据
|
|
|
- DragTableGroup dragTableGroup=new DragTableGroup();
|
|
|
- BeanUtils.copyProperties(dragTableGroupVo,dragTableGroup);
|
|
|
+ DragTableGroup dragTableGroup = new DragTableGroup();
|
|
|
+ BeanUtils.copyProperties(dragTableGroupVo, dragTableGroup);
|
|
|
//添加动态表格列表
|
|
|
dragTableService.addDragTable(dragTableGroupVo);
|
|
|
dragTableGroup.setGroupType("1");
|
|
@@ -162,9 +158,9 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
|
|
|
//优化逻辑 1、表格组信息 2、表格信息、条件信息、sql信息
|
|
|
List<DragTableVo> dragTables = dragTableGroupVo.getDragTables();
|
|
|
- if (dragTables.size()>0) {
|
|
|
- dragTables.stream().forEach(dragTableVo->{
|
|
|
- String SQL="";
|
|
|
+ if (dragTables.size() > 0) {
|
|
|
+ dragTables.stream().forEach(dragTableVo -> {
|
|
|
+ String SQL = "";
|
|
|
//update drag_table
|
|
|
DragTable dragTable = new DragTable();
|
|
|
BeanUtils.copyProperties(dragTableVo, dragTable);
|
|
@@ -175,26 +171,33 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
dragTableMapper.updateDragTable(dragTable);
|
|
|
//update table_sql
|
|
|
TableSql tableSql = new TableSql();
|
|
|
+
|
|
|
+ List<String> searchFieldList = new ArrayList<>();
|
|
|
+ dragTableVo.getSearchFieldList().forEach(item -> {
|
|
|
+ if (item.getConditionType().equals("SuperQuery")) { // 当前表格的查询条件是超级查询
|
|
|
+ searchFieldList.add(item.getConditionField());
|
|
|
+ }
|
|
|
+ });
|
|
|
//拼接sql查询条件
|
|
|
switch (SecurityUtils.getDatabaseType().toUpperCase()) {
|
|
|
case "MYSQL":
|
|
|
- for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
- SQL += " AND "+dragTableVo.getSearchFieldList().get(i)+"="+dragTableVo.getConditionDefaultValueMap().get(dragTableVo.getSearchFieldList().get(i));
|
|
|
+ for (int i = 0; searchFieldList.size() > i; i++) {
|
|
|
+ SQL += " AND " + searchFieldList.get(i) + "=" + dragTableVo.getConditionDefaultValueMap().get(searchFieldList.get(i));
|
|
|
}
|
|
|
break;
|
|
|
case "DM":
|
|
|
case "SQLSERVER":
|
|
|
SQL += SQL_START;
|
|
|
- for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
- SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
|
|
|
- SQL += dragTableVo.getSearchFieldList().size() - 1 == i ? ",'')" : ",\n";
|
|
|
+ for (int i = 0; searchFieldList.size() > i; i++) {
|
|
|
+ SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
|
|
|
+ SQL += searchFieldList.size() - 1 == i ? ",'')" : ",\n";
|
|
|
}
|
|
|
break;
|
|
|
case "ORACLE":
|
|
|
//SQL_START = "";
|
|
|
- for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
- SQL += dragTableVo.getSearchFieldList().get(i);
|
|
|
- SQL += (dragTableVo.getSearchFieldList().size() - 1 == i ? " " : "||");
|
|
|
+ for (int i = 0; searchFieldList.size() > i; i++) {
|
|
|
+ SQL += searchFieldList.get(i);
|
|
|
+ SQL += (searchFieldList.size() - 1 == i ? " " : "||");
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -208,14 +211,19 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
System.out.println(i);
|
|
|
//add drag_table_condition
|
|
|
if (dragTableVo.getSearchFieldList().size() > 0) {
|
|
|
- List<DragTableCondition> dragTableConditionList = new ArrayList<>();
|
|
|
- dragTableVo.getSearchFieldList().forEach(item -> {
|
|
|
- if(dragTableVo.getConditionDefaultValueMap().size()>0){
|
|
|
- dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item,dragTableVo.getConditionDefaultValueMap().get(item).toString()));
|
|
|
- }
|
|
|
+ // delete
|
|
|
+ dragTableConditionMapper.deleteDragTableConditionBytIds(Collections.singletonList(dragTableVo.gettId()));
|
|
|
+ dragTableVo.getConditionDefaultValueMap().keySet().forEach(item -> {
|
|
|
+ dragTableVo.getSearchFieldList().add(
|
|
|
+ new DragTableCondition(
|
|
|
+ dragTable.gettId(), "默认查询", item, "DefaultQuery", dragTableVo.getConditionDefaultValueMap().get(item).toString()));
|
|
|
});
|
|
|
- dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
|
|
|
- }
|
|
|
+ // 批量更新
|
|
|
+ dragTableVo.getSearchFieldList().forEach(item -> {
|
|
|
+ item.settId(dragTable.gettId());
|
|
|
+ dragTableConditionMapper.insertDragTableConditionOne(item);
|
|
|
+ });
|
|
|
+ } //修改按钮信息
|
|
|
});
|
|
|
}
|
|
|
//修改表格组列表信息
|
|
@@ -248,9 +256,9 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
dragTableConditionMapper.deleteDragTableConditionBytIds(dragTableIds);
|
|
|
//优化逻辑 1、表格组信息 2、表格信息、条件信息、sql信息
|
|
|
List<DragTableVo> dragTables = dragTableGroupVo.getDragTables();
|
|
|
- if (dragTables.size()>0) {
|
|
|
- dragTables.stream().forEach(dragTableVo->{
|
|
|
- String SQL="";
|
|
|
+ if (dragTables.size() > 0) {
|
|
|
+ dragTables.stream().forEach(dragTableVo -> {
|
|
|
+ String SQL = "";
|
|
|
//add drag_table
|
|
|
DragTable dragTable = new DragTable();
|
|
|
BeanUtils.copyProperties(dragTableVo, dragTable);
|
|
@@ -264,27 +272,32 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
tableSql.setSqlKey(dragTableVo.getSqlKey());
|
|
|
tableSql.setTableSql(dragTableVo.getTableSql());
|
|
|
int i1 = dragTableMapper.updateDragTable(dragTable);
|
|
|
- System.out.println(i1);
|
|
|
+ List<String> searchFieldList = new ArrayList<>();
|
|
|
+ dragTableVo.getSearchFieldList().forEach(item -> {
|
|
|
+ if (item.getConditionType().equals("SuperQuery")) { // 当前表格的查询条件是超级查询
|
|
|
+ searchFieldList.add(item.getConditionField());
|
|
|
+ }
|
|
|
+ });
|
|
|
//拼接sql查询条件
|
|
|
switch (SecurityUtils.getDatabaseType().toUpperCase()) {
|
|
|
case "MYSQL":
|
|
|
- for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
- SQL += " AND "+dragTableVo.getSearchFieldList().get(i)+"="+dragTableVo.getConditionDefaultValueMap().get(dragTableVo.getSearchFieldList().get(i));
|
|
|
+ for (int i = 0; searchFieldList.size() > i; i++) {
|
|
|
+ SQL += " AND " + dragTableVo.getSearchFieldList().get(i) + "=" + dragTableVo.getConditionDefaultValueMap().get(searchFieldList.get(i));
|
|
|
}
|
|
|
break;
|
|
|
case "DM":
|
|
|
case "SQLSERVER":
|
|
|
SQL += SQL_START;
|
|
|
- for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
- SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
|
|
|
- SQL += dragTableVo.getSearchFieldList().size() - 1 == i ? ",'')" : ",\n";
|
|
|
+ for (int i = 0; searchFieldList.size() > i; i++) {
|
|
|
+ SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
|
|
|
+ SQL += searchFieldList.size() - 1 == i ? ",'')" : ",\n";
|
|
|
}
|
|
|
break;
|
|
|
case "ORACLE":
|
|
|
//SQL_START = "";
|
|
|
- for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
|
|
|
+ for (int i = 0; searchFieldList.size() > i; i++) {
|
|
|
SQL += dragTableVo.getSearchFieldList().get(i);
|
|
|
- SQL += (dragTableVo.getSearchFieldList().size() - 1 == i ? " " : "||");
|
|
|
+ SQL += (searchFieldList.size() - 1 == i ? " " : "||");
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -297,13 +310,19 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
tableSqlMapper.updateTableSqlBySqlKey(tableSql);
|
|
|
//add drag_table_condition
|
|
|
if (dragTableVo.getSearchFieldList().size() > 0) {
|
|
|
- List<DragTableCondition> dragTableConditionList = new ArrayList<>();
|
|
|
- dragTableVo.getSearchFieldList().forEach(item -> {
|
|
|
- dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item,dragTableVo.getConditionDefaultValueMap().get(item).toString()));
|
|
|
+ // delete
|
|
|
+ dragTableConditionMapper.deleteDragTableConditionBytIds(Collections.singletonList(dragTableVo.gettId()));
|
|
|
+ dragTableVo.getConditionDefaultValueMap().keySet().forEach(item -> {
|
|
|
+ dragTableVo.getSearchFieldList().add(
|
|
|
+ new DragTableCondition(
|
|
|
+ dragTable.gettId(), "默认查询", item, "DefaultQuery", dragTableVo.getConditionDefaultValueMap().get(item).toString()));
|
|
|
});
|
|
|
- dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
|
|
|
- }
|
|
|
- //修改按钮信息
|
|
|
+ // 批量更新
|
|
|
+ dragTableVo.getSearchFieldList().forEach(item -> {
|
|
|
+ item.settId(dragTable.gettId());
|
|
|
+ dragTableConditionMapper.insertDragTableConditionOne(item);
|
|
|
+ });
|
|
|
+ } //修改按钮信息
|
|
|
dragTableBtnRelevanceService.updateDragTableBtnRelevance(dragTableVo);
|
|
|
});
|
|
|
}
|
|
@@ -322,12 +341,11 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public int deleteDragTableGroupByIds(Long[] ids)
|
|
|
- {
|
|
|
+ public int deleteDragTableGroupByIds(Long[] ids) {
|
|
|
//表格数据
|
|
|
List<String> tableKeys = new ArrayList<>();
|
|
|
//删除条件数据
|
|
|
- List<Long> dragTableIds =new ArrayList<>();
|
|
|
+ List<Long> dragTableIds = new ArrayList<>();
|
|
|
for (Long id : ids) {
|
|
|
//根据id查询表格组信息
|
|
|
DragTableGroup dragTableGroupOne = dragTableGroupMapper.selectDragTableGroupById(id);
|
|
@@ -336,11 +354,11 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
//把他转换成Map对象
|
|
|
JSONArray jsonArray = JSON.parseArray(groupTableInfo);
|
|
|
//收集tableKey
|
|
|
- jsonArray.stream().forEach(item->
|
|
|
+ jsonArray.stream().forEach(item ->
|
|
|
tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
|
|
|
//删除条件数据
|
|
|
dragTableMapper.selectDragTableTableKeys(tableKeys)
|
|
|
- .stream().forEach(item ->dragTableIds.add(item.gettId()));
|
|
|
+ .stream().forEach(item -> dragTableIds.add(item.gettId()));
|
|
|
}
|
|
|
//删除表格数据
|
|
|
dragTableMapper.deleteDragTableByTableKeys(tableKeys);
|
|
@@ -356,6 +374,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
|
|
|
/**
|
|
|
* 根据表格组key查询表格组信息
|
|
|
+ *
|
|
|
* @param groupKey
|
|
|
* @return
|
|
|
*/
|
|
@@ -367,6 +386,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
|
|
|
/**
|
|
|
* 查询表格组包含的详细信息
|
|
|
+ *
|
|
|
* @param dragTableGroup
|
|
|
* @return
|
|
|
*/
|
|
@@ -382,8 +402,10 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
dragTableList.stream().map(item -> {
|
|
|
//拿到这个表格的所有条件数据
|
|
|
List<DragTableCondition> dragTableConditions = dragTableConditionMapper.selectDragTableConditionByTid(item.gettId());
|
|
|
+// // 得到所有的查询条件
|
|
|
+// List<DragTableCondition> SearchFieldList = dragTableConditions.stream().map(it -> it.getConditionField()).collect(Collectors.toList());
|
|
|
//条件
|
|
|
- item.setSearchFieldList(dragTableConditions.stream().map(it->it.getConditionField()).collect(Collectors.toList()));
|
|
|
+ item.setSearchFieldList(dragTableConditions);
|
|
|
//绑定的默认值map
|
|
|
HashMap<String, Object> conditionDefaultValueMap = new HashMap<>();
|
|
|
//关联条件
|
|
@@ -396,17 +418,17 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
});
|
|
|
//排序字段
|
|
|
TableSql tableSql = tableSqlMapper.selectTableSqlByTSqlKey(item.getSqlKey());
|
|
|
- if(tableSql!=null){
|
|
|
+ if (tableSql != null) {
|
|
|
item.setOrderByColumn(tableSql.getOrderByColumn());
|
|
|
item.setSortOrder(tableSql.getSortOrder());
|
|
|
}
|
|
|
return item;
|
|
|
}).collect(Collectors.toList());
|
|
|
- DragTableGroupVo dragTableGroupVo=new DragTableGroupVo();
|
|
|
+ DragTableGroupVo dragTableGroupVo = new DragTableGroupVo();
|
|
|
BeanUtils.copyProperties(dragTableGroupOne, dragTableGroupVo);
|
|
|
dragTableGroupVo.setDragTables(dragTableList);
|
|
|
//查询表格的关联数据
|
|
|
- return dragTableGroupVo;
|
|
|
+ return dragTableGroupVo;
|
|
|
}
|
|
|
|
|
|
private List<DragTableVo> getDragTableVos(String groupTableInfo) {
|
|
@@ -420,14 +442,14 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
)
|
|
|
).collect(Collectors.toCollection(JSONArray::new));
|
|
|
//把查询出来的动态表格数据放到一个集合里边
|
|
|
- List<DragTableVo> dragTableList=new ArrayList<>();
|
|
|
- sortArray.forEach(e->{
|
|
|
+ List<DragTableVo> dragTableList = new ArrayList<>();
|
|
|
+ sortArray.forEach(e -> {
|
|
|
JSONObject jsonObject = JSON.parseObject(e.toString());
|
|
|
String str = jsonObject.get("tableKey").toString();
|
|
|
DragTable dragTable = dragTableMapper.selectDragTableByTableKey(str);
|
|
|
- DragTableVo dragTableVo=new DragTableVo();
|
|
|
+ DragTableVo dragTableVo = new DragTableVo();
|
|
|
BeanUtils.copyProperties(dragTable, dragTableVo);
|
|
|
- dragTableList.add( dragTableVo);
|
|
|
+ dragTableList.add(dragTableVo);
|
|
|
});
|
|
|
return dragTableList;
|
|
|
}
|
|
@@ -438,26 +460,27 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
@Override
|
|
|
public Boolean selectDragTableGroupTableListSize(Long[] ids) {
|
|
|
List<DragTableGroup> dragTableGroups = dragTableGroupMapper.selectDragTableGroupByIdIn(ids);
|
|
|
- List<String> tableKeys=new ArrayList<>();
|
|
|
+ List<String> tableKeys = new ArrayList<>();
|
|
|
//收集这个组下的所有tableKey
|
|
|
- dragTableGroups.stream().forEach(item->{
|
|
|
+ dragTableGroups.stream().forEach(item -> {
|
|
|
JSONArray jsonArray = JSON.parseArray(item.getGroupTableInfo());
|
|
|
jsonArray.stream().forEach(
|
|
|
- it ->{
|
|
|
- tableKeys.add( JSONObject.parseObject(it.toString()).get("tableKey").toString());
|
|
|
+ it -> {
|
|
|
+ tableKeys.add(JSONObject.parseObject(it.toString()).get("tableKey").toString());
|
|
|
}
|
|
|
);
|
|
|
});
|
|
|
//判断tableKey在表格表中出现了吗
|
|
|
List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeys(tableKeys);
|
|
|
- if(dragTableVos.size()>0){
|
|
|
- return false;
|
|
|
+ if (dragTableVos.size() > 0) {
|
|
|
+ return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 工艺工序弹窗里边的表格结构信息
|
|
|
+ *
|
|
|
* @param commonEntity
|
|
|
* @return
|
|
|
*/
|
|
@@ -467,7 +490,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
//查询组信息
|
|
|
DragTableGroup dragTableGroup = dragTableGroupMapper.selectDragTableGroupOneByGroupKey(groupKey);
|
|
|
//把[{"tableKey":"a1","sort":0},{"tableKey":"a2","sort":1}]转换成Map对象
|
|
|
- JSONArray jsonArray = JSON.parseArray( dragTableGroup.getGroupTableInfo());
|
|
|
+ JSONArray jsonArray = JSON.parseArray(dragTableGroup.getGroupTableInfo());
|
|
|
//排序确保表格的顺序
|
|
|
JSONArray sortArray = jsonArray.stream().sorted(
|
|
|
Comparator.comparingLong(
|
|
@@ -477,24 +500,24 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
).collect(Collectors.toCollection(JSONArray::new));
|
|
|
//用in查询
|
|
|
List<String> tableKeys = new ArrayList<>();
|
|
|
- sortArray.stream().forEach(item->tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
|
|
|
+ sortArray.stream().forEach(item -> tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
|
|
|
//查询表格信息
|
|
|
List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeysOrderby(tableKeys);
|
|
|
//存条件的数组
|
|
|
- List<String> conditionCollectString=new ArrayList<>();
|
|
|
+ List<String> conditionCollectString = new ArrayList<>();
|
|
|
//查询表格按钮信息
|
|
|
- dragTableVos.forEach(item->{
|
|
|
+ dragTableVos.forEach(item -> {
|
|
|
// 动态表格按钮信息
|
|
|
//根据tableKey获取根节点信息
|
|
|
List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(item.getTableKey());
|
|
|
//获取根节点数据
|
|
|
- if(btnKeys.size() > 0){
|
|
|
+ if (btnKeys.size() > 0) {
|
|
|
List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnListByBtnKey(btnKeys);
|
|
|
//查询子节点
|
|
|
List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
|
|
|
- if (ids.isEmpty()){
|
|
|
+ if (ids.isEmpty()) {
|
|
|
item.setDragTableBtnList(rootNodes);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
|
|
|
List<DragTableBtn> btnList = rootNodes.stream().peek(
|
|
|
root -> root.setChildren(getChildrenList(root, childNodes))
|
|
@@ -505,23 +528,24 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
//根据动态表格查询条件信息
|
|
|
List<DragTableCondition> dragTableConditions = dragTableConditionMapper.selectDragTableConditionByTid(item.gettId());
|
|
|
//拿到条件
|
|
|
- List<String> conditionCollect= dragTableConditions.stream().map(condition -> condition.getConditionDefaultValue()).collect(Collectors.toList());
|
|
|
+ List<String> conditionCollect = dragTableConditions.stream().map(condition -> condition.getConditionDefaultValue()).collect(Collectors.toList());
|
|
|
//添加所有集合到大条件中
|
|
|
conditionCollectString.addAll(conditionCollect);
|
|
|
});
|
|
|
//数组集合去重
|
|
|
- List<String> distinctCondition = conditionCollectString.stream().distinct().collect(Collectors.toList());
|
|
|
- CommonEntity common=new CommonEntity();
|
|
|
+ List<String> distinctCondition = conditionCollectString.stream().distinct().collect(Collectors.toList());
|
|
|
+ CommonEntity common = new CommonEntity();
|
|
|
//模版结果Map
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
- resultMap.put("template",dragTableVos);
|
|
|
- resultMap.put("condition",distinctCondition);
|
|
|
+ resultMap.put("template", dragTableVos);
|
|
|
+ resultMap.put("condition", distinctCondition);
|
|
|
common.setResultMap(resultMap);
|
|
|
- return common;
|
|
|
+ return common;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 工艺工序弹窗里边的表格数据信息
|
|
|
+ *
|
|
|
* @param commonEntity
|
|
|
* @return
|
|
|
*/
|
|
@@ -534,15 +558,15 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
//查询出来的表信息
|
|
|
List<DragTableVo> dragTableVos = getDragTableVos(groupTableInfo);
|
|
|
//根据sqlKey查询TableSql数据
|
|
|
- CommonEntity common=new CommonEntity();
|
|
|
- List<List<CommonEntity>> commonEntityList=new ArrayList<>();
|
|
|
- dragTableVos.forEach(item->{
|
|
|
+ CommonEntity common = new CommonEntity();
|
|
|
+ List<List<CommonEntity>> commonEntityList = new ArrayList<>();
|
|
|
+ dragTableVos.forEach(item -> {
|
|
|
TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(item.getSqlKey());
|
|
|
//sql的条件值
|
|
|
- AtomicReference<String> tableSqlTableCondition= new AtomicReference<>(tableSql.getTableCondition());
|
|
|
+ AtomicReference<String> tableSqlTableCondition = new AtomicReference<>(tableSql.getTableCondition());
|
|
|
//循环替换条件占位的值
|
|
|
- commonEntity.getQueryMap().forEach((k,v)->{
|
|
|
- tableSqlTableCondition.set(tableSqlTableCondition.get().replace(k, "'"+v.toString()+"'"));
|
|
|
+ commonEntity.getQueryMap().forEach((k, v) -> {
|
|
|
+ tableSqlTableCondition.set(tableSqlTableCondition.get().replace(k, "'" + v.toString() + "'"));
|
|
|
});
|
|
|
//sql的执行语句
|
|
|
String sqlString = tableSql.getTableSql() + " where " + tableSqlTableCondition.get();
|
|
@@ -552,7 +576,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
|
|
|
});
|
|
|
//结果Map
|
|
|
HashMap hashMap = new HashMap();
|
|
|
- hashMap.put("result",commonEntityList);
|
|
|
+ hashMap.put("result", commonEntityList);
|
|
|
common.setResultMap(hashMap);
|
|
|
return common;
|
|
|
}
|