|
@@ -93,8 +93,6 @@ public class TableServiceCmdService {
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
|
|
|
|
|
|
public final AjaxResult objectSave(FormDataDto dto) {
|
|
|
- AjaxResult result = AjaxResult.success();
|
|
|
-
|
|
|
// 权限校验在此方法中
|
|
|
TableContext context = tableContext.createContext(dto);
|
|
|
// 拿到pkName和maxId
|
|
@@ -107,12 +105,14 @@ public class TableServiceCmdService {
|
|
|
// 处理输入类型
|
|
|
handlerInputType(commitData, context.getColumns());
|
|
|
|
|
|
+ AjaxResult result;
|
|
|
// 新增
|
|
|
if (ActionType.INSERT.equals(context.getActionType())) {
|
|
|
Integer maxId = IdUtils.getMaxId(dto.getTable(), pkName);
|
|
|
RowResult rowResult = saveService.insertRow(context, maxId);
|
|
|
if (RowResult.checkSuccess(rowResult)) {
|
|
|
LOGGER.info("保存成功,封装到数据库的数据为: {}", JSON.toJSONString(rowResult.getData()));
|
|
|
+ result = AjaxResult.success(maxId);
|
|
|
} else {
|
|
|
LOGGER.error("保存失败,保持的原始数据为: {}", JSON.toJSONString(dto));
|
|
|
result = AjaxResult.error();
|
|
@@ -122,6 +122,7 @@ public class TableServiceCmdService {
|
|
|
int effective = updateService.updateByIdList(context, Collections.singletonList(context.getId()));
|
|
|
if (effective > 0) {
|
|
|
LOGGER.info("修改成功,封装到数据库的数据为: {}", JSON.toJSONString(commitData));
|
|
|
+ result = AjaxResult.success(context.getId());
|
|
|
} else {
|
|
|
LOGGER.error("修改失败,前台传来的原始数据为: {}", JSON.toJSONString(commitData));
|
|
|
result = AjaxResult.error();
|
|
@@ -494,7 +495,8 @@ public class TableServiceCmdService {
|
|
|
*/
|
|
|
public String getButton(String tableName) {
|
|
|
GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
|
|
|
- return Strings.nullToEmpty(genTable.getMenuRole());
|
|
|
+ List<String> btns = buildBtnList(genTable.getTableName());
|
|
|
+ return Strings.nullToEmpty(CollectionUtils.listToString(btns));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -681,30 +683,32 @@ public class TableServiceCmdService {
|
|
|
String tableName = genTable.getTableName();
|
|
|
List<GenTableColumn> allColumns = genTable.getColumns();
|
|
|
List<GenTableColumn> resultCols;
|
|
|
- List<GenTableColumn> parentColumns = filterHrAndSort(allColumns);
|
|
|
// 所有新增可见的列
|
|
|
allColumns = filterData(allColumns, 0, MaskConstant.INSERT_VISIBLE::equals);
|
|
|
// 带折叠
|
|
|
if (BooleanUtils.isTrue(isUi)) {
|
|
|
+ List<GenTableColumn> parentColumns = filterHrAndSort(allColumns);
|
|
|
// 把孩子放入父亲的怀抱
|
|
|
for (GenTableColumn hrColumn : parentColumns) {
|
|
|
List<GenTableColumn> children = Lists.newArrayListWithCapacity(16);
|
|
|
for (GenTableColumn column : allColumns) {
|
|
|
if (hrColumn.getId().equals(column.getHrParentId())) {
|
|
|
children.add(column);
|
|
|
+ String extend = column.getExtendedAttributes();
|
|
|
+ if (isNotEmpty(extend)) {
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(extend);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
hrColumn.setHrChildren(children);
|
|
|
}
|
|
|
|
|
|
- // 把孩子对应的字典值放进去
|
|
|
- for (GenTableColumn hrColumn : parentColumns) {
|
|
|
- packDictDataToColumns(hrColumn.getHrChildren(), ObjectUtils::isNotEmpty);
|
|
|
- }
|
|
|
resultCols = parentColumns;
|
|
|
} else {
|
|
|
// 不带折叠
|
|
|
- packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
|
|
|
+ // packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
|
|
|
resultCols = allColumns;
|
|
|
}
|
|
|
|