<selectid="getUserListLimit"resultMap="getUserList">
select user.* from smbms_user as user
<trimprefix="WHERE"prefixOverrides="AND |OR "><iftest="userName != null and userName != ''">
and user.userName like Concat('%',#{userName},'%')
</if><iftest="userRole != null">
and user.userRole=#{userRole}
</if></trim>
order by creationDate DESC
LIMIT #{from},#{pageSize}
</select>
后端-框架-MyBatis-动态SQL-limitpublic interface UserMapper { public int count(); public List&amp;lt;User&amp;gt; getUserListLimit(@Param(&quot;userName&quot;)String userName, @Param(&quot;userRole&quot;)Integer roleId,