mybatis/mybatis-3 — pull request #136 by litpho (2014-01-27 07:57:16+00:00)
Title: includeColumns element for select

Collections and assocations have the option to specify a columnPrefix, making resultMaps easier to reuse.
However, column lists such as the Base_Column_List generated by Mybatis Generator don't have that option.

I created a separate includeColumns element which takes a tableAlias and an optional columnAliasPrefix. I chose not to fold this functionality into the generic include element, because it's only useful for very specific cases.

If you have the following column list:
a, b, c
and you include it in the select statement as follows:

select

from tab comment

it will render (on one line to save space):
select comment.a as comment_a, comment.b as comment_b, comment.c as comment_c

with an optional columnAliasPrefix "c" it will render:
select comment.a as c_a, comment.b as c_b, comment.c as c_c

This functionality will make reuse of column lists much easier, especially when working with associations or when linking the same table more than once in the same query.