再寫sql語句是如果輸入中包含table的列表,就必須用
?<statement id="selectStatCard" resultClass="edu.hit.ice.ibatis.domain.StatCardOutput" parameterClass="edu.hit.ice.ibatis.domain.StatCardInput" cacheModel="StatCardCache">
??? ?select * from (
?? <dynamic prepend="">
???? <iterate prepend="" property="tablename" conjunction="union"? open="(" close=")" >?
??? ?
??? ?(select HASH,CARD_ID,TOTAL_ACCOUNT,TOTAL_QQ,TOTAL_COUNT,TOTAL_TIME
??????? from $tablename[]$
???????
???????
?????
?????????????
??????? ?<isNotNull prepend="where" property="VALUE1">??
???????????? ?<![CDATA[$ATTR1$>#VALUE1#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE2">??
???????????? ?<![CDATA[$ATTR2$>#VALUE2#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE3">??
???????????? ?<![CDATA[$ATTR3$>#VALUE3#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE4">??
???????????? ?<![CDATA[$ATTR4$>#VALUE4#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE5">??
???????????? ?<![CDATA[$ATTR5$>#VALUE5#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE6">??
???????????? ?<![CDATA[$ATTR6$>#VALUE6#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE7">??
???????????? ?<![CDATA[$ATTR7$>#VALUE7#]]>
???????????? </isNotNull>
???????????? )</iterate>
?? </dynamic>
?
? ) as b??
????????????
??? </statement>
???
?<statement id="selectStatCard" resultClass="edu.hit.ice.ibatis.domain.StatCardOutput" parameterClass="edu.hit.ice.ibatis.domain.StatCardInput" cacheModel="StatCardCache">
??? ?select * from (
?? <dynamic prepend="">
???? <iterate prepend="" property="tablename" conjunction="union"? open="(" close=")" >?
??? ?
??? ?(select HASH,CARD_ID,TOTAL_ACCOUNT,TOTAL_QQ,TOTAL_COUNT,TOTAL_TIME
??????? from $tablename[]$
???????
???????
?????
?????????????
??????? ?<isNotNull prepend="where" property="VALUE1">??
???????????? ?<![CDATA[$ATTR1$>#VALUE1#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE2">??
???????????? ?<![CDATA[$ATTR2$>#VALUE2#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE3">??
???????????? ?<![CDATA[$ATTR3$>#VALUE3#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE4">??
???????????? ?<![CDATA[$ATTR4$>#VALUE4#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE5">??
???????????? ?<![CDATA[$ATTR5$>#VALUE5#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE6">??
???????????? ?<![CDATA[$ATTR6$>#VALUE6#]]>
???????????? </isNotNull>
????????????
???????????? <isNotNull prepend="and" property="VALUE7">??
???????????? ?<![CDATA[$ATTR7$>#VALUE7#]]>
???????????? </isNotNull>
???????????? )</iterate>
?? </dynamic>
?
? ) as b??
????????????
??? </statement>
???