src/main/java/cn/felord/mybatis/CrudMapperProvider.java
private void findById(Configuration configuration) {
        String findId = mapperInterface.getName().concat(".").concat("findById");
        if (existStatement(configuration,findId)){
            return;
        }
        String[] COLUMNS = columnFields.stream()
                .map(Field::getName)
                .map(CrudMapperProvider::camelCaseToMapUnderscore)
                .toArray(String[]::new);

        String CONDITION = primaryColumn().concat(" = #{" + identifer + "}");

        String findSQL = new SQL()
                .SELECT(COLUMNS)
                .FROM(table)
                .WHERE(CONDITION)
                .toString();

        Map<String, Object> additionalParameters = new HashMap<>();

        doAddMappedStatement(configuration, findId, findSQL, SqlCommandType.SELECT, primaryKeyType, additionalParameters);


    }
/**
     * Find by id.
     *
     * @param configuration the configuration
     */
Find by id.
@param configuration the configuration
Find by id . @param configuration the configuration
private void findById(Configuration configuration) {
        String findId = mapperInterface.getName().concat(".").concat("findById");
        if (existStatement(configuration,findId)){
            return;
        }
        String[] COLUMNS = columnFields.stream()
                .map(Field::getName)
                .map(CrudMapperProvider::camelCaseToMapUnderscore)
                .toArray(String[]::new);
        String CONDITION = primaryColumn().concat(" = #{" + identifer + "}");
        String findSQL = new SQL()
                .SELECT(COLUMNS)
                .FROM(table)
                .WHERE(CONDITION)
                .toString();
        Map<String, Object> additionalParameters = new HashMap<>();
        doAddMappedStatement(configuration, findId, findSQL, SqlCommandType.SELECT, primaryKeyType, additionalParameters);
    }
private void findById ( Configuration configuration ) { String findId = mapperInterface . getName ( ) . concat ( "." ) . concat ( "findById" ) ; if ( existStatement ( configuration , findId ) ) { return ; } String [ ] COLUMNS = columnFields . stream ( ) . map ( Field :: getName ) . map ( CrudMapperProvider :: camelCaseToMapUnderscore ) . toArray ( String [ ] :: new ) ; String CONDITION = primaryColumn ( ) . concat ( " = #{" + identifer + "}" ) ; String findSQL = new SQL ( ) . SELECT ( COLUMNS ) . FROM ( table ) . WHERE ( CONDITION ) . toString ( ) ; Map < String , Object > additionalParameters = new HashMap < > ( ) ; doAddMappedStatement ( configuration , findId , findSQL , SqlCommandType . SELECT , primaryKeyType , additionalParameters ) ; }
Find by id.
Find by id .