Exemple #1
0
  /**
   * 获取对象的RowMapper <功能详细描述>
   *
   * @return [参数说明]
   * @return RowMapper [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public RowMapper<T> getSelectRowMapper() {
    AssertUtils.notNull(this.type, "type is null");
    AssertUtils.notNull(this.classReflector, "classReflector is null");

    final Class<T> finalType = this.type;
    final ClassReflector<T> finalClassReflector = this.classReflector;
    RowMapper<T> rowMapper =
        new RowMapper<T>() {
          @Override
          public T mapRow(ResultSet rs, int rowNum) throws SQLException {
            T newObjInstance = ObjectUtils.newInstance(finalType);
            MetaObject metaObject = MetaObjectUtils.forObject(newObjInstance);

            for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) {
              String propertyName = entryTemp.getKey();
              String columnName = entryTemp.getValue();
              if (finalClassReflector.getSetterNames().contains(propertyName)) {
                Class<?> type = getter2JavaTypeMapping.get(propertyName);
                Object value = JdbcUtils.getResultSetValueForSimpleType(rs, columnName, type);
                metaObject.setValue(propertyName, value);
              }
            }
            return newObjInstance;
          }
        };
    return rowMapper;
  }
  /**
   * 根据id更新对象 <功能详细描述>
   *
   * @param templateTable
   * @return [参数说明]
   * @return boolean [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  @Transactional
  public boolean updateById(TemplateTable templateTable) {
    // TODO:验证参数是否合法,必填字段是否填写,
    AssertUtils.notNull(templateTable, "templateTable is null.");
    AssertUtils.notEmpty(templateTable.getId(), "templateTable.id is empty.");

    // TODO:生成需要更新字段的hashMap
    Map<String, Object> updateRowMap = new HashMap<String, Object>();
    updateRowMap.put("id", templateTable.getId());

    // TODO:需要更新的字段
    updateRowMap.put("createOperatorId", templateTable.getCreateOperatorId());
    updateRowMap.put("tableStatus", templateTable.getTableStatus());
    updateRowMap.put("remark", templateTable.getRemark());
    updateRowMap.put("tableName", templateTable.getTableName());
    updateRowMap.put("name", templateTable.getName());
    // type:java.lang.String
    updateRowMap.put("tableType", templateTable.getTableType());
    updateRowMap.put("systemId", templateTable.getSystemId());
    updateRowMap.put("createDate", templateTable.getCreateDate());
    updateRowMap.put("lastUpdateDate", templateTable.getLastUpdateDate());

    int updateRowCount = this.templateTableDao.updateTemplateTable(updateRowMap);

    // TODO:如果需要大于1时,抛出异常并回滚,需要在这里修改
    return updateRowCount >= 1;
  }
Exemple #3
0
  /**
   * 获取查询条件的Setter对象 <功能详细描述>
   *
   * @param obj
   * @return [参数说明]
   * @return PreparedStatementSetter [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public PreparedStatementSetter getUpdateSetter(Object obj) {
    AssertUtils.notEmpty(obj, "update obj must not empty.");

    // 获取当前对象中有哪些属性
    final MetaObject metaObject = MetaObjectUtils.forObject(obj);
    final Set<String> keySet = new HashSet<String>();
    for (String getterName : metaObject.getGetterNames()) {
      keySet.add(getterName);
    }
    AssertUtils.isTrue(
        keySet.contains(this.pkName),
        "obj:{} must contains pk{}.",
        new Object[] {obj, this.pkName});
    final String finalPkName = this.pkName;
    PreparedStatementSetter res =
        new PreparedStatementSetter() {
          @Override
          public void setValues(PreparedStatement ps) throws SQLException {
            int i = 1;
            for (String propertyNameTemp : updateAblePropertyNames) {
              if (!keySet.contains(propertyNameTemp)) {
                continue;
              }
              Object valueObj = metaObject.getValue(propertyNameTemp);
              Class<?> setterType = getter2JavaTypeMapping.get(propertyNameTemp);
              JdbcUtils.setPreparedStatementValueForSimpleType(ps, i++, valueObj, setterType);
            }
            Class<?> setterType = getter2JavaTypeMapping.get(finalPkName);
            JdbcUtils.setPreparedStatementValueForSimpleType(
                ps, i, metaObject.getValue(finalPkName), setterType);
          }
        };
    return res;
  }
Exemple #4
0
  /**
   * 获取查询sql <功能详细描述>
   *
   * @return [参数说明]
   * @return String [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public String updateSql(Object obj) {
    AssertUtils.notEmpty(obj, "update obj must not empty.");

    // 获取当前对象中有哪些属性
    MetaObject metaObject = MetaObjectUtils.forObject(obj);
    Set<String> keySet = new HashSet<String>();
    for (String getterName : metaObject.getGetterNames()) {
      keySet.add(getterName);
    }
    AssertUtils.isTrue(
        keySet.contains(this.pkName),
        "obj:{} must contains pk{}.",
        new Object[] {obj, this.pkName});

    // 构建query语句
    SqlBuilder.BEGIN();
    SqlBuilder.UPDATE(this.tableName);

    for (String propertyName : updateAblePropertyNames) {
      if (!keySet.contains(propertyName)) {
        continue;
      }
      // Object value = metaObject.getValue(propertyName);
      String columnName = getter2columnNameMapping.get(propertyName);
      SqlBuilder.SET(columnName + " = ?");
    }
    SqlBuilder.WHERE(this.getter2columnNameMapping.get(this.pkName) + " = ? ");
    String updateSql = SqlBuilder.SQL();
    SqlBuilder.RESET();
    return updateSql;
  }
  /**
   * @param params
   * @return
   */
  @Override
  public List<RuleItemByteParam> queryRuleItemByteParamList(final Map<String, Object> params) {
    AssertUtils.notNull(params, "params is null.");
    AssertUtils.notEmpty(params.get("ruleKey"), "params.ruleKey is null.");

    StringBuilder sb = new StringBuilder(TxConstants.INITIAL_STR_LENGTH);
    sb.append("SELECT ");
    sb.append("ruleKey,");
    sb.append("paramKey,");
    sb.append("paramOrder,");
    sb.append("paramValue,");
    sb.append(" FROM RULE_BYTE_PARAM ");
    sb.append(" WHERE ruleKey = ?");
    List<RuleItemByteParam> resList =
        this.jdbcTemplate.query(
            sb.toString(),
            new PreparedStatementSetter() {
              @Override
              public void setValues(PreparedStatement ps) throws SQLException {
                int parameterIndex = 0;
                ps.setString(++parameterIndex, (String) params.get("ruleKey"));
              }
            },
            ruleItemByteParamRowMapper);
    return resList;
  }
  /**
   * @param condition
   * @return
   */
  @Override
  public int deleteRuleItemByteParam(final RuleItemByteParam condition) {
    AssertUtils.notNull(condition, "ruleItemByteParam is null.");
    AssertUtils.notEmpty(condition.getRuleKey(), "ruleItemValueParam.ruleKey is null.");

    StringBuilder sb = new StringBuilder(TxConstants.INITIAL_STR_LENGTH);
    sb.append("DELETE FROM RULE_BYTE_PARAM ");
    sb.append(" WHERE ruleKey = ? ");
    if (!ObjectUtils.isEmpty(condition.getParamKey())) {
      sb.append(" AND paramKey = ? ");
    }
    int resInt =
        this.jdbcTemplate.update(
            sb.toString(),
            new PreparedStatementSetter() {
              @Override
              public void setValues(PreparedStatement ps) throws SQLException {
                int parameterIndex = 0;
                ps.setString(++parameterIndex, condition.getRuleKey());
                if (!ObjectUtils.isEmpty(condition.getParamKey())) {
                  ps.setString(++parameterIndex, condition.getParamKey());
                }
              }
            });
    return resInt;
  }
  /**
   * 将templateTable实例插入数据库中保存 1、如果templateTable为空时抛出参数为空异常 2、如果templateTable中部分必要参数为非法值时抛出参数不合法异常
   * <功能详细描述>
   *
   * @param district [参数说明]
   * @return void [返回类型说明]
   * @exception throws
   * @see [类、类#方法、类#成员]
   */
  @Transactional
  public void insertTemplateTable(TemplateTable templateTable) {
    // TODO:验证参数是否合法,必填字段是否填写,
    AssertUtils.notNull(templateTable, "templateTable is null.");
    AssertUtils.notEmpty(templateTable.getId(), "templateTable.id is empty.");

    this.templateTableDao.insertTemplateTable(templateTable);
  }
