<!-- 跟据 指定字段 进行倒叙或者正序排序-->
<select id="selectAll5" resultType="com.qfedu.entity.Student">
select
*
FROM student s
left join classgrade cc on s.id = cc.stuentId
left join course cs on cs.gradeNum = cc.gradeNum order by
<trim prefixOverrides="," suffixOverrides=""> <!-- prefix 插入指定字符, prefixOverrides:指定去除多余的前缀内容 , suffixOverrides:指定去除多余的后缀内容 -->
<if test="name == null or name ==''">
,name asc
</if>
<if test="name != null and name !=''">
,name desc
</if>
<if test="password != null and password !=''">
,password desc
</if>
<if test="password == null or password ==''">
,password asc
</if>
</trim>
</select>
mybatis xml中 使用if 标签进行多条件排序
最新推荐文章于 2024-08-27 08:39:52 发布