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;
  }
  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;
  }
Exemple #3
0
  public static SqlSession openSession(DataSource dataSource) {

    SqlSessionFactory sqlSessionFactory = DbConnectionFactory.getSqlSessionFactory(dataSource);

    Configuration config = sqlSessionFactory.getConfiguration();
    if (!config.hasMapper(PcmReqDAO.class)) {
      config.getTypeAliasRegistry().registerAlias("pcmReqModel", PcmReqModel.class);
      config.getTypeAliasRegistry().registerAlias("pcmReqDtlModel", PcmReqDtlModel.class);
      config.getTypeAliasRegistry().registerAlias("pcmReqMethodModel", PcmReqMethodModel.class);
      config
          .getTypeAliasRegistry()
          .registerAlias("pcmReqMethodCommitteeModel", PcmReqMethodCommitteeModel.class);
      config.getTypeAliasRegistry().registerAlias("pcmReqCmtHdrModel", PcmReqCmtHdrModel.class);
      config.getTypeAliasRegistry().registerAlias("pcmReqCmtDtlModel", PcmReqCmtDtlModel.class);

      config.addMapper(PcmReqDAO.class);
      config.addMapper(PcmReqDtlDAO.class);
      config.addMapper(PcmReqMethodDAO.class);
      config.addMapper(PcmReqMethodCommitteeDAO.class);
      config.addMapper(PcmReqCmtHdrDAO.class);
      config.addMapper(PcmReqCmtDtlDAO.class);
    }

    if (!config.hasMapper(PcmFunctionDAO.class)) {
      // config.getTypeAliasRegistry().registerAlias("memoWorkflowModel", MemoWorkflowModel.class);

      config.addMapper(PcmFunctionDAO.class);
    }

    if (!config.hasMapper(PcmOrdDAO.class)) {
      config.getTypeAliasRegistry().registerAlias("pcmOrdModel", PcmOrdModel.class);

      config.addMapper(PcmOrdDAO.class);
    }

    return sqlSessionFactory.openSession();
  }