mybtais的mapper中使用@Select注解使用if

时间:2025-04-03 15:56:27
@Select({"<script>"+ " select t.* from track_name t"+ " <where>"+ " <if test='username!= null and username !=\"\" '>"+ " and =#{username}"+ " </if>"+ " <if test='gmtCreateTime!=null and gmtCreateTime !=\"\" '>"+ " and &gt; #{gmtCreateTime} "+ " </if>"+ " </where>"+ "</script>" }) IPage<TrackName> queryCondition(Page<TrackName> page,@Param("username")String username,@Param("gmtCreateTime")String gmtCreateTime)