Compare commits

..

2 Commits

2 changed files with 13 additions and 2 deletions

View File

@ -20,14 +20,14 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
public class MybatisUtils public class MybatisUtils
{ {
private static HashMap<String, SqlSession> SessionMap = new HashMap<>(); private static HashMap<String, SqlSession> SessionMap = new HashMap<>();
private static String DEFAULT_CONFIGFILE = "mybatis/mybatis-config.xml";
/** /**
* *
* @param configFile * @param configFile
* @return * @return
* @throws IOException * @throws IOException
*/ */
public static SqlSession getSqlSession(String configFile ) public static SqlSession getSqlSession(String configFile = "mybatis/mybatis-config.xml" )
throws IOException throws IOException
{ {
// 根据配置文件的路径查找是否已经创建了对应的session // 根据配置文件的路径查找是否已经创建了对应的session

View File

@ -16,7 +16,9 @@ import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import com.cpic.xim.mybatis.mapper.RankingListMapper;
import com.cpic.xim.mybatis.utils.MybatisUtils; import com.cpic.xim.mybatis.utils.MybatisUtils;
import oracle.jdbc.OracleCallableStatement; import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleTypes; import oracle.jdbc.OracleTypes;
@ -51,6 +53,15 @@ public class CallerRankingList
String yearRegx = "202[0-9]"; String yearRegx = "202[0-9]";
SqlSession session = MybatisUtils.getSqlSession(yearRegx); SqlSession session = MybatisUtils.getSqlSession(yearRegx);
RankingListMapper mapper = session.getMapper(RankingListMapper.class);
HashMap<String,Object> params = new HashMap<>(5);
mapper.getRankdingList(null);
ArrayList<CallerRankingItem> attachingRateRankingList = (ArrayList<CallerRankingItem>)params.get("a_attaching_ranking_list");
ArrayList<CallerRankingItem> renewalRateList = (ArrayList<CallerRankingItem>)params.get("a_renewal_ranking_list");
rankingList = new CallerRankingList(departmentCode, yearRegx, monthRegx, attachingRateRankingList, renewalRateList);
return rankingList; return rankingList;
} }