<!-- xml的标准格式 -->
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!-- mapper的根节点 -->
<mapper namespace="com.mayi.service.mobile.suburbtrip.db.dao.mapper.CouponActivityInfoMapper" >
  <!--
 标签cache
  -->
  <cache
  eviction="FIFO"
  flushInterval="60000"
  size="512"
  readOnly="true"/>
  <!--
 标签cache-ref
  -->
  <cache-ref namespace="com.someone.application.data.SomeMapper"/>
  <!-- parameterMap -->
  <!-- resultMap -->
  <!--
 标签sql
 sql代码段,使用时,利用标签<include refid="" />引入
 如:
   <select id="selectUsers" resultType="map">
    select <include refid="userColumns"/>
    from some_table
    where id = #{id}
   </select>
  -->
  <sql id="userColumns"> id,username,password </sql>
  <!--
 标签select
 select所拥有的参数如下:
 id="selectPerson"   该statement对应的id
 parameterType="int"  传入参数类型
 parameterMap="deprecated"  传入参数map
 resultType="hashmap"  返回参数类型
 resultMap="personResultMap"  返回参数map
 flushCache="false"  如果设为true,则会在每次语句调用的时候就会清空缓存。select 语句默认设为false
 useCache="true" 将其设置为 true, 将会导致本条语句的结果被缓存。默认值: true
 timeout="10000" 这个设置驱动程序等待数据库返回请求结果,并抛出异常时间的最大等待值。默认不设置(驱动自行处理)
 fetchSize="256" 这是暗示驱动程序每次批量返回的结果行数。默认不设置(驱动自行处理)
 statementType="PREPARED" statement,preparedstatement,callablestatement 预准备语句、可调用语句
 resultSetType="FORWARD_ONLY forward_only,scroll_sensitive,scroll_insensitive 只转发,滚动敏感,不区分大小写的滚动
 databaseId
 resultOrdered
 resultSets
  -->
  <select id="selectPerson" parameterType="int" resultType="hashmap">
 SELECT * FROM PERSON WHERE ID = #{id}
  </select>
  <!--
 标签insert 、update、delete
 标签属性如下:
 id="insertAuthor"  对应的id
 parameterType="domain.blog.Author" 
 flushCache="true"
 statementType="PREPARED"
 keyProperty=""
 keyColumn=""
 useGeneratedKeys=""
 timeout="20"
  -->
  <insert id="insertAuthor">
   insert into Author (id,username,password,email,bio)
   values (#{id},#{username},#{password},#{email},#{bio})
  </insert>
  <update id="updateAuthor">
   update Author set
  username = #{username},
  password = #{password},
  email = #{email},
  bio = #{bio}
   where id = #{id}
  </update>
  <delete id="deleteAuthor">
 delete from Author where id = #{id}
  </delete>
 
</mapper>

Mybatis mapper.xml 配置的更多相关文章

  1. Java DB 访问之 mybatis mapper xml 配置方式

    1 项目说明 项目采用 maven 组织 ,jdbc 唯一的依赖就是 mysql-connector-java pom 依赖如下: mysql 数据连接 : mysql-connector-java ...

  2. mybatis mapper xml文件配置resultmap时,id行和result行有什么区别?

    mybatis mapper xml文件配置resultmap时,id行和result行有什么区别? <resultMap id = "CashInvoiceMap" typ ...

  3. mybatis mapper.xml 配置文件问题(有的错误xml是不报的) 导致服务无法启动 。

    转载自 开源编程 一舟mybatsi xml编译报错,tomcat启动一直循环,导致内存溢出,启动失败 mapper.xml怎么知道有没有编译错误,哪个位置有错误 这应该是mybatis的一个bug, ...

  4. generator自动生成mybatis的xml配置

    generator自动生成mybatis的xml配置.model.map等信息:1.下载mybatis-generator-core-1.3.2.jar包.       网址:http://code. ...

  5. mybatis Mapper.xml和Mapper.java

    mybatis Mapper.xml和Mapper.java 通过Mapper.xml和Mapper.java来实现mybatis.环境和入门的一样的.关键:Mapper.xml + Mapper.j ...

  6. SpringBoot整合MyBatis之xml配置

    现在业界比较流行的数据操作层框架 MyBatis,下面就讲解下 Springboot 如何整合 MyBatis,这里使用的是xml配置SQL而不是用注解.主要是 SQL 和业务代码应该隔离,方便和 D ...

  7. SpringBoot系列-整合Mybatis(XML配置方式)

    目录 一.什么是 MyBatis? 二.整合方式 三.实战 四.测试 本文介绍下SpringBoot整合Mybatis(XML配置方式)的过程. 一.什么是 MyBatis? MyBatis 是一款优 ...

  8. MyBatis Mapper XML 详解

    MyBatis Mapper XML 详解 MyBatis 真正的力量是在映射语句中.这里是奇迹发生的地方.对于所有的力量,SQL 映射的 XML 文件是相当的简单.当然如果你将它们和对等功能的 JD ...

  9. MyBatis Mapper.xml文件中 $和#的区别

    MyBatis Mapper.xml文件中 $和#的区别   网上有很多,总之,简略的写一下,作为备忘.例子中假设参数名为 paramName,类型为 VARCHAR . 1.优先使用#{paramN ...

随机推荐

  1. ValueError: numpy.dtype has the wrong size, try recompiling

    问题ValueError: numpy.dtype has the wrong size, try recompiling解决 这是因为 Python 包的版本问题,例如安装了较旧版本的 Numpy, ...

  2. sql回显注入(满满的干货)

    三种注入poc where user_id = 1 or 1=1 where user_id = '1' or '1'='1' where user_id =" 1 "or &qu ...

  3. 【并行计算-CUDA开发】关于共享内存(shared memory)和存储体(bank)的事实和疑惑

    关于共享内存(shared memory)和存储体(bank)的事实和疑惑 主要是在研究访问共享内存会产生bank conflict时,自己产生的疑惑.对于这点疑惑,网上都没有相关描述, 不管是国内还 ...

  4. SQL 查看某个表被哪些存储过程或者视图使用

    --查询某个表被哪些视图/存储过程使用(type='P':表示存储过程,type='V':表示视图) SELECT OBJECT_NAME(id) FROM syscomments WHERE id ...

  5. soap-ws获取ws中的所有的接口方法

    soap-ws获取wsdl中的所有的接口方法 示例wsdl文件如下,生成的过程可以参考https://www.cnblogs.com/chenyun-/p/11502446.html: <def ...

  6. java8 用法小结

    一 简单的stream parallelStream慎用,除非你知道它内部干了什么 List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, ...

  7. Servlet简单例子

    一.项目结构 二.index.jsp <%@ page contentType="text/html; charset=utf-8" %> <html> & ...

  8. 对Redis 单进程、单线程模型的理解(网摘)

    1.基本原理 采用多路 I/O 复用技术可以让单个线程高效的处理多个连接请求(尽量减少网络IO的时间消耗) (1)为什么不采用多进程或多线程处理? 多线程处理可能涉及到锁 多线程处理会涉及到线程切换而 ...

  9. PC端判断屏幕宽度到达手机宽度的时候,直接跳转手机页面

    <script> // //判断屏幕宽度到达手机宽度的时候,直接跳转手机页面 // window.addEventListener("resize", function ...

  10. 经验:什么影响了数据库查询速度、什么影响了MySQL性能 (转)

    一.什么影响了数据库查询速度 1.1 影响数据库查询速度的四个因素 1.2 风险分析 QPS:Queries Per Second意思是“每秒查询率”,是一台服务器每秒能够相应的查询次数,是对一个特定 ...