赞
踩
想要不论传入什么sql 都能直接执行
@Autowired private SqlSessionTemplate sqlSessionTemplate; public void executeSql(String replaceSql) { if (StringUtils.isEmpty(replaceSql)) { return; } try { SqlSession sqlSession = sqlSessionTemplate.getSqlSessionFactory().openSession(); sqlSession.getConnection().prepareStatement(replaceSql).execute(replaceSql); sqlSession.commit(); sqlSession.close(); } catch (SQLException e) { log.error("异常:" ,e); } }
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。