List of usage examples for org.apache.ibatis.session SqlSession selectList
<E> List<E> selectList(String statement, Object parameter);
From source file:com.tmc.server.app.emp.License.java
public void selectByUserId(SqlSession sqlSession, ServiceRequest request, ServiceResult result) { Long userId = request.getLong("userId"); List<AbstractDataModel> list = sqlSession.selectList(mapperName + ".selectByUserId", userId); result.setRetrieveResult(1, "select ok", list); }
From source file:com.tmc.server.app.emp.License.java
public void selectByToday(SqlSession sqlSession, ServiceRequest request, ServiceResult result) { Long companyId = request.getLong("companyId"); List<AbstractDataModel> list = sqlSession.selectList(mapperName + ".selectByToday", companyId); result.setRetrieveResult(1, "select ok", list); }
From source file:com.tmc.server.app.sys.LicenseCode.java
public void selectByName(SqlSession sqlSession, ServiceRequest request, ServiceResult result) { String licenseName = request.getString("licenseName"); if (licenseName != null) { licenseName = "%" + licenseName + "%"; } else {/*w w w . j a va 2 s . c o m*/ licenseName = "%"; } List<AbstractDataModel> list = sqlSession.selectList(mapperName + ".selectByName", licenseName); result.setRetrieveResult(1, "select ok", list); }
From source file:com.tmc.server.app.sys.LicenseCode.java
public void selectByApplyDate(SqlSession sqlSession, ServiceRequest request, ServiceResult result) { Map<String, Object> param = new HashMap<String, Object>(); param.put("applyDate", Calendar.getInstance().getTime()); // system date List<AbstractDataModel> list = sqlSession.selectList(mapperName + ".selectByCodeKindId", param); result.setRetrieveResult(1, "select ok", list); }
From source file:fr.cph.stock.dao.AccountDaoImpl.java
License:Apache License
/** * Get all account for the user/* w w w. j a v a 2 s . c om*/ * * @param userId * the user id * @return a list of account */ public final List<Account> selectAllAccountWithUserId(final int userId) { SqlSession session = getSqlSessionFactory(); List<Account> accountResult = null; try { accountResult = session.selectList("AccountDao.selectAllAccountWithUserId", userId); } finally { session.close(); } return accountResult; }
From source file:fr.cph.stock.dao.CompanyDaoImpl.java
License:Apache License
/** * Get all the companies in DB//from w ww.j av a 2s . c om * * @param realTime * a boolean that represents a real time data information. If * @return a list of company */ public final List<Company> selectAllCompany(final boolean realTime) { SqlSession session = getSqlSessionFactory(); List<Company> companies = null; Map<String, Boolean> options = new HashMap<String, Boolean>(); options.put("realTime", realTime); // Remove manual companies options.put("manual", false); try { companies = session.selectList("CompanyDao.selectAllCompanyNotRealTime", options); } finally { session.close(); } return companies; }
From source file:fr.cph.stock.dao.CurrencyDaoImpl.java
License:Apache License
/** * Get a list of currency data/*from w w w. ja va2s . c om*/ * * @param currency * the currency * @return a list of currency */ public final List<CurrencyData> selectListCurrency(final String currency) { SqlSession session = getSqlSessionFactory(); List<CurrencyData> currencyDataList = null; try { currencyDataList = session.selectList("CurrencyData.selectListCurrencyData", currency); } finally { session.close(); } return currencyDataList; }
From source file:fr.cph.stock.dao.FollowDaoImpl.java
License:Apache License
/** * Get a list of company of the user given * // w w w. java 2 s .c o m * @param userId * the user id * @return a list of follow */ public final List<Follow> selectListFollow(final int userId) { SqlSession session = getSqlSessionFactory(); List<Follow> follow = null; try { follow = session.selectList("FollowDao.selectListFollow", userId); } finally { session.close(); } return follow; }
From source file:fr.cph.stock.dao.IndexDaoImpl.java
License:Apache License
/** * Get a list of Index/* w ww .j a v a 2 s. com*/ * * @param yahooId * the index requested * @param from * first date * @param to * second date * @return a list of Index */ public final List<Index> selectListFrom(final String yahooId, final Date from, final Date to) { SqlSession session = getSqlSessionFactory(); List<Index> indexes = null; Map<String, Object> map = new HashMap<String, Object>(); map.put("yahooId", yahooId); map.put("from", from); map.put("to", to); try { indexes = session.selectList("IndexDao.selectListIndexFromTo", map); } finally { session.close(); } return indexes; }
From source file:fr.cph.stock.dao.PortfolioDaoImpl.java
License:Apache License
/** * Get portfolio, loaded with its equities * /*w ww . j a v a 2 s. c o m*/ * @param userId * the user id * @param from * the from date * @param to * the to date * @return a portfolio */ public final Portfolio selectPortfolioFromUserIdWithEquities(final int userId, final Date from, final Date to) { SqlSession session = getSqlSessionFactory(); Portfolio portfolio = null; try { portfolio = session.selectOne("PortfolioDao.selectPortfolioWithId", userId); if (portfolio != null) { List<Equity> equities = session.selectList("PortfolioDao.selectEquityFromPortfolio", portfolio.getId()); portfolio.setEquities(equities); List<Account> accounts = session.selectList("AccountDao.selectAllAccountWithUserId", userId); portfolio.setAccounts(accounts); if (from == null) { List<ShareValue> shares = session.selectList("ShareValue.selectAllValue", userId); portfolio.setShareValues(shares); } else { Map<String, Object> map = new HashMap<String, Object>(); map.put("userId", userId); map.put("from", from); if (to == null) { List<ShareValue> shares = session.selectList("ShareValue.selectShareValueFrom", map); portfolio.setShareValues(shares); } else { map.put("to", to); List<ShareValue> shares = session.selectList("ShareValue.selectShareValueFromTo", map); portfolio.setShareValues(shares); } } } } finally { session.close(); } return portfolio; }