Mybatis传参OrderBy和字符串替换 默认情况下,mybatis使用 #{ } 格式解析用户传递的变量, 但是使用该种方式解析普通变量时, Mybatis会对变量进行转义操作,如果我们传入的参数时用来 order by name desc 的话,那么该变量在转义以后无法表达排序的意思,这时候,我们需要使用 ${ } 来解析 2024-06-04 浏览(185) 评论(0) 阅读全文
SpringBoot+MyBatis+MySQL 返回插入的主键ID 使用MyBatis往MySQL数据库中插入一条记录后,需要返回该条记录的自增主键值。在mapper中指定keyProperty属性,示例如下: 2020-06-27 浏览(1,781) 评论(0) 阅读全文
springboot + mybatis 多数据源配置 数据库与实体类映射(驼峰命名法) 在自己配置的config中 添加:Configuration configuration = new Configuration();configuration.setMapUnderscoreToCamelCase(true); factoryBean.setConfiguration(configuration) 2019-03-21 浏览(2,306) 评论(0) 阅读全文
springboot + mybatis 多数据源配置 #多数据源 配置 spring.datasource.master.url=jdbc:mysql://localhost:3306/test spring.datasource.master.username=root spring.datasource.master.password=root spring.datasource.master.driver-class-name=com.mysql.jdbc.Driver spring.datasource.master.max-idle=10 2019-03-21 浏览(762) 评论(0) 阅读全文