mirror of
https://gitee.com/liweiyi/ChestnutCMS.git
synced 2025-12-07 00:48:23 +08:00
bug fixed
This commit is contained in:
parent
0274696789
commit
ce9423cbef
@ -16,6 +16,7 @@
|
|||||||
package com.chestnut.exmodel.service;
|
package com.chestnut.exmodel.service;
|
||||||
|
|
||||||
import com.chestnut.common.utils.NumberUtils;
|
import com.chestnut.common.utils.NumberUtils;
|
||||||
|
import com.chestnut.common.utils.ObjectUtils;
|
||||||
import com.chestnut.contentcore.domain.CmsCatalog;
|
import com.chestnut.contentcore.domain.CmsCatalog;
|
||||||
import com.chestnut.contentcore.domain.CmsContent;
|
import com.chestnut.contentcore.domain.CmsContent;
|
||||||
import com.chestnut.contentcore.service.ICatalogService;
|
import com.chestnut.contentcore.service.ICatalogService;
|
||||||
@ -79,8 +80,8 @@ public class ExModelService {
|
|||||||
List<XModelFieldDataDTO> list = new ArrayList<>();
|
List<XModelFieldDataDTO> list = new ArrayList<>();
|
||||||
metaModel.getFields().forEach(f -> {
|
metaModel.getFields().forEach(f -> {
|
||||||
Object fv = data.get(f.getCode());
|
Object fv = data.get(f.getCode());
|
||||||
if(Objects.isNull(fv) || fv.toString().isEmpty()) {
|
if(Objects.isNull(fv)) {
|
||||||
fv = f.getDefaultValue();
|
fv = ObjectUtils.nonNullOrElseAsString(f.getDefaultValue(), Object::toString);
|
||||||
}
|
}
|
||||||
XModelFieldDataDTO dto = XModelFieldDataDTO.newInstance(f, fv);
|
XModelFieldDataDTO dto = XModelFieldDataDTO.newInstance(f, fv);
|
||||||
list.add(dto);
|
list.add(dto);
|
||||||
|
|||||||
@ -209,10 +209,13 @@ public class ModelDataServiceImpl implements IModelDataService {
|
|||||||
sqlBuilder.eq(pkField.getFieldName(), pkValues.get(pkField.getCode()));
|
sqlBuilder.eq(pkField.getFieldName(), pkValues.get(pkField.getCode()));
|
||||||
}
|
}
|
||||||
Map<String, Object> map = sqlBuilder.selectOne();
|
Map<String, Object> map = sqlBuilder.selectOne();
|
||||||
if (map == null) {
|
|
||||||
return Map.of();
|
|
||||||
}
|
|
||||||
Map<String, Object> dataMap = new HashMap<>();
|
Map<String, Object> dataMap = new HashMap<>();
|
||||||
|
if (map == null) {
|
||||||
|
model.getFields().forEach(f -> {
|
||||||
|
dataMap.put(f.getCode(), getControlType(f.getControlType()).stringAsValue(StringUtils.EMPTY));
|
||||||
|
});
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
// 固定字段
|
// 固定字段
|
||||||
mmt.getFixedFields().forEach(f -> {
|
mmt.getFixedFields().forEach(f -> {
|
||||||
Object v = map.get(f.getFieldName());
|
Object v = map.get(f.getFieldName());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user