如下,给path加 %
List<Group> xxx(@Param("path") String path, @Param("order") String order);
<select id="xxx" resultMap="BaseResultMap">
SELECT *
FROM base_group
<where>
<if test="path != null and path != ''">
<bind name="pattern" value="path+'%'" />
AND `path` LIKE #{pattern}
</if>
</where>
ORDER BY LENGTH(`path`) ${order}
</select>