|
@@ -14,7 +14,6 @@ import com.keao.edu.common.page.QueryInfo;
|
|
|
import com.keao.edu.common.service.BaseService;
|
|
|
import com.keao.edu.util.collection.MapUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.ibatis.session.ExecutorType;
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -156,8 +155,8 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
|
|
|
if(ps!=null){
|
|
|
ps.close();
|
|
|
}
|
|
|
- if(connection!=null){
|
|
|
- connection.close();
|
|
|
+ if(sqlSession!=null){
|
|
|
+ sqlSession.close();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -171,7 +170,8 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
|
|
|
StringBuffer sql=new StringBuffer();
|
|
|
Map<Y,Z> result = new HashMap();
|
|
|
try {
|
|
|
- Connection connection = sqlSessionFactory.openSession(ExecutorType.BATCH).getConnection();
|
|
|
+ SqlSession sqlSession = sqlSessionFactory.openSession();
|
|
|
+ Connection connection = sqlSession.getConnection();
|
|
|
sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName).append(" WHERE ");
|
|
|
boolean resultFlag = false;
|
|
|
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
|
|
@@ -217,8 +217,8 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
|
|
|
if(ps!=null){
|
|
|
ps.close();
|
|
|
}
|
|
|
- if(connection!=null){
|
|
|
- connection.close();
|
|
|
+ if(sqlSession!=null){
|
|
|
+ sqlSession.close();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -235,7 +235,8 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
|
|
|
StringBuffer sql=new StringBuffer();
|
|
|
Map<String, String> result=new HashMap();
|
|
|
try {
|
|
|
- Connection connection = sqlSessionFactory.openSession(ExecutorType.BATCH).getConnection();
|
|
|
+ SqlSession sqlSession = sqlSessionFactory.openSession();
|
|
|
+ Connection connection = sqlSession.getConnection();
|
|
|
sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName).append(" WHERE ").append(columnKey).append(" IN (").append(StringUtils.join(ids, ",")).append(")");
|
|
|
PreparedStatement ps = connection.prepareStatement(sql.toString());
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
@@ -248,8 +249,8 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
|
|
|
if(ps!=null){
|
|
|
ps.close();
|
|
|
}
|
|
|
- if(connection!=null){
|
|
|
- connection.close();
|
|
|
+ if(sqlSession!=null){
|
|
|
+ sqlSession.close();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|