Exemple #8
0
  /** @param 对property2columnNameMapping进行赋值 */
  public void addGetter2columnMapping(String getterName, String columnName, Class<?> type) {
    AssertUtils.notEmpty(getterName, "getterName is empty.");
    AssertUtils.notEmpty(columnName, "columnName is empty.");
    AssertUtils.notNull(type, "type is empty.");

    this.getter2columnNameMapping.put(getterName.trim(), columnName.trim().toUpperCase());
    this.getter2JavaTypeMapping.put(getterName, type);
  }
Exemple #9
0
  /** <默认构造函数> */
  public SqlSource(Dialect dialect) {
    super();

    AssertUtils.notEmpty(pkName, "pkName is empty.");
    AssertUtils.notEmpty(tableName, "tableName is empty.");
    AssertUtils.notNull(dialect, "dialect is empty.");

    this.dialect = dialect;
  }
Exemple #10
0
  /** <默认构造函数> */
  public SqlSource(Class<T> type, Dialect dialect) {
    super();

    AssertUtils.notNull(type, "type is empty.");
    AssertUtils.notNull(dialect, "dialect is empty.");

    this.type = type;
    this.classReflector = ClassReflector.forClass(type);
    this.dialect = dialect;
  }
  /**
   * @param sourceTableDef
   * @param ddlDialect
   * @return
   */
  @Override
  public AlterTableDDLBuilder newInstance(TableDef sourceTable, DDLDialect ddlDialect) {
    AssertUtils.notNull(ddlDialect, "ddlDialect is null.");
    AssertUtils.notNull(sourceTable, "sourceTable is null.");
    AssertUtils.notEmpty(sourceTable.getTableName(), "sourceTable.tableName is empty.");
    AssertUtils.notEmpty(sourceTable.getColumns(), "sourceTable.columns is empty.");

    MysqlAlterTableDDLBuilder builder = new MysqlAlterTableDDLBuilder(sourceTable, ddlDialect);
    return builder;
  }
