예제 #1
0
  @Override
  public int del(Object id, Class clazz) throws Exception {
    EntityInfo entityInfo = ClassUtils.getEntityInfoByClazz(clazz);
    if (entityInfo == null) {
      throw new DaoException("无效的实体类class");
    }

    SqlHelper sqlHelper = SqlHelper.getDeleteHelper(clazz);
    sqlHelper.append(" WHERE ").append(entityInfo.getPkClumnName()).append("=?");
    sqlHelper.setParameters(id);
    return del(sqlHelper, clazz);
  }
예제 #2
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);
  }