【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 @   逆火狂飙  阅读(444)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2020-06-01 BasicInterpreter2 改进版,简化了print函数
2020-06-01 自编Basic脚本 用BasicIntepreter执行 打印九九乘法表
生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东
点击右上角即可分享
微信分享提示