Esempio n. 1
0
  @Override
  public Map<String, Object> findMapById(Object id, Class clazz) throws Exception {

    EntityInfo entityInfo = ClassUtils.getEntityInfoByClazz(clazz);

    if (entityInfo == null) {
      throw new DaoException("无效的实体类class");
    }

    SqlHelper sqlHelper = SqlHelper.getSelectHelper(clazz);
    sqlHelper.append(" AND ").append(entityInfo.getPkClumnName()).append("=?");
    sqlHelper.setParameters(id);
    return searchMapForOne(sqlHelper);
  }
Esempio n. 2
0
 @Override
 public List<Map<String, Object>> searchAllMap(Class clazz) throws Exception {
   SqlHelper sqlHelper = SqlHelper.getSelectHelper(clazz);
   return searchForListMap(sqlHelper.getSql(), sqlHelper.getParameters());
 }
Esempio n. 3
0
 @Override
 public <T> List<T> searchAll(Class<T> clazz) throws Exception {
   SqlHelper sqlHelper = SqlHelper.getSelectHelper(clazz);
   return searchForList(sqlHelper.getSql(), clazz, sqlHelper.getParameters());
 }