![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mybatis
菜鸟gogoing
这个作者很懒,什么都没留下…
展开
-
mybatis #{} 和 ${}的区别
首先 #{}是预编译处理,${}是字符串替换。1.Mybatis在处理#{}时,会将sql中的#{}替换为?号,调用PreparedStatement的set方法来赋值;select * from user where name = #{name};#{} 在预处理时,会把参数部分用一个占位符 ? 代替,变成如下的 sql 语句:select * from user where name = ?;select * from user where name ="zhangsan";.原创 2020-11-27 18:28:18 · 179 阅读 · 0 评论 -
springboot mybatis 动态传表名和条件查询数据
id 为主键Map<String, Object> findByTableAndId(@Param("tableName")String tableName,@Param("id")String id);<select id="findByTableAndId" resultType="java.util.Map" parameterType="java.lang.St原创 2018-08-01 10:27:01 · 3406 阅读 · 0 评论 -
spring boot mybatis 配置 返回空数据
## Mybatismybatis.typeAliasesPackage=zhitu.sq.dataset.modelmybatis.mapperLocations=classpath:mapper/*.xml默认配置查询的时候对 返回为map 类型的数据,如果数据为空,查询出来的数据就不显示,有时候我们需要这些为空的数据,对其进行判断。mybatis.configuration.cal...原创 2018-08-01 10:14:55 · 711 阅读 · 0 评论 -
mybatis 查询表字段名及字段类型
<select id="findFields" resultType="java.lang.String">select DISTINCT COLUMN_NAME,DATA_TYPE from information_schema.COLUMNS where table_name = #{dataTable} </select>原创 2018-08-01 10:51:58 · 10777 阅读 · 0 评论