![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mybatis
qq_14840239
这个作者很懒,什么都没留下…
展开
-
mybatis 结构(1)
java包中:entity包放实体类;dao包放操作接口(和xml文件关联的),用@Mapper修饰接口service包放服务接口(用来)service.impl包放实现service的接口(用于操作从dao接口获取的数据,或向dao传递数据等),用@Service修饰类controller包用来放控制类,从service(也可以是dao)获取、存放数据,并可以通过网络访问这些...原创 2019-03-15 17:14:01 · 179 阅读 · 0 评论 -
mybatis 配置(2)
下载idea,新建项目New Project-》SpringInitializr,点 next,更改Group 和Artifat,点next。 选择SQL 中的 mySQL、JDBC、MyBatis。如果有其他需要可以再选其他的选项。在pom.xml 加入以下代码,监控数据库连接池 <dependency> <groupId&g...原创 2019-03-18 14:38:35 · 129 阅读 · 0 评论 -
Mapper.xml文件详解,页面配置和insert 、update、delete(1)
文件在resources目录下,具体位置看 application.yml 中mapper-locations 定义mapper-locations: mybatis/**/*Mapper.xml代表文件目录名是 resources/mybatis/任意目录/文件名Mapper.xml xml文件内容<?xml version="1.0" encoding="UTF-...原创 2019-03-18 14:39:30 · 13192 阅读 · 0 评论 -
Mapper.xml select,resultMap,collection,association标签(2)
select操作:resultType 返回对象类型。也可以使用resultMap (这个是自定义标签)parameterType 传入数据类型。flushCache 默认false ,用于本地缓存和二级缓存清空timeout 默认unset,设置驱动程序等待数据库返回请求结果的秒数fetchSize 默认unset,尝试影响驱动程序每次批量返回的结果行数和这个设置值相等...原创 2019-03-18 15:31:53 · 871 阅读 · 0 评论 -
Mapper.xml 其他标签(3)
格式化输出 where、set、trim<select id="get" resultType="com.entity.user"> select * from user <where> <if test="Name!=null>user_name=#{Name}" and</if>原创 2019-03-18 16:02:01 · 289 阅读 · 0 评论