コード例 #1
0
  public List<Map<String, Object>> list(Map<String, Object> params) {

    List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

    SqlSession session = DbConnectionFactory.getSqlSessionFactory(dataSource).openSession();
    try {
      MainAccountActivityGroupDAO dao = session.getMapper(MainAccountActivityGroupDAO.class);

      List<Map<String, Object>> tmpList = dao.list(params);

      String name = MainAccountActivityGroupConstant.TFN_NAME + params.get("lang");

      for (Map<String, Object> tmpMap : tmpList) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(
            JsonConstant.COMBOBOX_ID,
            (Integer) tmpMap.get(MainAccountActivityGroupConstant.TFN_ID));
        map.put(JsonConstant.COMBOBOX_NAME, (String) tmpMap.get(name.toUpperCase()));

        tmpMap = CommonUtil.removeThElement(tmpMap);
        map.put(JsonConstant.COMBOBOX_DATA, tmpMap);

        list.add(map);
      }

    } catch (Exception ex) {
      log.error(ex);
    } finally {
      session.close();
    }

    return list;
  }
コード例 #2
0
  public Map<String, Object> get(Integer id) {

    Map<String, Object> map = null;

    SqlSession session = DbConnectionFactory.getSqlSessionFactory(dataSource).openSession();
    try {
      MainAccountActivityGroupDAO dao = session.getMapper(MainAccountActivityGroupDAO.class);

      map = dao.get(id);

    } catch (Exception ex) {
      log.error(ex);
    } finally {
      session.close();
    }

    return map;
  }