![](https://img-blog.csdnimg.cn/20190918140145169.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Mybatis
Mybatis相关内容
root_zhb
这个作者很懒,什么都没留下…
展开
-
mybatis判断两个null相等
mybatis判断两个null 相等原创 2023-01-09 15:08:23 · 339 阅读 · 0 评论 -
Mybatis判断Integer失效
Mybatis判断Integer失效问题错误代码原因解决其他(匹配 int 值)原创 2022-03-31 16:42:28 · 724 阅读 · 0 评论 -
MyBatis if test 判断字符串相等不生效
1、问题采用 MyBatis 框架操作 MySQL 数据库时,判断传入的字符串 prmCreated 值为"N"时,执行相关操作,如下 xml 语句未生效:<if test="prmCreated == 'N'"> and prm_closed = 0</if>2、原因MyBatis 是使用 OGNL 表达式来进行解析的,在 OGNL 表达式中,'N’会被解析成字符。因为 java 是强类型的,char 和 String 不等,所以 if 标签中的 SQL 不会原创 2021-09-06 14:47:42 · 1954 阅读 · 0 评论 -
Mybatis传递实体对象只能直接获取,不能使用对象.属性方式获取
不加@Param注解,取值的时候直接写属性public void addUser(User user);<insert id="addUser" parameterType="com.xxxx.mybatis.entity.User"> insert into user(id,user_name,name,birthday,age) values (#{id},#{userName},#{name},#{birthday},#{age})</insert>.原创 2021-07-15 18:46:01 · 3138 阅读 · 2 评论 -
Mybatis笔记
Mybatis笔记1、#和$的区别2、resultType和resultMap区别3、Mybatis缓存机制4、动态SQL4.1、if4.2、choose (when, otherwise)4.3、trim(where, set)4.4、foreach5、一对一映射6、一对多映射7、映射关系1、#和$的区别#{key} :获取参数的值,预编译到 SQL 中。安全。${key} :获取参数的值,拼接到 SQL 中。有 SQL 注入问题。2、resultType和resultMap区别result原创 2021-07-15 15:01:28 · 221 阅读 · 0 评论