读书人

Ibtis的where子句有关问题

发布时间: 2012-10-08 19:54:56 作者: rapoo

Ibtis的where子句问题
最近遇到sql语句在pl/sql里能查出数据,但直接放到ibatis配置文件里却查询结果为空,语句为:
select p.* from t_petitionletter p join t_processflow f on p.processflow = f.id where f.flowstate = '办理'

发现ibatis不支持直接在配置文件里写where子句,需要使用ibatis的动态where子句标签:

<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>

读书人网 >软件架构设计

热点推荐