<select id="getList" parameterType="com.hyq.common.hyqobject.HyqPageParam"
resultMap="BaseResultMap">
select a.*,b.xuebu
from (select * from zstudent where 1=1
<if test="conditiona != null and conditiona != ''">${conditiona}</if>
<if test="sort != null and order!=null and conditionb != null">order by ${sort} ${order}</if>先全部排序
<if test="conditionb == null">limit ${page},${rows}</if>) a 再取limit多少条数据
left join zxuebu b on a.zymc=b.professional
where 1=1
<if test="conditionb != null and conditionb != ''">${conditionb} limit ${page},${rows}</if>
<if test="sort != null and order!=null">order by ${sort} ${order}</if> join后再排序,只有经过两排序后才会得到正确的数据
</select>
mybatis快速得到排序结果
最新推荐文章于 2025-03-16 17:01:18 发布