2018-06-26 18:33
@Before({POST.class})
public void importStrategy() {
UploadFile uf = this.getFile("file");
File file = uf.getFile();
Modelmodel = FileUtil.convertObject(file, Model.class);
final Strategy[] stas = model.getTs();
boolean tx = Db.tx(new IAtom() {
@Override
public boolean run() throws SQLException {
try {
Db.update("truncate table test");
int i = 1/0;
Db.batchSave(Arrays.asList(stas), Integer.MAX_VALUE);
} catch (Exception e) {
return false;
}
return true;
}
});
if (!tx) {
renderJson(false, "文件导入出错!");
return;
}
renderJson(true, "导入告警规则成功");
}
以上是代码,不好意思没有找到哪里有工具栏