|
@@ -11,8 +11,9 @@ import com.boman.common.redis.service.RedisService;
|
|
import com.boman.gen.controller.MyController;
|
|
import com.boman.gen.controller.MyController;
|
|
import com.boman.gen.domain.GenTable;
|
|
import com.boman.gen.domain.GenTable;
|
|
import com.boman.gen.domain.GenTableColumn;
|
|
import com.boman.gen.domain.GenTableColumn;
|
|
|
|
+import com.boman.gen.domain.GenTableRelation;
|
|
|
|
+import com.boman.gen.service.IGenTableColumnService;
|
|
import com.boman.system.domain.SysDictData;
|
|
import com.boman.system.domain.SysDictData;
|
|
-import com.boman.system.mapper.StandardlyMapper;
|
|
|
|
import com.boman.system.service.*;
|
|
import com.boman.system.service.*;
|
|
import com.boman.system.utils.IdUtils;
|
|
import com.boman.system.utils.IdUtils;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
@@ -54,6 +55,8 @@ public class TableServiceCmdService {
|
|
private RestTemplate restTemplate;
|
|
private RestTemplate restTemplate;
|
|
@Resource
|
|
@Resource
|
|
private ISysDictTypeService dictTypeService;
|
|
private ISysDictTypeService dictTypeService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IGenTableColumnService tableColumnService;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
|
|
|
|
|
|
@@ -264,6 +267,12 @@ public class TableServiceCmdService {
|
|
ArrayList<GenTableColumn> queryList = Lists.newArrayListWithCapacity(16);
|
|
ArrayList<GenTableColumn> queryList = Lists.newArrayListWithCapacity(16);
|
|
for (GenTableColumn column : columns) {
|
|
for (GenTableColumn column : columns) {
|
|
if (GenTableColumn.IS_QUERY.equalsIgnoreCase(column.getIsQuery())) {
|
|
if (GenTableColumn.IS_QUERY.equalsIgnoreCase(column.getIsQuery())) {
|
|
|
|
+ String dictType = column.getDictType();
|
|
|
|
+ if (ObjectUtils.isNotEmpty(dictType)) {
|
|
|
|
+ List<SysDictData> sysDictData1 = dictTypeService.selectDictDataByType(dictType);
|
|
|
|
+ column.setSysDictData(coverSysDictDataToJSONObject(sysDictData1));
|
|
|
|
+ }
|
|
|
|
+
|
|
queryList.add(column);
|
|
queryList.add(column);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -280,21 +289,6 @@ public class TableServiceCmdService {
|
|
return AjaxResult.success(jsonObject);
|
|
return AjaxResult.success(jsonObject);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 功能描述: 封装查询条件,在拼sql的时候按照此规则去取值
|
|
|
|
- * {@link StandardlyMapper.SqlProvider#selectByCondition(java.util.Map)}
|
|
|
|
- *
|
|
|
|
- * @param value 查询的值
|
|
|
|
- * @param queryType queryType
|
|
|
|
- * @param columnType columnType
|
|
|
|
- * @return java.lang.String
|
|
|
|
- */
|
|
|
|
- public String packValue(String value, String queryType, String columnType) {
|
|
|
|
- requireNonNull(value);
|
|
|
|
- requireNonNull(queryType);
|
|
|
|
- return value + "_" + queryType + "_" + columnType;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 功能描述: 获取表单子表
|
|
* 功能描述: 获取表单子表
|
|
*
|
|
*
|
|
@@ -307,9 +301,13 @@ public class TableServiceCmdService {
|
|
List<GenTable> childTableList = genTable.getRelationList();
|
|
List<GenTable> childTableList = genTable.getRelationList();
|
|
// 此表没有关联子表,查啥查
|
|
// 此表没有关联子表,查啥查
|
|
requireNonNull(childTableList);
|
|
requireNonNull(childTableList);
|
|
-
|
|
|
|
|
|
+ // todo
|
|
for (GenTable childTable : childTableList) {
|
|
for (GenTable childTable : childTableList) {
|
|
String childTableName = childTable.getTableName();
|
|
String childTableName = childTable.getTableName();
|
|
|
|
+ Long childTableTableId = childTable.getTableId();
|
|
|
|
+ List<GenTableColumn> childColumns = childTable.getColumns();
|
|
|
|
+ // column_name = 先根据tableName查到id,再用id到relation中查到relation_child_id, 在用这个值去到tableColumn中查到column_name
|
|
|
|
+ // select * from childTableName where column_name = objId
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -318,6 +316,27 @@ public class TableServiceCmdService {
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public String getChildColumnNameByParentTableName(GenTable parentGenTable, Long childTableTableId){
|
|
|
|
+ requireNonNull(parentGenTable.getTableName(), "主表名称为空");
|
|
|
|
+// GenTable primaryTable = redisService.getCacheObject(RedisKey.TABLE_INFO + genTable.getTableName());
|
|
|
|
+ Long parentTableId = parentGenTable.getTableId();
|
|
|
|
+ List<GenTableRelation> relations = redisService.getCacheObject(RedisKey.RELATION_INFO);
|
|
|
|
+ relations = relations.stream()
|
|
|
|
+ .filter(relation -> relation.getRelationParentId().equals(parentTableId))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ for (GenTableRelation relation : relations) {
|
|
|
|
+ if (relation.getRelationChildId().equals(6L)) {
|
|
|
|
+ tableColumnService.selectGenTableColumnListByTableId(childTableTableId);
|
|
|
|
+// return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return "";
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 功能描述: 表单提交接口
|
|
* 功能描述: 表单提交接口
|
|
*
|
|
*
|