MYBATIS共15篇
Mybatis查询集合遍历出错,如何正确使用foreach判断空或null?-Ddmit

Mybatis查询集合遍历出错,如何正确使用foreach判断空或null?

Mybatis动态SQL的另一个常见使用场景是对集合进行遍历(尤其是在构建 IN 条件语句的时候),可以将List、Set、数组等类型的数据作为参数。但是当List作为参数时,判断空需要特别注意。 例如: &...
ddmit的头像-DdmitDdmit5年前
028091
Spring Boot将Mybatis返回结果转为驼峰的三种实现方式-Ddmit

Spring Boot将Mybatis返回结果转为驼峰的三种实现方式

我们通常获取Mybatis返回的数据结果时想要将字段以驼峰的形式返回,比如ORGAN_NAME数据库字段,然后以organName的形式返回,具体实现方式有以下三种: 一、使用Mybatis内置配置 具体yml文件配置...
ddmit的头像-DdmitDdmit5年前
020260
Mybatis There is no getter for property 解决-Ddmit

Mybatis There is no getter for property 解决

mybatis查询出错: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'tableName' in 'class java.lang.String' 出错原因 具体...
ddmit的头像-DdmitDdmit5年前
022120
MyBatis Generator Example用法-Ddmit

MyBatis Generator Example用法

具体生成Example类的方法参见:Maven配置之MyBatis Generator Maven Plugin(三步学会使用MyBatis Generator生成代码); 参考文章: [mybatis]Example的用法 ; mybatis generator生成 example类...
ddmit的头像-DdmitDdmit6年前
021300
MySQL返回插入的自动增长主键mybatis写法-Ddmit

MySQL返回插入的自动增长主键mybatis写法

在使用Mybatis操作数据库,涉及自动增长主键如何获得,以便后续代码使用的方式如下。 1.数据库设置自增键 这里是def_id字段。 2.MyBatis写法 <insert id='insertSysProcessDef' parameterTyp...
ddmit的头像-DdmitDdmit4年前
015590
MyBatis Generator生成代码报错:Table configuration with catalog null-Ddmit

MyBatis Generator生成代码报错:Table configuration with catalog null

使用MyBatis Generator生成代码报错信息如下: [WARNING] Table configuration with catalog null, schema xe, and table SR_CLASS did not resolve to any tables 数据库是oracle,错误原因是...
ddmit的头像-DdmitDdmit6年前
041220
tk.mybatis分页插件PageHelper多表嵌套关联查询分页出错问题解决-Ddmit

tk.mybatis分页插件PageHelper多表嵌套关联查询分页出错问题解决

其实Mybatis-PageHelper插件官方文档上已经有说明不支持嵌套结果的映射。但是可以采用子查询的方式间接实现支持。 修改前: <resultMap type='com.ruoyi.system.domain.SysProcessDef' id='S...
ddmit的头像-DdmitDdmit4年前
018000
Maven配置之MyBatis Generator Maven Plugin(三步学会使用MyBatis Generator生成代码)-Ddmit

Maven配置之MyBatis Generator Maven Plugin(三步学会使用MyBatis Generator生成代码)

学习使用Maven Mybatis插件MyBatis Generator Maven Plugin自动生成实体类、Example类等详细配置。 开发环境:IntelliJ IDEA 2018.3 1.添加插件依赖 插件依赖如下: <plugin> <groupId...
ddmit的头像-DdmitDdmit6年前
041990
Java使用Mybatis typeHandlers实现对数据库字段的加密/解密-Ddmit

Java使用Mybatis typeHandlers实现对数据库字段的加密/解密

数据库中的敏感信息,比如身份证号,手机号等,在进行保存时可能需要我们进行加密保存,在读取时又需要我们进行明文展示。如果使用Mybatis来对数据进行持久化,有两种方式来实现这一目的。 一、...
ddmit的头像-DdmitDdmit4年前
015750
Mybatis中if判断的正确使用方式(mybatis的if判断真是坑)-Ddmit

Mybatis中if判断的正确使用方式(mybatis的if判断真是坑)

Mybatis中if判断的正确使用方式整理如下: 1.Mybatis使用if判断单个字符相等 示例: 比如要判断类型等于'1' 正确方式: <if test='type == '1''> 或者 <if test='type == '1'.toString...
ddmit的头像-DdmitDdmit6年前
033580