(select GROUP_CONCAT(t.name order by t.checkpoint_id SEPARATOR '-') from gk_cmpt_score_checkpoint t where t.checkpoint_id in (CAST(SUBSTRING_INDEX(d.dis_point,'-',1) AS SIGNED),CAST(SUBSTRING_INDEX(d.dis_point,'-',-1) AS SIGNED)) ) as dis_point_name
from gk_cmpt_checkpoint_dis d
from gk_cmpt_checkpoint_dis d
LEFT JOIN gk_cmpt_score_checkpoint e ON e.cmpt_id = d.cmptId AND CAST(SUBSTRING_INDEX(d.dis_point,'-',-1) AS SIGNED)=e.checkpoint_id
<where>
<where>
<iftest="id != null">
<iftest="id != null">
and id = #{id}
and d.id = #{id}
</if>
</if>
<iftest="cmptId != null">
<iftest="cmptId != null">
and cmptId = #{cmptId}
and d.cmptId = #{cmptId}
</if>
</if>
<iftest="roadId != null">
<iftest="roadId != null">
and roadId = #{roadId}
and d.roadId = #{roadId}
</if>
</if>
<iftest="disPoint != null and disPoint != ''">
<iftest="disPoint != null and disPoint != ''">
and dis_point = #{disPoint}
and d.dis_point = #{disPoint}
</if>
</if>
<iftest="distance != null">
<iftest="distance != null">
and distance = #{distance}
and d.distance = #{distance}
</if>
</if>
<iftest="isDelete != null and isDelete != ''">
<iftest="isDelete != null and isDelete != ''">
and is_delete = #{isDelete}
and d.is_delete = #{isDelete}
</if>
<iftest="pathId > 0">
and d.path_id = #{pathId}
</if>
</if>
</where>
</where>
ORDER BY CAST(SUBSTRING_INDEX(d.dis_point,'-',1) AS SIGNED) ,e.distance