代码 :
<int-jdbc:inbound-channel-adapter
query="SELECT USER_ID,BOOK_ID FROM BOOK WHERE ROWNUM <= 11"
channel="index-back-data" data-source="dataSource"
max-rows-per-poll="10"
update=" ? "
row-mapper="DataRowMapper">
<int:poller fixed-delay="10000" />
</int-jdbc:inbound-channel-adapter>
问题 :
在轮询 BOOK 表时,我可能会将 bookid 设为 null 那么如何使用 update 属性将其删除?
我们可以在更新中使用条件删除作为
:bookId != null ? 'DELETE FROM BOOK WHERE USER_ID = :userId AND BOOK_ID = :bookId : DELETE FROM BOOK WHERE USER_ID = :userId AND BOOK_ID IS NULL
任何帮助将不胜感激 !