Mybatis 知识积累
官方网站
https://mybatis.org/mybatis-3/zh/index.html
https://mybatis.org/mybatis-3/getting-started.html
http://www.mybatis.cn/
mybatis-plugs
https://baomidou.com/
mybatis mapper 模板
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.mybatis.example.BlogMapper">
<select id="selectBlog" resultType="Blog">
select * from Blog where id = #{id}
</select>
</mapper>
建议将 mybatis mapper 模版及 mybatis config 模版配置至idea中
mybatis foreach循环写法
select order_no ,order_type from order_detail
where delete_date >='2022-07-10' and delete_date < '2022-07-14'
and order_type in (1,1108) and order_no in
<foreach collection="orderNoList" separator="," open="(" close=")" index="" item="orderNo">
#{orderNo,javaType=Integer}
</foreach>
mybatis 转义
mybatis 中 SQL 写在mapper.xml文件中,而xml解析 < 、>、<=、>= 时会出错,这时应该使用转义写法。
http://www.mybatis.cn/archives/754.html
作者:努力为明天
-------------------------------------------
个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!