解决多个更新语句一起执行失败的问题
This commit is contained in:
parent
f4cf9e376e
commit
4bff204397
|
@ -4,19 +4,28 @@ import kd.bos.db.DB;
|
||||||
import kd.bos.db.DBRoute;
|
import kd.bos.db.DBRoute;
|
||||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
|
||||||
public class TestDBFormPlugin extends AbstractFormPlugin {
|
public class TestDBFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(TestDBFormPlugin.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterDoOperation(AfterDoOperationEventArgs e) {
|
public void afterDoOperation(AfterDoOperationEventArgs e) {
|
||||||
super.afterDoOperation(e);
|
super.afterDoOperation(e);
|
||||||
if("qeug_btnok".equals(e.getOperateKey())){
|
if("qeug_btnok".equals(e.getOperateKey())){
|
||||||
String dbnum = (String) this.getModel().getValue("qeug_dbnum");//标识
|
String dbnum = (String) this.getModel().getValue("qeug_dbnum");//标识
|
||||||
//String sql = (String) this.getModel().getValue("qeug_sqls");//sql语句
|
//String sql = (String) this.getModel().getValue("qeug_sqls");//sql语句-多行文本
|
||||||
String sql2 = (String) this.getModel().getValue("qeug_largetextfield");//sql语句
|
String sql2 = (String) this.getModel().getValue("qeug_largetextfield");//sql语句-大文本
|
||||||
try{
|
try{
|
||||||
//DB.update(DBRoute.of(dbnum), sql,null);
|
//DB.update(DBRoute.of(dbnum), sql,null);
|
||||||
DB.update(DBRoute.of(dbnum), sql2,null);
|
String[] sqlss = sql2.split(";");//解决多个更新语句一起执行失败的问题
|
||||||
|
for (String sql : sqlss) {
|
||||||
|
DB.update(DBRoute.of(dbnum), sql,null);
|
||||||
|
logger.info("执行语句:"+sql);
|
||||||
|
}
|
||||||
|
|
||||||
}catch(Exception ex){
|
}catch(Exception ex){
|
||||||
this.getView().showMessage("执行失败:" + ex.getMessage());
|
this.getView().showMessage("执行失败:" + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue