parent
17ba8fc88b
commit
0b2af4b9d4
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.execsql.service;
|
package com.hzya.frame.execsql.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.hzya.frame.datasource.DataSourceUtil;
|
import com.hzya.frame.datasource.DataSourceUtil;
|
||||||
import com.hzya.frame.execsql.entity.ExecSqlEntity;
|
import com.hzya.frame.execsql.entity.ExecSqlEntity;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
@ -79,15 +80,15 @@ public class ExecSqlServiceImpl implements IExecSqlService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int execUpdateSql(String sql, String data_source_code) throws Exception {
|
public int execUpdateSql(String sql, String data_source_code) throws Exception {
|
||||||
logger.info("=============进入execUpdateSql方法============");
|
logger.info("=============进入execUpdateSql方法============{},{}",sql,data_source_code);
|
||||||
if (ObjectUtils.isEmpty(sql)) {
|
if (StrUtil.isNotEmpty(sql)) {
|
||||||
if (sql.contains("where") || sql.contains("WHERE")) {
|
if (sql.contains("where") || sql.contains("WHERE")) {
|
||||||
// SqlSession sqlSession = getSqlSession(data_source_code);
|
// SqlSession sqlSession = getSqlSession(data_source_code);
|
||||||
// SqlSession sqlSession = new DataSourceUtil().getDefaultSqlSession();
|
// SqlSession sqlSession = new DataSourceUtil().getDefaultSqlSession();
|
||||||
logger.info("=============execUpdateSql方法要执行的sql:============" + sql);
|
logger.info("=============execUpdateSql方法要执行的sql:============" + sql);
|
||||||
ExecSqlEntity entity = new ExecSqlEntity();
|
ExecSqlEntity entity = new ExecSqlEntity();
|
||||||
entity.setSql(sql);
|
entity.setSql(sql);
|
||||||
int result = sqlSession.update("com.hzya.frame.sysnew.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_update", entity);
|
int result = sqlSession.update("com.hzya.frame.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_update", entity);
|
||||||
logger.info("update受影响行数:" + result);
|
logger.info("update受影响行数:" + result);
|
||||||
//sqlSession.close();
|
//sqlSession.close();
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue