优化增加日志输出,不执行删除命令
This commit is contained in:
		
							parent
							
								
									57ae76b7e7
								
							
						
					
					
						commit
						1ba724bf57
					
				|  | @ -4,9 +4,13 @@ import kd.bos.db.DB; | |||
| import kd.bos.db.DBRoute; | ||||
| import kd.bos.form.events.AfterDoOperationEventArgs; | ||||
| import kd.bos.form.plugin.AbstractFormPlugin; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| 
 | ||||
| public class TestDBFormPlugin extends AbstractFormPlugin { | ||||
| 
 | ||||
|     private final static Log logger = LogFactory.getLog(TestDBFormPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterDoOperation(AfterDoOperationEventArgs e) { | ||||
|         super.afterDoOperation(e); | ||||
|  | @ -14,7 +18,12 @@ public class TestDBFormPlugin extends AbstractFormPlugin { | |||
|             String dbnum = (String) this.getModel().getValue("shjh_dbnum");//标识 | ||||
|             String sql = (String) this.getModel().getValue("shjh_sqls");//sql语句 | ||||
|             try{ | ||||
|                 if(sql.contains("delete") || sql.contains("DELETE") || sql.contains("Delete")){ | ||||
|                     //语句包含删除命令,不执行,直接返回 | ||||
|                     return; | ||||
|                 } | ||||
|                 DB.update(DBRoute.of(dbnum), sql,null); | ||||
|                 logger.info("执行语句:"+sql); | ||||
|             }catch(Exception ex){ | ||||
|                 this.getView().showMessage("执行失败:" + ex.getMessage()); | ||||
|             } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue