mapper的xml文件的配置与ibatis标签学习
一、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 namespace="com.zw.studyMapper">
<select id="queryNameById" parameterType="java.lang.String" resultType="java.util.HashMap">
<![CDATA[
SELECT a.name from t_student a where a.id = #{id}
]]>
</select>
</mapper>
二、标签学习
1.<dynamic>标签
<dynamic prepend = "and" open = "(" close = ")">
动态标签
<isnotempty>当该标签不为空时,其外面带有括号<\isnotempty>
<\dynamic>
2.<resultMap>标签
<resultMap id = "secGuarRltRepDtoMap" class="全路径类名">
<result property = "acctStatus" column = "acctStatus">
----类的属性 数据库名
</resultMap >
<resultMap id = "secLoanDtoListMap" class="全路径类名">
<result property = "secGuarRltRepDto" column = "xxxx.secGuarRltRepDtoMap">
----类的属性 数据库名
</resultMap >
3.<![CDATA[]]>标签
忽略转义字符