提交 9abe7c74 authored 作者: 黄夏豪's avatar 黄夏豪

修复bug

上级 4c542921
......@@ -249,6 +249,7 @@ public class ModelImpl implements ModelService {
@Override
public int putValueByEntityNameList(List<Map<String, Object>> mapList) {
SessionImpl session = (SessionImpl)sessionUtil.getSession();
session.getTransaction().begin();
for (Map<String, Object> map : mapList) {
for (String tableName :
map.keySet()) {
......@@ -277,17 +278,14 @@ public class ModelImpl implements ModelService {
insertValue(tableInfo.getModelName(), (Map) valuesList.get(i),session);
}
}
session.saveOrUpdate(tableName, map);
} else {
return 1;
}
}
}
session.getTransaction().begin();
session.getTransaction().commit();
session.close();
return 0;
}
......@@ -310,8 +308,12 @@ public class ModelImpl implements ModelService {
//先将Type转为java类
if (propertyType instanceof TimestampType) {
try {
Date parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse((String) value);
map.put(propertyNames[i], parse);
if (value instanceof String){
if (StringUtils.isNotEmpty((String)value)){
Date parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse((String) value);
map.put(propertyNames[i], parse);
}
}
} catch (ParseException e) {
e.printStackTrace();
}
......@@ -327,7 +329,7 @@ public class ModelImpl implements ModelService {
map.put(propertyNames[i], value);
}
}
session.saveOrUpdate(tableName, map);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论