@@ -2,6 +2,7 @@ package cc.smtweb.framework.core.db.cache; | |||||
import cc.smtweb.framework.core.annotation.SwCache; | import cc.smtweb.framework.core.annotation.SwCache; | ||||
import cc.smtweb.framework.core.cache.AbstractCache; | import cc.smtweb.framework.core.cache.AbstractCache; | ||||
import cc.smtweb.framework.core.common.SwConsts; | |||||
import cc.smtweb.framework.core.db.DbEngine; | import cc.smtweb.framework.core.db.DbEngine; | ||||
import cc.smtweb.framework.core.db.EntityDao; | import cc.smtweb.framework.core.db.EntityDao; | ||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | import cc.smtweb.framework.core.db.impl.DefaultEntity; | ||||
@@ -38,10 +39,10 @@ public class EntityCache extends AbstractCache<DefaultEntity> { | |||||
String ret = ""; | String ret = ""; | ||||
for (String s : StringUtils.split(cache.getFields(), ",")) { | for (String s : StringUtils.split(cache.getFields(), ",")) { | ||||
if (StringUtils.isNotEmpty(s)) { | if (StringUtils.isNotEmpty(s)) { | ||||
ret += "_" + bean.getStr(s); | |||||
ret += SwConsts.SPLIT_CHAR + bean.getStr(s); | |||||
} | } | ||||
} | } | ||||
return ret; | |||||
return ret.substring(1); | |||||
}; | }; | ||||
if (cache.isMapType()) { | if (cache.isMapType()) { | ||||
regMap(cache.getName(), key); | regMap(cache.getName(), key); | ||||
@@ -313,6 +313,7 @@ public abstract class AbstractEntityDao<T> { | |||||
} | } | ||||
public Object readValue(T obj, String fieldName) { | public Object readValue(T obj, String fieldName) { | ||||
if (obj == null) return null; | |||||
EntityColumn beanColumn = getBeanColumn(fieldName); | EntityColumn beanColumn = getBeanColumn(fieldName); | ||||
return beanColumn.readValue(obj); | return beanColumn.readValue(obj); | ||||
@@ -91,7 +91,11 @@ public class DefaultListHandler<T extends DefaultEntity> extends AbstractListHan | |||||
String sn = (String) dao.readValue(b, l.getLinkNameField()); | String sn = (String) dao.readValue(b, l.getLinkNameField()); | ||||
if (StringUtils.isNotEmpty(sn)) names += "," + sn; | if (StringUtils.isNotEmpty(sn)) names += "," + sn; | ||||
} | } | ||||
row.put(l.getFieldName() + "_text", names.substring(1)); | |||||
if (StringUtils.isNotEmpty(names)) { | |||||
row.put(l.getFieldName() + "_text", names.substring(1)); | |||||
} else { | |||||
row.put(l.getFieldName() + "_text", ""); | |||||
} | |||||
} else { | } else { | ||||
List<String> list = mapIds.computeIfAbsent(l.getLinkTable().getName(), k -> new ArrayList<>()); | List<String> list = mapIds.computeIfAbsent(l.getLinkTable().getName(), k -> new ArrayList<>()); | ||||
Collections.addAll(list, ids); | Collections.addAll(list, ids); | ||||