首先需要用<script></script>包围sql,然后像xml一样使用<if></if>判断即可。
//select注解
@Select("<script>select * from table where 1 = 1 <if test=a != null> and a = #{a} </if></script>")
首先需要用<script></script>包围sql,然后像xml一样使用<if></if>判断即可。
//select注解
@Select("<script>select * from table where 1 = 1 <if test=a != null> and a = #{a} </if></script>")