最近遇到sql语句在pl/sql里能查出数据,但直接放到ibatis配置文件里却查询结果为空,语句为:
select p.* from t_petitionletter p join t_processflow f on p.processflow = f.id where f.flowstate = '办理'
发现[color=red]ibatis不支持直接在配置文件里写where子句,需要使用ibatis的动态where子句标签[/color]:
select p.* from t_petitionletter p join t_processflow f on p.processflow = f.id where f.flowstate = '办理'
发现[color=red]ibatis不支持直接在配置文件里写where子句,需要使用ibatis的动态where子句标签[/color]:
<select id="selectPetitionLetterForFlow" resultMap="PetitionLetterResult" parameterClass="string">
select p.* from t_petitionletter p join t_processflow f on p.processflow = f.id
<dynamic prepend="where">
<isNotEmpty prepend="and">
f.flowstate = #flowstate#
</isNotEmpty>
</dynamic>
</select>