私は次のようなクエリマッパーを持っています:
<select id="searchSomething" parameterType="SomeType" resultType="SomeOtherType">
select xxxxx
from T_XXXX
where 1=1
<if test="propertyName == 'userName'">
and USER_NAME = #{propertyValue}
</if>
<if test="propertyName == 'address'">
and ADDRESS = #{propertyValue}
</if>
<if test="propertyName == 'taskDate'">
and TASK_DATE = #{propertyValue}
</if>
<if test="propertyName == 'phone1'">
and PHONE_1 = #{propertyValue}
</if>
<if test="propertyName == 'phone2'">
and PHONE_2 = #{propertyValue}
</if>
...
</select>
非常に多くのプロパティがあります。次のように、プロパティ名を列名に単純にマップするにはどうすればよいですか。
<select id="searchSomething" parameterType="SomeType" resultType="SomeOtherType">
select xxxxx
from T_XXXX
where 1=1
and
<propertyToColumn property="propertyName" />
= #{propertyValue}
</select>
MyBatisに「propertyToColumn」のようなものはありますか?
iBatisで「insertColumnName」を見つけましたが、MyBatisから削除されていますか?
parameterTypeは、次のようなJavaクラスです。
public class SomeType{
private String propertyName;
private String propertyValue;
... getters and setters
}