【Mybaits】如何在xxMapper.xml中的SQL语句里加入代码注释

还得使用XML注释<!-- Comments --> ,SQL注释--.Java注释 // /*  */都会导致错误。

如:

<mapper namespace="com.hy.dao.CompanyMapper">
    <select id="fetchOne" resultMap="map1">
        select
        <!-- fields -->
        c.id as cid,c.name as cname,e.id as eid,e.name as ename
        from
        <!-- tables -->
        company c,emp e
        where
        <!-- conditions -->
        c.id=e.cid
        and c.id=#{id}
    </select>

    ......
</mapper>

END

posted @ 2022-06-01 06:31  逆火狂飙  阅读(437)  评论(0编辑  收藏  举报
生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东