<%_ if (position === 'import') { _%>
    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>
import org.apache.ibatis.annotations.Select;
    <%_ } _%>
<%_ } _%>
<%_ if (position === 'method') { _%>

    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>
    @Select("select a.* from common_table_field a left join common_table b on a.common_table_id = b.id where b.entity_name = ${entityName} and a.entity_field_name = ${entityFieldName}")
    CommonTableField findOneByCommonTableEntityNameAndEntityFieldName(@Param("entityName") String entityName, @Param("entityFieldName") String entityFieldName);
    <%_ } else { _%>
    CommonTableField findOneByCommonTableEntityNameAndEntityFieldName(String entityName, String entityFieldName);
    <%_ } _%>

    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>
    @Select("select a.* from common_table_field a where a.common_table_id = ${commonTableId} and a.entity_field_name = ${entityFieldName}")
    CommonTableField findOneByCommonTableIdAndEntityFieldName(@Param("commonTableId") Long commonTableId, @Param("entityFieldName") String entityFieldName);
    <%_ } else { _%>
    CommonTableField findOneByCommonTableIdAndEntityFieldName(<%= primaryKey.type %> commonTableId, String entityFieldName);
    <%_ } _%>
    <%_ if (ormTool === 'mybatis' && databaseTypeSql) { _%>

    @Select("select a.* from common_table_field a left join common_table c on c.id = a.common_table_id where c.entity_name = #{commonTableEntityName}")
    List<CommonTableField> findByCommonTableEntityName(@Param("commonTableEntityName") String commonTableEntityName);
    <%_ } _%>
<%_ } _%>