Exemple #12
0
  /** <默认构造函数> */
  public SqlSource(String tableName, String pkName, Dialect dialect) {
    super();

    AssertUtils.notEmpty(pkName, "pkName is empty.");
    AssertUtils.notEmpty(tableName, "tableName is empty.");
    AssertUtils.notNull(dialect, "dialect is empty.");

    this.pkName = pkName.trim();
    this.tableName = tableName.trim().toUpperCase();
    this.dialect = dialect;
  }
Exemple #13
0
  /** <默认构造函数> */
  public SqlSource(Class<T> type, String tableName, String pkName, Dialect dialect) {
    super();

    AssertUtils.notNull(type, "type is empty.");
    AssertUtils.notEmpty(pkName, "pkName is empty.");
    AssertUtils.notEmpty(tableName, "tableName is empty.");
    AssertUtils.notNull(dialect, "dialect is empty.");

    this.type = type;
    this.classReflector = ClassReflector.forClass(type);
    this.pkName = pkName.trim();
    this.tableName = tableName.trim().toUpperCase();
    this.dialect = dialect;
  }
Exemple #14
0
  /**
   * 获取删除语句<br>
   * <功能详细描述>
   *
   * @return [参数说明]
   * @return String [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public String deleteSql() {
    AssertUtils.notEmpty(this.pkName, "pkName is empty.");
    AssertUtils.isTrue(
        this.getter2columnNameMapping.containsKey(this.pkName),
        "property2columnNameMapping not contains pkName:{}.",
        this.pkName);

    // 开始构建sql
    SqlBuilder.BEGIN();
    SqlBuilder.DELETE_FROM(this.tableName);
    SqlBuilder.WHERE(this.getter2columnNameMapping.get(this.pkName) + " = ? ");
    String deleteSql = SqlBuilder.SQL();
    SqlBuilder.RESET();

    return deleteSql;
  }
  /**
   * 根据Id查询TemplateTable实体 1、当id为empty时抛出异常 <功能详细描述>
   *
   * @param id
   * @return [参数说明]
   * @return TemplateTable [返回类型说明]
   * @exception throws 可能存在数据库访问异常DataAccessException
   * @see [类、类#方法、类#成员]
   */
  public TemplateTable findTemplateTableById(String id) {
    AssertUtils.notEmpty(id, "id is empty.");

    TemplateTable condition = new TemplateTable();
    condition.setId(id);
    return this.templateTableDao.findTemplateTable(condition);
  }
