博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 在SQL里写条件判断

@Sql("SELECT mobile_user.mobile_user_id from mobile_user " +
"INNER JOIN mobile_device_user ON mobile_user.mobile_user_id = mobile_device_user.mobile_user_id " +
"/BEGIN/" +
" WHERE /IF userName != null/mobile_user.user_name LIKE /userName/'%name%'/END/" +
"/END/" +
"ORDER BY mobile_user.mobile_user_id asc;")

重点是BEGIN和END的部分。

 

posted on 2011-01-11 09:36  Likwo  阅读(253)  评论(0编辑  收藏  举报