這個功能是在下面三個輸入框內不輸入則查詢全部,輸入就進行or關聯查詢並分頁
注意 在使用模糊查詢時,不能使用#{}來獲取值,不然就會報參數異常錯誤,必須要使用${}來獲取值
articleName like '%${articleName}%
@Select("<script>" +
"select * from article" +
"<where>" +
"<if test='articleId != null or articleName != null or articleAuthors != null'>" +
"1=2 "+
"</if>"+
"<if test='articleId != null'>" +
" or articleId = #{articleId}"+
"</if>"+
"<if test='articleName != null'>" +
" or articleName like '%${articleName}%'"+
"</if>"+
"<if test='articleAuthors != null'>" +
" or articleAuthors like '%${articleAuthors}%'"+
"</if>"+
"</where>" +
"limit #{startPosition}, #{limit}" +
"</script>")
List<Article> findAllArticleByserch(@Param("articleId")Integer articleId,@Param("articleName")String articleName,@Param("articleAuthors")String articleAuthors,@Param("startPosition")Integer startPosition, @Param("limit")Integer limit);