Exemple #16
0
  /**
   * 获取查询单条数据的sql <功能详细描述>
   *
   * @return [参数说明]
   * @return String [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public String findSql() {
    AssertUtils.notEmpty(this.pkName, "pkName is empty.");
    AssertUtils.isTrue(
        this.getter2columnNameMapping.containsKey(this.pkName),
        "property2columnNameMapping not contains pkName:{}.",
        this.pkName);

    SqlBuilder.BEGIN();
    for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) {
      SqlBuilder.SELECT(entryTemp.getValue());
    }
    SqlBuilder.FROM(this.tableName);
    SqlBuilder.WHERE(this.getter2columnNameMapping.get(this.pkName) + " = ? ");
    String findSql = SqlBuilder.SQL();
    SqlBuilder.RESET();
    return findSql;
  }
  /**
   * 根据id删除templateTable实例 1、如果入参数为空,则抛出异常 2、执行删除后,将返回数据库中被影响的条数
   *
   * @param id
   * @return 返回删除的数据条数,<br>
   *     有些业务场景,如果已经被别人删除同样也可以认为是成功的 这里讲通用生成的业务层代码定义为返回影响的条数
   * @return int [返回类型说明]
   * @exception throws
   * @see [类、类#方法、类#成员]
   */
  @Transactional
  public int deleteById(String id) {
    AssertUtils.notEmpty(id, "id is empty.");

    TemplateTable condition = new TemplateTable();
    condition.setId(id);
    return this.templateTableDao.deleteTemplateTable(condition);
  }
  /**
   * 解析类型为表定义详细实例<br>
   * :实例中将含有对应的索引以及字段和索引<br>
   * <功能详细描述>
   *
   * @param type
   * @return [参数说明]
   * @return TableDef [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public static TableDef analyzeToTableDefDetail(Class<?> type) {
    AssertUtils.notNull(type, "type is null.");

    if (TYPE_2_TABLEDEF_MAP.containsKey(type)) {
      return TYPE_2_TABLEDEF_MAP.get(type);
    }
    JPAEntityTableDef tableDef = doAnalyzeToTableDefDetail(type);
    TYPE_2_TABLEDEF_MAP.put(type, tableDef);
    return tableDef;
  }
Exemple #19
0
  /**
   * 添加属性值与条件的映射关系<br>
   * <功能详细描述>
   *
   * @param propertyName
   * @param conditionExpression [参数说明]
   * @return void [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public void addQueryConditionKey2SqlMapping(
      QueryConditionTypeEnum queryConditionType,
      String key,
      String conditionExpression,
      JdbcType jdbcType,
      Class<?> javaType) {
    AssertUtils.notEmpty(key, "key is empty.");
    AssertUtils.notEmpty(conditionExpression, "conditionExpression is empty.");
    AssertUtils.notNull(jdbcType, "jdbcType is empty.");

    this.queryConditionKey2SqlMapping.put(key, conditionExpression);
    this.queryConditionKey2JdbcTypeMapping.put(key, jdbcType);
    this.queryConditionKey2JavaTypeMapping.put(key, javaType);

    if (queryConditionType != null) {
      this.queryConditionKey2ConditionInfoMapping.put(
          key, new QueryConditionInfo(queryConditionType, key, javaType, jdbcType));
    }
  }
Exemple #20
0
  /**
   * 获取查询sql <功能详细描述>
   *
   * @return [参数说明]
   * @return String [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public String querySql(Object obj) {
    AssertUtils.notEmpty(this.pkName, "pkName is empty.");
    AssertUtils.isTrue(
        this.getter2columnNameMapping.containsKey(this.pkName),
        "property2columnNameMapping not contains pkName:{}.",
        this.pkName);

    // 构建query语句
    SqlBuilder.BEGIN();
    for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) {
      SqlBuilder.SELECT(entryTemp.getValue());
    }
    SqlBuilder.FROM(this.tableName);

    if (!ObjectUtils.isEmpty(obj)) {
      MetaObject metaObject = MetaObjectUtils.forObject(obj);
      for (Entry<String, String> entryTemp : queryConditionKey2SqlMapping.entrySet()) {
        String queryKeyName = entryTemp.getKey();
        Object valueObj = metaObject.getValue(queryKeyName);
        if (ObjectUtils.isEmpty(valueObj)) {
          continue;
        }
        SqlBuilder.WHERE(entryTemp.getValue());
      }
    }
    for (String conditionExpressionTemp : otherCondition) {
      SqlBuilder.WHERE(conditionExpressionTemp);
    }

    // 在不存在排序字段时默认使用主键对应字段作为排序字段<br/>
    if (CollectionUtils.isEmpty(orderList)) {
      SqlBuilder.ORDER_BY(this.getter2columnNameMapping.get(this.pkName));
    } else {
      for (String order : orderList) {
        SqlBuilder.ORDER_BY(order);
      }
    }

    String querySql = SqlBuilder.SQL();
    SqlBuilder.RESET();

    return querySql;
  }
Exemple #21
0
  /**
   * 获取设置主键的setter对象<br>
   * <功能详细描述>
   *
   * @param obj
   * @return [参数说明]
   * @return PreparedStatementSetter [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public PreparedStatementSetter getPKSetter(final Object obj) {
    AssertUtils.notEmpty(this.pkName, "pkName is empty.");
    AssertUtils.isTrue(
        this.getter2columnNameMapping.containsKey(this.pkName),
        "property2columnNameMapping not contains pkName:{}.",
        this.pkName);

    final String finalPkName = this.pkName;
    final MetaObject metaObject = MetaObjectUtils.forObject(obj);
    PreparedStatementSetter res =
        new PreparedStatementSetter() {
          @Override
          public void setValues(PreparedStatement ps) throws SQLException {
            Class<?> setterType = getter2JavaTypeMapping.get(finalPkName);
            JdbcUtils.setPreparedStatementValueForSimpleType(
                ps, 1, metaObject.getValue(finalPkName), setterType);
          }
        };
    return res;
  }
  /** <默认构造函数> */
  public RuleItemByteParamDaoImpl(JdbcTemplate jdbcTemplate, LobHandler lobHandler) {
    super();
    AssertUtils.notNull(jdbcTemplate == null, "jdbcTemplate is null.");
    AssertUtils.notNull(lobHandler == null, "lobHandler is null.");
    this.jdbcTemplate = jdbcTemplate;
    this.lobHandler = lobHandler;

    final LobHandler finalLobHandler = this.lobHandler;
    this.ruleItemByteParamRowMapper =
        new RowMapper<RuleItemByteParam>() {
          @Override
          public RuleItemByteParam mapRow(ResultSet rs, int rowNum) throws SQLException {
            RuleItemByteParam ruleItemByteParam = new RuleItemByteParam();
            ruleItemByteParam.setParamKey(rs.getString("paramKey"));
            ruleItemByteParam.setParamOrder(rs.getInt("paramOrder"));
            byte[] attach = finalLobHandler.getBlobAsBytes(rs, "paramValue");
            ruleItemByteParam.setParamValue(attach);
            ruleItemByteParam.setRuleKey(rs.getString("ruleKey"));

            return ruleItemByteParam;
          }
        };
  }
