这是我的自定义maven原型中的mybatis mapper.xml:
...
<sql id="selectSql">
<where>
<if test="id != null">
id = #{id}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
...
mybatis符号#{..}不是maven原型符号$ {...},问题是mapper.xml在将#{...}替换为#...时出错,在新maven项目后丢失{}通过自定义原型:
<sql id="selectSql">
<where>
<if test="id != null">
id = #id
</if>
<if test="parentId != null">
and parent_id = #parentId
</if>
我只将2个属性键命名如下,与mybatis mapper xml无关:
<requiredProperties>
<requiredProperty key="projectName">
<defaultValue>hntest</defaultValue>
</requiredProperty>
<requiredProperty key="ConstantClassName">
<defaultValue>HnTestConstant</defaultValue>
</requiredProperty>
</requiredProperties>
为什么maven archetype fileter {...}以及如何避免这个问题?