|
@@ -17,7 +17,6 @@ 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.domain.GenTableRelation;
|
|
import com.boman.system.api.RemoteDictDataService;
|
|
import com.boman.system.api.RemoteDictDataService;
|
|
-import com.boman.web.core.constant.DictConstant;
|
|
|
|
import com.boman.web.core.constant.FormDataConstant;
|
|
import com.boman.web.core.constant.FormDataConstant;
|
|
import com.boman.web.core.constant.SubmitConstant;
|
|
import com.boman.web.core.constant.SubmitConstant;
|
|
import com.boman.web.core.domain.*;
|
|
import com.boman.web.core.domain.*;
|
|
@@ -68,7 +67,7 @@ public class TableServiceCmdService {
|
|
@Resource
|
|
@Resource
|
|
private RestTemplate restTemplate;
|
|
private RestTemplate restTemplate;
|
|
@Resource
|
|
@Resource
|
|
- private RemoteDictDataService dictTypeService;
|
|
|
|
|
|
+ private RemoteDictDataService remoteDictDataService;
|
|
@Resource
|
|
@Resource
|
|
private RemoteGenTableService remoteGenTableService;
|
|
private RemoteGenTableService remoteGenTableService;
|
|
|
|
|
|
@@ -91,15 +90,10 @@ public class TableServiceCmdService {
|
|
String pkName = IdUtils.getPkName(columns);
|
|
String pkName = IdUtils.getPkName(columns);
|
|
requireNonNull(pkName, "主键名称为空");
|
|
requireNonNull(pkName, "主键名称为空");
|
|
|
|
|
|
- //
|
|
|
|
- List<String> allColumnNameList = columns.stream()
|
|
|
|
- .map(GenTableColumn::getColumnName)
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
// 新增
|
|
// 新增
|
|
if (ObjectUtils.ltZero(baseTableDTO.getObjId())) {
|
|
if (ObjectUtils.ltZero(baseTableDTO.getObjId())) {
|
|
Long maxId = IdUtils.getMaxId(baseTableDTO.getTable(), pkName);
|
|
Long maxId = IdUtils.getMaxId(baseTableDTO.getTable(), pkName);
|
|
- RowResult rowResult = saveService.insertRow(context.getRealTableName(), pkName, maxId, context.getRows().get(0), allColumnNameList);
|
|
|
|
|
|
+ RowResult rowResult = saveService.insertRow(context.getRealTableName(), pkName, maxId, context.getRows().get(0), columns);
|
|
if (RowResult.checkSuccess(rowResult)) {
|
|
if (RowResult.checkSuccess(rowResult)) {
|
|
LOGGER.info("保存成功,封装到数据库的数据为: {}", JSON.toJSONString(rowResult.getData()));
|
|
LOGGER.info("保存成功,封装到数据库的数据为: {}", JSON.toJSONString(rowResult.getData()));
|
|
} else {
|
|
} else {
|
|
@@ -318,7 +312,7 @@ public class TableServiceCmdService {
|
|
if (GenTableColumn.IS_QUERY.equalsIgnoreCase(column.getIsQuery())) {
|
|
if (GenTableColumn.IS_QUERY.equalsIgnoreCase(column.getIsQuery())) {
|
|
String dictType = column.getDictType();
|
|
String dictType = column.getDictType();
|
|
if (ObjectUtils.isNotEmpty(dictType)) {
|
|
if (ObjectUtils.isNotEmpty(dictType)) {
|
|
- List<SysDictData> sysDictData1 = dictTypeService.listByType(dictType);
|
|
|
|
|
|
+ List<SysDictData> sysDictData1 = remoteDictDataService.listByType(dictType);
|
|
column.setSysDictData(sysDictData1);
|
|
column.setSysDictData(sysDictData1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -519,7 +513,7 @@ public class TableServiceCmdService {
|
|
GenTable genTable = redisService.getCacheObject(key);
|
|
GenTable genTable = redisService.getCacheObject(key);
|
|
if (ObjectUtils.isEmpty(genTable)) {
|
|
if (ObjectUtils.isEmpty(genTable)) {
|
|
genTable = remoteGenTableService.getByTableName(tableName);
|
|
genTable = remoteGenTableService.getByTableName(tableName);
|
|
- requireNonNull(genTable, "未找到表对应的信息");
|
|
|
|
|
|
+ requireNonNull(genTable, "数据库中,未找到表对应的信息");
|
|
// {@link com.boman.gen.controller.MyController.packTableAndInsertToRedis} 失效时间
|
|
// {@link com.boman.gen.controller.MyController.packTableAndInsertToRedis} 失效时间
|
|
redisService.setCacheObject(key, genTable, 12L, TimeUnit.DAYS);
|
|
redisService.setCacheObject(key, genTable, 12L, TimeUnit.DAYS);
|
|
}
|
|
}
|
|
@@ -544,7 +538,7 @@ public class TableServiceCmdService {
|
|
for (GenTableColumn column : columns) {
|
|
for (GenTableColumn column : columns) {
|
|
String dictType = column.getDictType();
|
|
String dictType = column.getDictType();
|
|
if (ObjectUtils.isNotEmpty(dictType)) {
|
|
if (ObjectUtils.isNotEmpty(dictType)) {
|
|
- List<SysDictData> sysDictData1 = dictTypeService.listByType(dictType);
|
|
|
|
|
|
+ List<SysDictData> sysDictData1 = remoteDictDataService.listByType(dictType);
|
|
column.setSysDictData(sysDictData1);
|
|
column.setSysDictData(sysDictData1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -552,19 +546,5 @@ public class TableServiceCmdService {
|
|
return AjaxResult.success(genTable);
|
|
return AjaxResult.success(genTable);
|
|
}
|
|
}
|
|
|
|
|
|
- public List<JSONObject> coverSysDictDataToJSONObject(List<SysDictData> sysDictData) {
|
|
|
|
- List<JSONObject> result = Lists.newArrayListWithCapacity(sysDictData.size());
|
|
|
|
- for (SysDictData data : sysDictData) {
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
- String dictLabel = data.getDictLabel();
|
|
|
|
- String dictValue = data.getDictValue();
|
|
|
|
- jsonObject.put(DictConstant.DICT_LABEL, dictLabel);
|
|
|
|
- jsonObject.put(DictConstant.DICT_VALUE, dictValue);
|
|
|
|
- result.add(jsonObject);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|