Exemple #23
0
  /**
   * 获取一个设置的callbackHandler实现 <功能详细描述>
   *
   * @param newObjInstance
   * @return [参数说明]
   * @return RowCallbackHandler [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public RowCallbackHandler getSelectRowCallbackHandler(Object newObjInstance) {
    AssertUtils.notNull(this.classReflector, "classReflector is null");

    final MetaObject metaObject = MetaObjectUtils.forObject(newObjInstance);
    final ClassReflector<T> finalClassReflector = this.classReflector;
    RowCallbackHandler res =
        new RowCallbackHandler() {
          @Override
          public void processRow(ResultSet rs) throws SQLException {
            for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) {

              String propertyName = entryTemp.getKey();
              String columnName = entryTemp.getValue();

              if (finalClassReflector.getSetterNames().contains(propertyName)) {
                Class<?> type = getter2JavaTypeMapping.get(propertyName);
                Object value = JdbcUtils.getResultSetValueForSimpleType(rs, columnName, type);
                metaObject.setValue(propertyName, value);
              }
            }
          }
        };
    return res;
  }
  /**
   * @param newTableDef
   * @param sourceTableDef
   * @param ddlDialect
   * @return
   */
  @Override
  public AlterTableDDLBuilder newInstance(
      TableDef newTable, TableDef sourceTable, DDLDialect ddlDialect) {
    AssertUtils.notNull(ddlDialect, "ddlDialect is null.");
    AssertUtils.notNull(newTable, "newTable is null.");
    AssertUtils.notEmpty(newTable.getTableName(), "newTable.tableName is empty.");
    AssertUtils.notNull(sourceTable, "sourceTable is null.");
    AssertUtils.notEmpty(sourceTable.getTableName(), "sourceTable.tableName is empty.");
    AssertUtils.isTrue(
        newTable.getTableName().equalsIgnoreCase(sourceTable.getTableName()),
        "newTable.tableName:{} should equalsIgnoreCase sourceTable.tableName:{}",
        new Object[] {newTable.getTableName(), sourceTable.getTableName()});

    MysqlAlterTableDDLBuilder builder =
        new MysqlAlterTableDDLBuilder(newTable, sourceTable, ddlDialect);
    this.columns.addAll(newTable.getColumns());
    this.indexes.addAll(newTable.getIndexes());
    return builder;
  }
