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

修复bug

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