public Map save(String sessionId,String smspmsName, String smsCompany, String smspmsId) { final String sql = "insert into sms_user (telno,user_name,dept) values ('" + smspmsId + "','" + smspmsName + "','" + smsCompany + "')"; boolean success = Db.tx(new IAtom() { @Override public boolean run() throws SQLException { try { Db.update(sql); } catch (Exception e) { e.printStackTrace(); log.error("新增联系人失败:" + e.getMessage()); return false; } return true; } }); if(success){ CommonService commonService = Duang.duang(CommonService.class); commonService.insertOptLog(sessionId, CodeUtil.code("预警联系人管理"), CodeUtil.code("新增预警联系人:") + smspmsId, ""); return renderSuccess("success"); }else{ return renderFailed("新增预警联系人失败"); } }
请大神们帮我看一下这个事务的用法对吗???