Exemple #25
0
  /** @param 对type进行赋值 */
  public void setType(Class<T> type) {
    AssertUtils.notNull(type, "type is empty.");

    this.type = type;
    this.classReflector = ClassReflector.forClass(type);
  }
Exemple #26
0
  /**
   * 添加其他条件例如额外关联等情况 支持在固定表中存在固定条件的查询 <功能详细描述>
   *
   * @param conditionExpression [参数说明]
   * @return void [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public void addOtherCondition(String conditionExpression) {
    AssertUtils.notEmpty(conditionExpression, "conditionExpression is empty.");

    this.otherCondition.add(conditionExpression);
  }
Exemple #27
0
 /** @param 对modifyAblePropertyNames进行赋值 */
 public void addUpdateAblePropertyNames(String modifyAblePropertyName) {
   AssertUtils.notEmpty(modifyAblePropertyName, "modifyAblePropertyName is empty.");
   this.updateAblePropertyNames.add(modifyAblePropertyName.trim());
 }
Exemple #28
0
 public void addOrder(String order) {
   AssertUtils.notEmpty(order, "order is empty.");
   this.orderList.add(order.trim().toUpperCase());
 }
Exemple #29
0
  /**
   * 获取到属性映射到的字段名<br>
   * <功能详细描述>
   *
   * @param getterName
   * @return [参数说明]
   * @return String [返回类型说明]
   * @exception throws [异常类型] [异常说明]
   * @see [类、类#方法、类#成员]
   */
  public String getColumnNameByGetterName(String getterName) {
    AssertUtils.notEmpty(getterName, "getterName is empty.");

    return this.getter2columnNameMapping.get(getterName);
  }
Exemple #30
0
 /**
  * 获取对象的主键值
  *
  * @param 对pkName进行赋值
  */
 public Object getValue(Object obj) {
   AssertUtils.notNull(obj, "obj is null.");
   MetaObject metaObject = MetaObjectUtils.forObject(obj);
   return metaObject.getValue(this.pkName);
 }