简单分析下mybatis中mapper文件中小知识

<?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 namespace="*.mapper.IEInvoiceNumPoolMapper" > //namespace中对应的是dao层接口,具体到接口名
<resultMap id="BaseResultMap" type="*.EInvoice.EINumPoolDTO" > //resultMmap中对应的是实体类,具体到实体类名
<id column="EINUMPOOLID" property="EINUMPOOLID" jdbcType="VARCHAR" />
<result column="ADMDIVID" property="ADMDIVID" jdbcType="BIGINT" />
<result column="BillTypeID" property="BillTypeID" jdbcType="BIGINT" />
<result column="YEAR" property="YEAR" jdbcType="VARCHAR" />
<result column="STARTEINUM" property="STARTEINUM" jdbcType="VARCHAR" />
<result column="ENDEINUM" property="ENDEINUM" jdbcType="VARCHAR" />
<result column="CurrentlyNum" property="CurrentlyNum" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
EINUMPOOLID, ADMDIVID, BillTypeID,YEAR,STARTEINUM,ENDEINUM,CurrentlyNum
</sql>
<select id="selectByYear" resultMap="BaseResultMap" parameterType="java.lang.String" > //id对应的就是dao层接口里的方法名,必须一一对应
select
<include refid="Base_Column_List" />
from t_fseinumpool
where YEAR= #{year}
</select>
简单写一下,防止以后遗忘
posted on 2018-09-21 17:06  MrQuan  阅读(454)  评论(0编辑  收藏  举报